[0-9\.]+)', mySSH.getBefore())
@@ -177,7 +178,7 @@ class EPCManagement():
HELP.GenericHelp(CONST.Version)
HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type)
sys.exit('Insufficient EPC Parameters')
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
logging.debug('Using the OAI EPC Release 14 SPGW-CUPS in Docker')
@@ -211,9 +212,40 @@ class EPCManagement():
mySSH.close()
HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
+ def Initialize5GCN(self, HTML):
+ if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '':
+ HELP.GenericHelp(CONST.Version)
+ HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type)
+ sys.exit('Insufficient EPC Parameters')
+ mySSH = SSH.SSHConnection()
+ mySSH.open(self.IPAddress, self.UserName, self.Password)
+ if re.match('ltebox', self.Type, re.IGNORECASE):
+ logging.debug('Using the sabox simulated HSS')
+ mySSH.command('if [ -d ' + self.SourceCodePath + '/scripts ]; then echo ' + self.Password + ' | sudo -S rm -Rf ' + self.SourceCodePath + '/scripts ; fi', '\$', 5)
+ mySSH.command('mkdir -p ' + self.SourceCodePath + '/scripts', '\$', 5)
+ mySSH.command('cd /opt/hss_sim0609', '\$', 5)
+ mySSH.command('echo ' + self.Password + ' | sudo -S rm -f hss.log', '\$', 5)
+ mySSH.command('echo ' + self.Password + ' | sudo -S echo "Starting sudo session" && sudo su -c "screen -dm -S simulated_5g_hss ./start_5g_hss"', '\$', 5)
+ logging.debug('Using the sabox')
+ mySSH.command('cd /opt/ltebox/tools', '\$', 5)
+ mySSH.command('echo ' + self.Password + ' | sudo -S ./start_sabox', '\$', 5)
+ else:
+ logging.error('This option should not occur!')
+ mySSH.close()
+ HTML.CreateHtmlTestRow(self.Type, 'OK', CONST.ALL_PROCESSES_OK)
+
+ def SetAmfIPAddress(self):
+ # Not an error if we don't need an 5GCN
+ if self.IPAddress == '' or self.UserName == '' or self.Password == '' or self.SourceCodePath == '' or self.Type == '':
+ return
+ if self.IPAddress == 'none':
+ return
+ if re.match('ltebox', self.Type, re.IGNORECASE):
+ self.MmeIPAddress = self.IPAddress
+
def CheckHSSProcess(self, status_queue):
try:
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
mySSH.command('docker top ' + self.containerPrefix + '-oai-hss', '\$', 5)
@@ -238,7 +270,7 @@ class EPCManagement():
def CheckMMEProcess(self, status_queue):
try:
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
mySSH.command('docker top ' + self.containerPrefix + '-oai-mme', '\$', 5)
@@ -251,11 +283,11 @@ class EPCManagement():
elif re.match('OAI', self.Type, re.IGNORECASE):
result = re.search('\/bin\/bash .\/run_', mySSH.getBefore())
elif re.match('ltebox', self.Type, re.IGNORECASE):
- result = re.search('mme', mySSH.getBefore())
+ result = re.search('mme|amf', mySSH.getBefore())
else:
logging.error('This should not happen!')
if result is None:
- logging.debug('\u001B[1;37;41m MME Process Not Found! \u001B[0m')
+ logging.debug('\u001B[1;37;41m MME|AMF Process Not Found! \u001B[0m')
status_queue.put(CONST.MME_PROCESS_FAILED)
else:
status_queue.put(CONST.MME_PROCESS_OK)
@@ -265,7 +297,7 @@ class EPCManagement():
def CheckSPGWProcess(self, status_queue):
try:
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
mySSH.command('docker top ' + self.containerPrefix + '-oai-spgwc', '\$', 5)
@@ -281,11 +313,11 @@ class EPCManagement():
result = re.search('\/bin\/bash .\/run_', mySSH.getBefore())
elif re.match('ltebox', self.Type, re.IGNORECASE):
mySSH.command('stdbuf -o0 ps -aux | grep --color=never xGw | grep -v grep', '\$', 5)
- result = re.search('xGw', mySSH.getBefore())
+ result = re.search('xGw|upf', mySSH.getBefore())
else:
logging.error('This should not happen!')
if result is None:
- logging.debug('\u001B[1;37;41m SPGW Process Not Found! \u001B[0m')
+ logging.debug('\u001B[1;37;41m SPGW|UPF Process Not Found! \u001B[0m')
status_queue.put(CONST.SPGW_PROCESS_FAILED)
else:
status_queue.put(CONST.SPGW_PROCESS_OK)
@@ -294,7 +326,7 @@ class EPCManagement():
os.kill(os.getppid(),signal.SIGUSR1)
def TerminateHSS(self, HTML):
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-hss /bin/bash -c "killall --signal SIGINT oai_hss tshark"', '\$', 5)
@@ -322,14 +354,14 @@ class EPCManagement():
mySSH.command('cd ' + self.SourceCodePath, '\$', 5)
mySSH.command('cd scripts', '\$', 5)
time.sleep(1)
- mySSH.command('echo ' + self.Password + ' | sudo -S killall --signal SIGKILL hss_sim', '\$', 5)
+ mySSH.command('echo ' + self.Password + ' | sudo -S screen -S simulated_hss -X quit', '\$', 5)
else:
logging.error('This should not happen!')
mySSH.close()
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
def TerminateMME(self, HTML):
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-mme /bin/bash -c "killall --signal SIGINT oai_mme tshark"', '\$', 5)
@@ -355,7 +387,7 @@ class EPCManagement():
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
def TerminateSPGW(self, HTML):
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
mySSH.command('docker exec -it ' + self.containerPrefix + '-oai-spgwc /bin/bash -c "killall --signal SIGINT oai_spgwc tshark"', '\$', 5)
@@ -397,6 +429,22 @@ class EPCManagement():
mySSH.close()
HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
+ def Terminate5GCN(self, HTML):
+ mySSH = SSH.SSHConnection()
+ mySSH.open(self.IPAddress, self.UserName, self.Password)
+ if re.match('ltebox', self.Type, re.IGNORECASE):
+ mySSH.command('cd /opt/ltebox/tools', '\$', 5)
+ mySSH.command('echo ' + self.Password + ' | sudo -S ./stop_sabox', '\$', 5)
+ time.sleep(1)
+ mySSH.command('cd ' + self.SourceCodePath, '\$', 5)
+ mySSH.command('cd scripts', '\$', 5)
+ time.sleep(1)
+ mySSH.command('echo ' + self.Password + ' | sudo -S screen -S simulated_5g_hss -X quit', '\$', 5)
+ else:
+ logging.error('This should not happen!')
+ mySSH.close()
+ HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK)
+
def DeployEpc(self, HTML):
logging.debug('Trying to deploy')
if not re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE):
@@ -408,7 +456,7 @@ class EPCManagement():
HELP.GenericHelp(CONST.Version)
HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type)
sys.exit('Insufficient EPC Parameters')
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
mySSH.command('docker-compose --version', '\$', 5)
result = re.search('docker-compose version 1', mySSH.getBefore())
@@ -502,7 +550,7 @@ class EPCManagement():
logging.debug('Trying to undeploy')
# No check down, we suppose everything done before.
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
# Recovering logs and pcap files
mySSH.command('cd ' + self.SourceCodePath + '/logs', '\$', 5)
@@ -546,7 +594,7 @@ class EPCManagement():
HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER)
def LogCollectHSS(self):
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5)
mySSH.command('rm -f hss.log.zip', '\$', 5)
@@ -576,7 +624,7 @@ class EPCManagement():
mySSH.close()
def LogCollectMME(self):
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5)
mySSH.command('rm -f mme.log.zip', '\$', 5)
@@ -597,13 +645,13 @@ class EPCManagement():
mySSH.command('echo ' + self.Password + ' | sudo -S rm mme*.log', '\$', 5)
elif re.match('ltebox', self.Type, re.IGNORECASE):
mySSH.command('cp /opt/ltebox/var/log/*Log.0 .', '\$', 5)
- mySSH.command('zip mme.log.zip mmeLog.0 s1apcLog.0 s1apsLog.0 s11cLog.0 libLog.0 s1apCodecLog.0', '\$', 60)
+ mySSH.command('zip mme.log.zip mmeLog.0 s1apcLog.0 s1apsLog.0 s11cLog.0 libLog.0 s1apCodecLog.0 amfLog.0 ngapcLog.0 ngapcommonLog.0 ngapsLog.0', '\$', 60)
else:
logging.error('This option should not occur!')
mySSH.close()
def LogCollectSPGW(self):
- mySSH = SSH.SSHConnection()
+ mySSH = SSH.SSHConnection()
mySSH.open(self.IPAddress, self.UserName, self.Password)
mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5)
mySSH.command('rm -f spgw.log.zip', '\$', 5)
@@ -625,8 +673,8 @@ class EPCManagement():
mySSH.command('zip spgw.log.zip spgw*.log', '\$', 60)
mySSH.command('echo ' + self.Password + ' | sudo -S rm spgw*.log', '\$', 5)
elif re.match('ltebox', self.Type, re.IGNORECASE):
- mySSH.command('cp /opt/ltebox/var/log/xGwLog.0 .', '\$', 5)
- mySSH.command('zip spgw.log.zip xGwLog.0', '\$', 60)
+ mySSH.command('cp /opt/ltebox/var/log/*Log.0 .', '\$', 5)
+ mySSH.command('zip spgw.log.zip xGwLog.0 upfLog.0', '\$', 60)
else:
logging.error('This option should not occur!')
mySSH.close()
diff --git a/ci-scripts/html.py b/ci-scripts/html.py
index b3ee00e7dc..9eadf30279 100644
--- a/ci-scripts/html.py
+++ b/ci-scripts/html.py
@@ -47,7 +47,7 @@ import constants as CONST
class HTMLManagement():
def __init__(self):
-
+
self.htmlFile = ''
self.htmlHeaderCreated = False
self.htmlFooterCreated = False
@@ -86,13 +86,13 @@ class HTMLManagement():
#-----------------------------------------------------------
# Setters and Getters
#-----------------------------------------------------------
-
+
def SethtmlUEConnected(self, nbUEs):
if nbUEs > 0:
self.htmlUEConnected = nbUEs
else:
self.htmlUEConnected = 1
-
+
#-----------------------------------------------------------
@@ -365,6 +365,16 @@ class HTMLManagement():
self.htmlFile.write(' KO - SPGW process not found \n')
elif (processesStatus == CONST.UE_IP_ADDRESS_ISSUE):
self.htmlFile.write(' KO - Could not retrieve UE IP address \n')
+ elif (processesStatus == CONST.PHYSIM_IMAGE_ABSENT):
+ self.htmlFile.write(' KO - No such image oai-physim \n')
+ elif (processesStatus == CONST.OC_LOGIN_FAIL):
+ self.htmlFile.write(' KO - Could not log onto cluster \n')
+ elif (processesStatus == CONST.OC_PROJECT_FAIL):
+ self.htmlFile.write(' KO - Could not register into cluster project \n')
+ elif (processesStatus == CONST.OC_IS_FAIL):
+ self.htmlFile.write(' KO - Could not create Image Stream \n')
+ elif (processesStatus == CONST.OC_PHYSIM_DEPLOY_FAIL):
+ self.htmlFile.write(' KO - Could not properly deploy physim on cluster \n')
else:
self.htmlFile.write(' ' + str(status) + ' \n')
else:
@@ -412,7 +422,12 @@ class HTMLManagement():
for image in collectInfo:
files = collectInfo[image]
# TabHeader for image logs on built shared and target images
- self.htmlFile.write(' \n')
+ if allImagesSize[image].count('unknown') > 0:
+ self.htmlFile.write(' \n')
+ elif allImagesSize[image].count('Build Failed') > 0:
+ self.htmlFile.write(' \n')
+ else:
+ self.htmlFile.write(' \n')
self.htmlFile.write(' ---- ' + image + ' IMAGE STATUS ----> Size ' + allImagesSize[image] + ' \n')
self.htmlFile.write(' \n')
self.htmlFile.write(' \n')
@@ -431,21 +446,54 @@ class HTMLManagement():
self.htmlFile.write(' ' + str(parameters['errors']) + ' \n')
else:
self.htmlFile.write(' ' + str(parameters['errors']) + ' \n')
- if (parameters['warnings'] == 0):
+ if (parameters['errors'] > 0):
+ self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
+ elif (parameters['warnings'] == 0):
self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)):
self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
else:
- self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
+ self.htmlFile.write(' ' + str(parameters['warnings']) + ' \n')
if (parameters['errors'] == 0) and (parameters['warnings'] == 0):
self.htmlFile.write(' OK \n')
elif (parameters['errors'] == 0) and ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)):
self.htmlFile.write(' OK \n')
else:
- self.htmlFile.write(' NOT OK \n')
+ self.htmlFile.write(' NOT OK \n')
self.htmlFile.write(' \n')
self.htmlFile.close()
+ #for the moment it is limited to 4 columns, to be made generic later
+ def CreateHtmlDataLogTable(self, DataLog):
+ if (self.htmlFooterCreated or (not self.htmlHeaderCreated)):
+ return
+ self.htmlFile = open('test_results.html', 'a')
+
+ # TabHeader
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ---- ' + DataLog['Title'] + ' ---- \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' '+ DataLog['ColNames'][0] +' \n')
+ self.htmlFile.write(' ' + DataLog['ColNames'][1] + ' \n')
+ self.htmlFile.write(' ' + DataLog['ColNames'][2] + ' \n')
+ self.htmlFile.write(' '+ DataLog['ColNames'][3] +' \n')
+ self.htmlFile.write(' \n')
+
+ for k in DataLog['Data']:
+ # TestRow
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ' + k + ' \n')
+ self.htmlFile.write(' ' + DataLog['Data'][k][0] + ' \n')
+ self.htmlFile.write(' ' + DataLog['Data'][k][1] + ' \n')
+ if float(DataLog['Data'][k][2])> DataLog['Threshold'][k]:
+ self.htmlFile.write(' ' + DataLog['Data'][k][2] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + ' \n')
+ else:
+ self.htmlFile.write(' ' + DataLog['Data'][k][2] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.close()
+
+
def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue):
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
self.htmlFile = open('test_results.html', 'a')
@@ -479,3 +527,140 @@ class HTMLManagement():
self.htmlFile.write(' \n')
self.htmlFile.close()
+ def CreateHtmlTestRowCppCheckResults(self, CCR):
+ if (self.htmlFooterCreated or (not self.htmlHeaderCreated)):
+ return
+ self.htmlFile = open('test_results.html', 'a')
+ vId = 0
+ for version in CCR.versions:
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Results for cppcheck v ' + version + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' NB ERRORS \n')
+ if CCR.nbErrors[vId] == 0:
+ myColor = 'lightgreen'
+ elif CCR.nbErrors[vId] < 20:
+ myColor = 'orange'
+ else:
+ myColor = 'lightcoral'
+ self.htmlFile.write(' ' + str(CCR.nbErrors[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' NB WARNINGS \n')
+ if CCR.nbWarnings[vId] == 0:
+ myColor = 'lightgreen'
+ elif CCR.nbWarnings[vId] < 20:
+ myColor = 'orange'
+ else:
+ myColor = 'lightcoral'
+ self.htmlFile.write(' ' + str(CCR.nbWarnings[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ----------------- \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Memory leak \n')
+ self.htmlFile.write(' ' + str(CCR.nbMemLeaks[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Possible null pointer deference \n')
+ self.htmlFile.write(' ' + str(CCR.nbNullPtrs[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Uninitialized variable \n')
+ self.htmlFile.write(' ' + str(CCR.nbUninitVars[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Undefined behaviour shifting \n')
+ self.htmlFile.write(' ' + str(CCR.nbTooManyBitsShift[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Signed integer overflow \n')
+ self.htmlFile.write(' ' + str(CCR.nbIntegerOverflow[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Printf formatting issues \n')
+ self.htmlFile.write(' ' + str(CCR.nbInvalidPrintf[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Modulo result is predetermined \n')
+ self.htmlFile.write(' ' + str(CCR.nbModuloAlways[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Opposite Condition -> dead code \n')
+ self.htmlFile.write(' ' + str(CCR.nbOppoInnerCondition[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Wrong Scanf Nb Args \n')
+ self.htmlFile.write(' ' + str(CCR.nbWrongScanfArg[vId]) + ' \n')
+ self.htmlFile.write(' \n')
+ vId += 1
+
+ def CreateHtmlTestRowPhySimTestResult(self, testSummary, testResult):
+ if (self.htmlFooterCreated or (not self.htmlHeaderCreated)):
+ return
+ self.htmlFile = open('test_results.html', 'a')
+ if bool(testResult) == False and bool(testSummary) == False:
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ----PHYSIM TESTING FAILED - Unable to recover the test logs ---- \n')
+ self.htmlFile.write(' \n')
+ else:
+ # Tab header
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ---- PHYSIM TEST SUMMARY---- \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' LogFile Name \n')
+ self.htmlFile.write(' Nb Tests \n')
+ self.htmlFile.write(' Nb Failure \n')
+ self.htmlFile.write(' Nb Pass \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' physim_test.txt \n')
+ self.htmlFile.write(' ' + str(testSummary['Nbtests']) + ' \n')
+ if testSummary['Nbfail'] == 0:
+ self.htmlFile.write(' ' + str(testSummary['Nbfail']) + ' \n')
+ else:
+ self.htmlFile.write(' ' + str(testSummary['Nbfail']) + ' \n')
+ self.htmlFile.write(' ' + str(testSummary['Nbpass']) + ' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ---- PHYSIM TEST DETAIL INFO---- \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' Test Name \n')
+ self.htmlFile.write(' Test Description \n')
+ self.htmlFile.write(' Result \n')
+ self.htmlFile.write(' \n')
+ y = ''
+ for key, value in testResult.items():
+ x = key.split(".")
+ if x[0] != y:
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' "' + x[0] + '" series \n')
+ self.htmlFile.write(' \n')
+ y = x[0]
+ self.htmlFile.write(' \n')
+ self.htmlFile.write(' ' + key + ' \n')
+ self.htmlFile.write(' ' + value[0] + ' \n')
+ if 'PASS' in value:
+ self.htmlFile.write(' ' + value[1] + ' \n')
+ else:
+ self.htmlFile.write(' ' + value[1] + ' \n')
+
+ self.htmlFile.close()
diff --git a/ci-scripts/main.py b/ci-scripts/main.py
index 3094197c54..3811162f01 100644
--- a/ci-scripts/main.py
+++ b/ci-scripts/main.py
@@ -38,11 +38,13 @@ import helpreadme as HELP
import constants as CONST
-import cls_oaicitest #main class for OAI CI test framework
-import cls_physim #class PhySim for physical simulators build and test
-import cls_cots_ue #class CotsUe for Airplane mode control
-import cls_containerize #class Containerize for all container-based operations on RAN/UE objects
-
+import cls_oaicitest #main class for OAI CI test framework
+import cls_physim #class PhySim for physical simulators build and test
+import cls_cots_ue #class CotsUe for Airplane mode control
+import cls_containerize #class Containerize for all container-based operations on RAN/UE objects
+import cls_static_code_analysis #class for static code analysis
+import cls_ci_ueinfra #class defining the multi Ue infrastrucure
+import cls_physim1 #class PhySim for physical simulators deploy and run
import sshconnection
import epc
@@ -150,8 +152,14 @@ def GetParametersFromXML(action):
RAN.eNB_serverId[RAN.eNB_instance]=eNB_serverId
elif action == 'Initialize_eNB':
+ RAN.eNB_Trace=test.findtext('eNB_Trace')
RAN.Initialize_eNB_args=test.findtext('Initialize_eNB_args')
eNB_instance=test.findtext('eNB_instance')
+ USRPIPAddress=test.findtext('USRP_IPAddress')
+ if USRPIPAddress is None:
+ RAN.USRPIPAddress=''
+ else:
+ RAN.USRPIPAddress=USRPIPAddress
if (eNB_instance is None):
RAN.eNB_instance=0
else:
@@ -192,13 +200,41 @@ def GetParametersFromXML(action):
else :
RAN.air_interface[RAN.eNB_instance] = 'ocp-enb'
+ elif action == 'Initialize_UE':
+ ue_id = test.findtext('id')
+ CiTestObj.ue_trace=test.findtext('UE_Trace')#temporary variable, to be passed to Module_UE in Initialize_UE call
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
+
+ elif action == 'Detach_UE':
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
+
elif action == 'Attach_UE':
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach')
if (nbMaxUEtoAttach is None):
CiTestObj.nbMaxUEtoAttach = -1
else:
CiTestObj.nbMaxUEtoAttach = int(nbMaxUEtoAttach)
+ elif action == 'Terminate_UE':
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
+
+
elif action == 'CheckStatusUE':
expectedNBUE = test.findtext('expectedNbOfConnectedUEs')
if (expectedNBUE is None):
@@ -252,9 +288,20 @@ def GetParametersFromXML(action):
elif (action == 'Ping') or (action == 'Ping_CatM_module'):
CiTestObj.ping_args = test.findtext('ping_args')
CiTestObj.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold')
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
elif action == 'Iperf':
CiTestObj.iperf_args = test.findtext('iperf_args')
+ ue_id = test.findtext('id')
+ if (ue_id is None):
+ CiTestObj.ue_id = ""
+ else:
+ CiTestObj.ue_id = ue_id
+ CiTestObj.iperf_direction = test.findtext('direction')#used for modules only
CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold')
CiTestObj.iperf_profile = test.findtext('iperf_profile')
if (CiTestObj.iperf_profile is None):
@@ -369,6 +416,20 @@ with open(yaml_file,'r') as f:
+#loading UE infrastructure from yaml
+ue_infra_file='ci_ueinfra.yaml'
+if (os.path.isfile(ue_infra_file)):
+ yaml_file=ue_infra_file
+elif (os.path.isfile('ci-scripts/'+ue_infra_file)):
+ yaml_file='ci-scripts/'+ue_infra_file
+else:
+ logging.error("UE infrastructure yaml file cannot be found")
+ sys.exit("UE infrastructure file cannot be found")
+InfraUE=cls_ci_ueinfra.InfraUE() #initialize UE infrastructure class
+InfraUE.Get_UE_Infra(yaml_file) #read the UE infra, filename is hardcoded and unique for the moment but should be passed as parameter from the test suite
+
+
+
mode = ''
CiTestObj = cls_oaicitest.OaiCiTest()
@@ -378,17 +439,18 @@ EPC = epc.EPCManagement()
RAN = ran.RANManagement()
HTML = html.HTMLManagement()
CONTAINERS = cls_containerize.Containerize()
+SCA = cls_static_code_analysis.StaticCodeAnalysis()
+PHYSIM = cls_physim1.PhySim()
ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build
-
#-----------------------------------------------------------
# Parsing Command Line Arguments
#-----------------------------------------------------------
import args_parse
-py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP)
+py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM)
@@ -426,13 +488,13 @@ elif re.match('^TerminateUE$', mode, re.IGNORECASE):
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
signal.signal(signal.SIGUSR1, receive_signal)
- CiTestObj.TerminateUE(HTML,COTS_UE)
+ CiTestObj.TerminateUE(HTML,COTS_UE,InfraUE,CiTestObj.ue_trace)
elif re.match('^TerminateOAIUE$', mode, re.IGNORECASE):
if CiTestObj.UEIPAddress == '' or CiTestObj.UEUserName == '' or CiTestObj.UEPassword == '':
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
signal.signal(signal.SIGUSR1, receive_signal)
- CiTestObj.TerminateOAIUE(HTML,RAN,COTS_UE,EPC)
+ CiTestObj.TerminateOAIUE(HTML,RAN,COTS_UE,EPC,InfraUE)
elif re.match('^TerminateHSS$', mode, re.IGNORECASE):
if EPC.IPAddress == '' or EPC.UserName == '' or EPC.Password == '' or EPC.Type == '' or EPC.SourceCodePath == '':
HELP.GenericHelp(CONST.Version)
@@ -602,6 +664,7 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
if (EPC.IPAddress != '') and (EPC.IPAddress != 'none'):
CiTestObj.CheckFlexranCtrlInstallation(RAN,EPC,CONTAINERS)
EPC.SetMmeIPAddress()
+ EPC.SetAmfIPAddress()
#get the list of tests to be done
todo_tests=[]
@@ -671,39 +734,39 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
elif action == 'Terminate_eNB':
RAN.TerminateeNB(HTML, EPC)
elif action == 'Initialize_UE':
- CiTestObj.InitializeUE(HTML,COTS_UE)
+ CiTestObj.InitializeUE(HTML,RAN, EPC, COTS_UE, InfraUE, CiTestObj.ue_trace)
elif action == 'Terminate_UE':
- CiTestObj.TerminateUE(HTML,COTS_UE)
+ CiTestObj.TerminateUE(HTML,COTS_UE, InfraUE, CiTestObj.ue_trace)
elif action == 'Attach_UE':
- CiTestObj.AttachUE(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.AttachUE(HTML,RAN,EPC,COTS_UE,InfraUE)
elif action == 'Detach_UE':
- CiTestObj.DetachUE(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.DetachUE(HTML,RAN,EPC,COTS_UE,InfraUE)
elif action == 'DataDisable_UE':
CiTestObj.DataDisableUE(HTML)
elif action == 'DataEnable_UE':
CiTestObj.DataEnableUE(HTML)
elif action == 'CheckStatusUE':
- CiTestObj.CheckStatusUE(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.CheckStatusUE(HTML,RAN,EPC,COTS_UE,InfraUE)
elif action == 'Build_OAI_UE':
CiTestObj.BuildOAIUE(HTML)
elif action == 'Initialize_OAI_UE':
- CiTestObj.InitializeOAIUE(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.InitializeOAIUE(HTML,RAN,EPC,COTS_UE,InfraUE)
elif action == 'Terminate_OAI_UE':
- CiTestObj.TerminateOAIUE(HTML,RAN,COTS_UE,EPC)
+ CiTestObj.TerminateOAIUE(HTML,RAN,COTS_UE,EPC,InfraUE)
elif action == 'Initialize_CatM_module':
CiTestObj.InitializeCatM(HTML)
elif action == 'Terminate_CatM_module':
CiTestObj.TerminateCatM(HTML)
elif action == 'Attach_CatM_module':
- CiTestObj.AttachCatM(HTML,RAN,COTS_UE,EPC)
+ CiTestObj.AttachCatM(HTML,RAN,COTS_UE,EPC,InfraUE)
elif action == 'Detach_CatM_module':
CiTestObj.TerminateCatM(HTML)
elif action == 'Ping_CatM_module':
- CiTestObj.PingCatM(HTML,RAN,EPC,COTS_UE,EPC)
+ CiTestObj.PingCatM(HTML,RAN,EPC,COTS_UE,EPC,InfraUE)
elif action == 'Ping':
- CiTestObj.Ping(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.Ping(HTML,RAN,EPC,COTS_UE, InfraUE)
elif action == 'Iperf':
- CiTestObj.Iperf(HTML,RAN,EPC,COTS_UE)
+ CiTestObj.Iperf(HTML,RAN,EPC,COTS_UE, InfraUE)
elif action == 'Reboot_UE':
CiTestObj.RebootUE(HTML,RAN,EPC)
elif action == 'Initialize_HSS':
@@ -718,6 +781,10 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
EPC.InitializeSPGW(HTML)
elif action == 'Terminate_SPGW':
EPC.TerminateSPGW(HTML)
+ elif action == 'Initialize_5GCN':
+ EPC.Initialize5GCN(HTML)
+ elif action == 'Terminate_5GCN':
+ EPC.Terminate5GCN(HTML)
elif action == 'Deploy_EPC':
EPC.DeployEpc(HTML)
elif action == 'Undeploy_EPC':
@@ -741,6 +808,10 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
CONTAINERS.DeployObject(HTML, EPC)
elif action == 'Undeploy_Object':
CONTAINERS.UndeployObject(HTML, RAN)
+ elif action == 'Cppcheck_Analysis':
+ SCA.CppCheckAnalysis(HTML)
+ elif action == 'Deploy_Run_PhySim':
+ PHYSIM.Deploy_PhySim(HTML, RAN)
else:
sys.exit('Invalid class (action) from xml')
if not RAN.prematureExit:
diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool
index d8f088b707..5ee653c8e1 100755
--- a/ci-scripts/oai-ci-vm-tool
+++ b/ci-scripts/oai-ci-vm-tool
@@ -170,20 +170,20 @@ function setvar_usage {
# for compatibility reasons
function variant__v1__enb_usrp {
- NB_PATTERN_FILES=9
+ NB_PATTERN_FILES=7
BUILD_OPTIONS="--eNB -w USRP --mu"
VM_MEMORY=3072
}
function variant__v2__basic_sim {
- NB_PATTERN_FILES=13
+ NB_PATTERN_FILES=11
BUILD_OPTIONS="--eNB --UE"
VM_MEMORY=8192
RUN_OPTIONS="complex"
}
function variant__v3__phy_sim {
- NB_PATTERN_FILES=13
+ NB_PATTERN_FILES=11
BUILD_OPTIONS="--phy_simulators"
VM_MEMORY=8192
VM_DISK=20
@@ -200,28 +200,28 @@ function variant__v4__cppcheck {
function variant__v5__gnb_usrp {
VM_MEMORY=10240
VM_CPU=8
- NB_PATTERN_FILES=9
+ NB_PATTERN_FILES=7
BUILD_OPTIONS="--gNB -w USRP"
}
function variant__v6__nr_ue_usrp {
VM_MEMORY=4096
VM_CPU=4
- NB_PATTERN_FILES=9
+ NB_PATTERN_FILES=7
BUILD_OPTIONS="--nrUE -w USRP"
}
function variant__v7__enb_ethernet {
VM_MEMORY=4096
ARCHIVES_LOC=enb_eth
- NB_PATTERN_FILES=9
+ NB_PATTERN_FILES=7
BUILD_OPTIONS="--eNB -w USRP"
}
function variant__v8__ue_ethernet {
VM_MEMORY=4096
ARCHIVES_LOC=ue_eth
- NB_PATTERN_FILES=13
+ NB_PATTERN_FILES=11
BUILD_OPTIONS="--UE -w USRP"
}
@@ -247,6 +247,11 @@ function variant__v22__l2_sim {
RUN_OPTIONS="complex"
}
+function variant__v23__rf5g_sim {
+ ARCHIVES_LOC=rf5g_sim
+ RUN_OPTIONS="complex"
+}
+
# Following function lists all variant__v__ functions
# and set the VARIANTS_SHORT and VARIANTS_LONG arrays from
# the function names
diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py
index 774d7f19c6..5e3d8e388f 100644
--- a/ci-scripts/ran.py
+++ b/ci-scripts/ran.py
@@ -37,6 +37,8 @@ import logging
import os
import time
from multiprocessing import Process, Lock, SimpleQueue
+import yaml
+
#-----------------------------------------------------------
# OAI Testing modules
@@ -90,6 +92,9 @@ class RANManagement():
self.testCase_id = ''
self.epcPcapFile = ''
self.runtime_stats= ''
+ self.datalog_rt_stats={}
+ self.eNB_Trace = '' #if 'yes', Tshark will be launched at initialization
+ self.USRPIPAddress = ''
@@ -127,12 +132,16 @@ class RANManagement():
result = re.search('--eNBocp', self.Build_eNB_args)
if result is not None:
self.air_interface[self.eNB_instance] = 'ocp-enb'
- else:
- result = re.search('--gNB', self.Build_eNB_args)
+ else:
+ result = re.search('--RU', self.Build_eNB_args)
if result is not None:
- self.air_interface[self.eNB_instance] = 'nr-softmodem'
+ self.air_interface[self.eNB_instance] = 'oairu'
else:
- self.air_interface[self.eNB_instance] = 'lte-softmodem'
+ result = re.search('--gNB', self.Build_eNB_args)
+ if result is not None:
+ self.air_interface[self.eNB_instance] = 'nr-softmodem'
+ else:
+ self.air_interface[self.eNB_instance] = 'lte-softmodem'
# Worakround for some servers, we need to erase completely the workspace
if self.Build_eNB_forced_workspace_cleanup:
@@ -141,7 +150,7 @@ class RANManagement():
# on RedHat/CentOS .git extension is mandatory
result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository)
if result is not None:
- full_ran_repo_name = self.ranRepository
+ full_ran_repo_name = self.ranRepository.replace('git/', 'git')
else:
full_ran_repo_name = self.ranRepository + '.git'
mySSH.command('mkdir -p ' + lSourcePath, '\$', 5)
@@ -184,7 +193,7 @@ class RANManagement():
mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30)
# if the commit ID is provided use it to point to it
if self.ranCommitID != '':
- mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5)
+ mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30)
# if the branch is not develop, then it is a merge request and we need to do
# the potential merge. Note that merge conflicts should already been checked earlier
if (self.ranAllowMerge):
@@ -293,7 +302,7 @@ class RANManagement():
mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
mySSH.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5)
#-qq quiet / -u update orcreate files
- mySSH.command('unzip -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5)
+ mySSH.command('unzip -o -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5)
mySSH.command('rm -f tmp_build' + testcaseId + '.zip', '\$', 5)
mySSH.close()
else:
@@ -333,10 +342,41 @@ class RANManagement():
self.testCase_id = HTML.testCase_id
mySSH = SSH.SSHConnection()
+ #reboot USRP if requested in xml
+ if self.USRPIPAddress!='':
+ logging.debug('USRP '+ self.USRPIPAddress +'reboot request')
+ mySSH.open(lIpAddr, lUserName, lPassWord)
+ cmd2usrp='ssh root@'+self.USRPIPAddress+' reboot'
+ mySSH.command2(cmd2usrp,1)
+ mySSH.close()
+ logging.debug('Waiting for USRP to be ready')
+ time.sleep(120)
+
+
if (self.pStatus < 0):
HTML.CreateHtmlTestRow(self.air_interface[self.eNB_instance] + ' ' + self.Initialize_eNB_args, 'KO', self.pStatus)
HTML.CreateHtmlTabFooter(False)
sys.exit(1)
+
+ #Get pcap on enb and/or gnb if enabled in the xml
+ if self.eNB_Trace=='yes':
+ if ((self.air_interface[self.eNB_instance] == 'lte-softmodem') or (self.air_interface[self.eNB_instance] == 'ocp-enb')):
+ pcapfile_prefix="enb_"
+ else:
+ pcapfile_prefix="gnb_"
+ mySSH.open(lIpAddr, lUserName, lPassWord)
+ mySSH.command('ip addr show | awk -f /tmp/active_net_interfaces.awk | egrep -v "lo|tun"', '\$', 5)
+ result = re.search('interfaceToUse=(?P[a-zA-Z0-9\-\_]+)done', mySSH.getBefore())
+ if result is not None:
+ eth_interface = result.group('eth_interface')
+ logging.debug('\u001B[1m Launching tshark on interface ' + eth_interface + '\u001B[0m')
+ pcapfile = pcapfile_prefix + self.testCase_id + '_log.pcap'
+ mySSH.command('echo ' + lPassWord + ' | sudo -S rm -f /tmp/' + pcapfile , '\$', 5)
+ mySSH.command('echo $USER; nohup sudo -E tshark -i ' + eth_interface + ' -w /tmp/' + pcapfile + ' 2>&1 &','\$', 5)
+ mySSH.close()
+
+
+
# If tracer options is on, running tshark on EPC side and capture traffic b/ EPC and eNB
result = re.search('T_stdout', str(self.Initialize_eNB_args))
if (result is not None):
@@ -381,13 +421,13 @@ class RANManagement():
# do not reset board twice in IF4.5 case
result = re.search('^rru|^enb|^du.band', str(config_file))
if result is not None:
- mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 60)
+ mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 90)
result = re.search('type: b200', mySSH.getBefore())
if result is not None:
logging.debug('Found a B2xx device --> resetting it')
mySSH.command('echo ' + lPassWord + ' | sudo -S b2xx_fx3_utils --reset-device', '\$', 10)
# Reloading FGPA bin firmware
- mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 60)
+ mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 90)
# Make a copy and adapt to EPC / eNB IP addresses
mySSH.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5)
localMmeIpAddr = EPC.MmeIPAddress
@@ -464,7 +504,7 @@ class RANManagement():
self.prematureExit = True
return
else:
- mySSH.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Starting"', '\$', 4)
+ mySSH.command('stdbuf -o0 cat enb_' + self.testCase_id + '.log | egrep --text --color=never -i "wait|sync|Starting|Started"', '\$', 4)
if rruCheck:
result = re.search('wait RUs', mySSH.getBefore())
else:
@@ -572,6 +612,10 @@ class RANManagement():
mySSH.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGKILL -r .*-softmodem ocp-enb || true', '\$', 5)
time.sleep(5)
mySSH.command('rm -f my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
+ #stopping tshark (valid if eNB and enabled in xml, will not harm otherwise)
+ logging.debug('\u001B[1m Stopping tshark \u001B[0m')
+ mySSH.command('echo ' + lPassWord + ' | sudo -S killall --signal SIGKILL tshark', '\$', 5)
+ time.sleep(1)
mySSH.close()
# If tracer options is on, stopping tshark on EPC side
result = re.search('T_stdout', str(self.Initialize_eNB_args))
@@ -590,6 +634,7 @@ class RANManagement():
mySSH.close()
logging.debug('\u001B[1m Replaying RAW record file\u001B[0m')
mySSH.open(lIpAddr, lUserName, lPassWord)
+ mySSH.command('killall --signal SIGKILL record', '\$', 5)
mySSH.command('cd ' + lSourcePath + '/common/utils/T/tracer/', '\$', 5)
enbLogFile = self.eNBLogFiles[int(self.eNB_instance)]
raw_record_file = enbLogFile.replace('.log', '_record.raw')
@@ -632,6 +677,9 @@ class RANManagement():
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
else:
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
+ #display rt stats for gNB only
+ if len(self.datalog_rt_stats)!=0 and nodeB_prefix == 'g':
+ HTML.CreateHtmlDataLogTable(self.datalog_rt_stats)
self.eNBmbmsEnables[int(self.eNB_instance)] = False
self.eNBstatuses[int(self.eNB_instance)] = -1
@@ -640,9 +688,11 @@ class RANManagement():
mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword)
mySSH.command('cd ' + self.eNBSourceCodePath, '\$', 5)
mySSH.command('cd cmake_targets', '\$', 5)
+ mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/enb_*.pcap .','\$',20)
+ mySSH.command('echo ' + self.eNBPassword + ' | sudo -S mv /tmp/gnb_*.pcap .','\$',20)
mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm -f enb.log.zip', '\$', 5)
- mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap enb_*txt physim_*.log', '\$', 60)
- mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap enb_*txt', '\$', 5)
+ mySSH.command('echo ' + self.eNBPassword + ' | sudo -S zip enb.log.zip enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 60)
+ mySSH.command('echo ' + self.eNBPassword + ' | sudo -S rm enb*.log core* enb_*record.raw enb_*.pcap gnb_*.pcap enb_*txt physim_*.log *stats.log', '\$', 5)
mySSH.close()
def AnalyzeLogFile_eNB(self, eNBlogFile, HTML):
@@ -693,12 +743,32 @@ class RANManagement():
NSA_RAPROC_PUSCH_check = 0
#dlsch and ulsch statistics (dictionary)
dlsch_ulsch_stats = {}
- #count "L1 thread not ready" msg
- L1_thread_not_ready_cnt = 0
+ #real time statistics (dictionary)
+ real_time_stats = {}
#count "problem receiving samples" msg
pb_receiving_samples_cnt = 0
+ #count "removing UE" msg
+ removing_ue = 0
+ #NSA specific log markers
+ nsa_markers ={'SgNBReleaseRequestAcknowledge': [],'FAILURE': [], 'scgFailureInformationNR-r15': [], 'SgNBReleaseRequest': []}
+ #the datalog config file has to be loaded
+ datalog_rt_stats_file='datalog_rt_stats.yaml'
+ if (os.path.isfile(datalog_rt_stats_file)):
+ yaml_file=datalog_rt_stats_file
+ elif (os.path.isfile('ci-scripts/'+datalog_rt_stats_file)):
+ yaml_file='ci-scripts/'+datalog_rt_stats_file
+ else:
+ logging.error("Datalog RT stats yaml file cannot be found")
+ sys.exit("Datalog RT stats yaml file cannot be found")
+
+ with open(yaml_file,'r') as f:
+ datalog_rt_stats = yaml.load(f,Loader=yaml.FullLoader)
+ rt_keys = datalog_rt_stats['Ref'] #we use the keys from the Ref field
+
+ line_cnt=0 #log file line counter
for line in enb_log_file.readlines():
+ line_cnt+=1
# Runtime statistics
result = re.search('Run time:' ,str(line))
if result is not None:
@@ -856,20 +926,36 @@ class RANManagement():
#keys below are the markers we are loooking for, loop over this keys list
#everytime these markers are found in the log file, the previous ones are overwritten in the dict
#eventually we record and print only the last occurence
- keys = {'dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled'}
+ keys = {'UE ID','dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled'}
for k in keys:
result = re.search(k, line)
if result is not None:
#remove 1- all useless char before relevant info (ulsch or dlsch) 2- trailing char
dlsch_ulsch_stats[k]=re.sub(r'^.*\]\s+', r'' , line.rstrip())
- #count "L1 thread not ready" msg
- result = re.search('\[PHY\]\s+L1_thread isn\'t ready', str(line))
- if result is not None:
- L1_thread_not_ready_cnt += 1
+ #real time statistics for gNB
+ for k in rt_keys:
+ result = re.search(k, line)
+ if result is not None:
+ #remove 1- all useless char before relevant info 2- trailing char
+ line=line.replace('[0m','')
+ tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex
+ if tmp!=None: #with ULULULUULULULLLL at the head of the line, we skip it
+ real_time_stats[k]=tmp.group(1)
+
#count "problem receiving samples" msg
result = re.search('\[PHY\]\s+problem receiving samples', str(line))
if result is not None:
- pb_receiving_samples_cnt += 1
+ pb_receiving_samples_cnt += 1
+ #count "Removing UE" msg
+ result = re.search('\[MAC\]\s+Removing UE', str(line))
+ if result is not None:
+ removing_ue += 1
+
+ #nsa markers logging
+ for k in nsa_markers:
+ result = re.search(k, line)
+ if result is not None:
+ nsa_markers[k].append(line_cnt)
enb_log_file.close()
logging.debug(' File analysis completed')
@@ -878,7 +964,7 @@ class RANManagement():
else:
nodeB_prefix = 'g'
- if self.air_interface[self.eNB_instance] == 'nr-softmodem':
+ if nodeB_prefix == 'g':
if ulschReceiveOK > 0:
statMsg = nodeB_prefix + 'NB showed ' + str(ulschReceiveOK) + ' "ULSCH received ok" message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
@@ -896,20 +982,31 @@ class RANManagement():
statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : PASS '
htmlMsg = statMsg+'\n'
else:
- statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL '
+ statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL or not relevant'
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
- #L1 thread not ready log
- statMsg = '[PHY] L1 thread is not ready msg count = '+str(L1_thread_not_ready_cnt)
- htmlMsg = statMsg+'\n'
- logging.debug(statMsg)
- htmleNBFailureMsg += htmlMsg
#problem receiving samples log
statMsg = '[PHY] problem receiving samples msg count = '+str(pb_receiving_samples_cnt)
htmlMsg = statMsg+'\n'
logging.debug(statMsg)
htmleNBFailureMsg += htmlMsg
+ #nsa markers
+ statMsg = 'logfile line count = ' + str(line_cnt)
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ if len(nsa_markers['SgNBReleaseRequestAcknowledge'])!=0:
+ statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(nsa_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences , starting line ' + str(nsa_markers['SgNBReleaseRequestAcknowledge'][0])
+ else:
+ statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(nsa_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ statMsg = 'FAILURE = ' + str(len(nsa_markers['FAILURE'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
#ulsch and dlsch statistics
if len(dlsch_ulsch_stats)!=0: #check if dictionary is not empty
@@ -919,6 +1016,52 @@ class RANManagement():
logging.debug(dlsch_ulsch_stats[key])
htmleNBFailureMsg += statMsg
+ #real time statistics
+ datalog_rt_stats['Data']={}
+ if len(real_time_stats)!=0: #check if dictionary is not empty
+ for k in real_time_stats:
+ tmp=re.match(r'^(?P.*):\s+(?P\d+\.\d+) us;\s+\d+;\s+(?P\d+\.\d+) us;',real_time_stats[k])
+ if tmp is not None:
+ metric=tmp.group('metric')
+ avg=float(tmp.group('avg'))
+ max=float(tmp.group('max'))
+ datalog_rt_stats['Data'][metric]=["{:.0f}".format(avg),"{:.0f}".format(max),"{:.2f}".format(avg/datalog_rt_stats['Ref'][metric])]
+ #once all metrics are collected, store the data as a class attribute to build a dedicated HTML table afterward
+ self.datalog_rt_stats=datalog_rt_stats
+ #check if there is a fail => will render the test as failed
+ for k in datalog_rt_stats['Data']:
+ if float(datalog_rt_stats['Data'][k][2])> datalog_rt_stats['Threshold'][k]: #condition for fail : avg/ref is greater than the fixed threshold
+ #setting prematureExit is ok although not the best option
+ self.prematureExit=True
+ else:
+ statMsg = 'No real time stats found in the log file\n'
+ logging.debug('No real time stats found in the log file')
+ htmleNBFailureMsg += statMsg
+
+ else:
+ #Removing UE log
+ statMsg = '[MAC] Removing UE msg count = '+str(removing_ue)
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ #nsa markers
+ statMsg = 'logfile line count = ' + str(line_cnt)
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ if len(nsa_markers['SgNBReleaseRequest'])!=0:
+ statMsg = 'SgNBReleaseRequest = ' + str(len(nsa_markers['SgNBReleaseRequest'])) + ' occurences , starting line ' + str(nsa_markers['SgNBReleaseRequest'][0])
+ else:
+ statMsg = 'SgNBReleaseRequest = ' + str(len(nsa_markers['SgNBReleaseRequest'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+ statMsg = 'scgFailureInformationNR-r15 = ' + str(len(nsa_markers['scgFailureInformationNR-r15'])) + ' occurences'
+ htmlMsg = statMsg+'\n'
+ logging.debug(statMsg)
+ htmleNBFailureMsg += htmlMsg
+
+
if uciStatMsgCount > 0:
statMsg = nodeB_prefix + 'NB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)'
logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m')
diff --git a/ci-scripts/ran_dashboard.py b/ci-scripts/ran_dashboard.py
new file mode 100644
index 0000000000..4f18638e68
--- /dev/null
+++ b/ci-scripts/ran_dashboard.py
@@ -0,0 +1,299 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+# Merge Requests Dashboard for RAN on googleSheet
+#
+# Required Python Version
+# Python 3.x
+#
+#---------------------------------------------------------------------
+
+#-----------------------------------------------------------
+# Import
+#-----------------------------------------------------------
+
+#import google spreadsheet API
+import gspread
+from oauth2client.service_account import ServiceAccountCredentials
+
+
+import subprocess
+import shlex #lexical analysis
+import json #json structures
+import datetime #now() and date formating
+from datetime import datetime
+import re
+import gitlab
+
+#-----------------------------------------------------------
+# Class Declaration
+#-----------------------------------------------------------
+
+class gDashboard:
+ def __init__(self, creds_file, spreadsheet, worksheet): #"creds.json", 'OAI RAN Dashboard', 'MR Status'
+ self.scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]
+ self.creds = ServiceAccountCredentials.from_json_keyfile_name(creds_file, self.scope)
+ self.client = gspread.authorize(self.creds)
+ #spreadsheet
+ self.ss = self.client.open(spreadsheet)
+ #worksheet
+ self.sheet = self.ss.worksheet(worksheet)
+ self.ss.del_worksheet(self.sheet) #start by deleting the old sheet
+ self.sheet = self.ss.add_worksheet(title=worksheet, rows="100", cols="20") #create a new one
+
+ self.d = {} #data dictionary
+
+
+ def fetchData(self,cmd):
+ #cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """
+ process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
+ output = process.stdout.readline()
+ tmp=output.decode("utf-8")
+ self.d = json.loads(tmp)
+
+
+ def gBuild(self, destinationSheetName):
+
+ #line 1 : update date/time, format dd/mm/YY H:M:S
+ now = datetime.now()
+ dt_string = "Update : " + now.strftime("%d/%m/%Y %H:%M")
+ row =[dt_string]
+ self.sheet.insert_row(row, index=1, value_input_option='RAW')
+
+ #line 2 empty
+ #line 3 is for the column names
+ i=3
+ row =["MR","Created_at","Author","Title","Assignee", "Reviewer", "CAN START","IN PROGRESS","COMPLETED","Review Form","OK MERGE","Merge conflicts"]
+ self.sheet.insert_row(row, index=i, value_input_option='RAW')
+
+ #line 4 onward, MR data lines
+ for x in range(len(self.d)):
+ i=i+1
+ date_time_str = self.d[x]['created_at']
+ date_time_obj = datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ')
+
+ milestone1=milestone2=milestone3=milestone4=""
+ if self.d[x]['milestone']!=None:
+ if self.d[x]['milestone']['title']=="REVIEW_CAN_START":
+ milestone1="X"
+ elif self.d[x]['milestone']['title']=="REVIEW_IN_PROGRESS":
+ milestone2="X"
+ elif self.d[x]['milestone']['title']=="REVIEW_COMPLETED_AND_APPROVED":
+ milestone3="X"
+ elif self.d[x]['milestone']['title']=="OK_TO_BE_MERGED":
+ milestone4="X"
+ else:
+ pass
+ else:
+ pass
+
+ #check if empty or not
+ if self.d[x]['assignee']!=None:
+ assignee = str(self.d[x]['assignee']['name'])
+ else:
+ assignee = ""
+
+ #check if empty or not
+ if len(self.d[x]['reviewers'])!=0:
+ reviewer = str(self.d[x]['reviewers'][0]['name'])
+ else:
+ reviewer = ""
+
+ if self.d[x]['has_conflicts']==True:
+ conflicts = "YES"
+ else:
+ conflicts = ""
+
+
+ #add a column flagging that the review form is present
+ #we use gitlab API to parse the MR notes
+ gl = gitlab.Gitlab.from_config('OAI')
+ project_id = 223
+ project = gl.projects.get(project_id)
+ #get the opened MR in the project
+ mrs = project.mergerequests.list(state='opened')
+ for m in range (0,len(mrs)):
+ if mrs[m].iid==self.d[x]['iid']:#check the iid is the one we are on
+ mr_notes = mrs[m].notes.list(all=True)
+ n=0
+ found=False
+ review_form=""
+ while found==False and nUbuntu 16.04 LTS -- Summary" >> ./build_results.html
- sca_summary_table_header ./archives/cppcheck/cppcheck.xml "OAI Static Code Analysis with CPPCHECK"
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds
- sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder
- sca_summary_table_footer ./archives/cppcheck/cppcheck.xml
-
-# summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_usrp
-# summary_table_row "LTE SoftModem - Release 15" ./archives/enb_usrp/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_usrp_row1.html
-# summary_table_row "Coding - Release 15" ./archives/enb_usrp/coding.Rel15.txt "Built target coding" ./enb_usrp_row2.html
-# summary_table_row "OAI USRP device if - Release 15" ./archives/enb_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_usrp_row3.html
-# summary_table_row "OAI ETHERNET transport - Release 15" ./archives/enb_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./enb_usrp_row4.html
-# summary_table_row "Parameters Lib Config - Release 15" ./archives/enb_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./enb_usrp_row5.html
-# summary_table_row "NASMESH - Release 15" ./archives/enb_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./enb_usrp_row6.html
-# summary_table_row "RB Tool - Release 15" ./archives/enb_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./enb_usrp_row7.html
-# summary_table_row "RF Simulator - Release 15" ./archives/enb_usrp/rfsimulator.Rel15.txt "Built target rfsimulator" ./enb_usrp_row8.html
-# summary_table_row "TCP Bridge - Release 15" ./archives/enb_usrp/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_usrp_row9.html
-# summary_table_footer
-#
summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_eth
summary_table_row "LTE SoftModem - Release 15" ./archives/enb_eth/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_eth_row1.html
summary_table_row "Coding - Release 15" ./archives/enb_eth/coding.Rel15.txt "Built target coding" ./enb_eth_row2.html
@@ -600,8 +576,6 @@ function report_build {
summary_table_row "RF Simulator - Release 15" ./archives/enb_eth/rfsimulator.Rel15.txt "Built target rfsimulator" ./enb_eth_row5.html
summary_table_row "TCP OAI Bridge - Release 15" ./archives/enb_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_eth_row6.html
summary_table_row "OAI USRP device if - Release 15" ./archives/enb_eth/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_eth_row7.html
- summary_table_row "NASMESH - Release 15" ./archives/enb_eth/nasmesh.Rel15.txt "Built target nasmesh" ./enb_eth_row8.html
- summary_table_row "RB Tool - Release 15" ./archives/enb_eth/rb_tool.Rel15.txt "Built target rb_tool" ./enb_eth_row9.html
summary_table_footer
summary_table_header "OAI Build: 4G LTE UE -- USRP option" ./archives/ue_eth
@@ -624,9 +598,7 @@ function report_build {
summary_table_row "Coding - Release 15" ./archives/basic_sim/coding.Rel15.txt "Built target coding" ./basic_sim_row3.html
summary_table_row "Conf 2 UE data - Release 15" ./archives/basic_sim/conf2uedata.Rel15.txt "Built target conf2uedata" ./basic_sim_row4.html
summary_table_row "OAI ETHERNET transport - Release 15" ./archives/basic_sim/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./basic_sim_row5.html
- summary_table_row "NASMESH - Release 15" ./archives/basic_sim/nasmesh.Rel15.txt "Built target nasmesh" ./basic_sim_row6.html
summary_table_row "Parameters Lib Config - Release 15" ./archives/basic_sim/params_libconfig.Rel15.txt "Built target params_libconfig" ./basic_sim_row7.html
- summary_table_row "RB Tool - Release 15" ./archives/basic_sim/rb_tool.Rel15.txt "Built target rb_tool" ./basic_sim_row8.html
summary_table_row "RF Simulator - Release 15" ./archives/basic_sim/rfsimulator.Rel15.txt "Built target rfsimulator" ./basic_sim_row9.html
summary_table_row "TCP Bridge - Release 15" ./archives/basic_sim/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./basic_sim_row10.html
summary_table_row "UE IP - Release 15" ./archives/basic_sim/ue_ip.Rel15.txt "Built target ue_ip" ./basic_sim_row11.html
@@ -634,48 +606,6 @@ function report_build {
summary_table_row "NVRAM - Release 15" ./archives/basic_sim/nvram.Rel15.txt "Built target nvram" ./basic_sim_row13.html
summary_table_footer
- summary_table_header "OAI Build: 4G LTE / 5G NR Physical simulators option" ./archives/phy_sim
- summary_table_row "LTE DL Simulator - Release 15" ./archives/phy_sim/dlsim.Rel15.txt "Built target dlsim" ./phy_sim_row1.html
- summary_table_row "LTE UL Simulator - Release 15" ./archives/phy_sim/ulsim.Rel15.txt "Built target ulsim" ./phy_sim_row2.html
- summary_table_row "Coding - Release 15" ./archives/phy_sim/coding.Rel15.txt "Built target coding" ./phy_sim_row3.html
- if [ -f ./archives/phy_sim/ldpctest.Rel15.txt ]
- then
- summary_table_row "NR LDPC Test - Release 15" ./archives/phy_sim/ldpctest.Rel15.txt "Built target ldpctest" ./phy_sim_row4.html
- fi
- if [ -f ./archives/phy_sim/polartest.Rel15.txt ]
- then
- summary_table_row "NR Polar Test - Release 15" ./archives/phy_sim/polartest.Rel15.txt "Built target polartest" ./phy_sim_row5.html
- fi
- if [ -f ./archives/phy_sim/nr_pbchsim.Rel15.txt ]
- then
- summary_table_row "NR PBCH Test - Release 15" ./archives/phy_sim/nr_pbchsim.Rel15.txt "Built target nr_pbchsim" ./phy_sim_row6.html
- fi
- if [ -f ./archives/phy_sim/nr_dlschsim.Rel15.txt ]
- then
- summary_table_row "NR DLSCH Test - Release 15" ./archives/phy_sim/nr_dlschsim.Rel15.txt "Built target nr_dlschsim" ./phy_sim_row7.html
- fi
- if [ -f ./archives/phy_sim/nr_pucchsim.Rel15.txt ]
- then
- summary_table_row "NR PUCCH Test - Release 15" ./archives/phy_sim/nr_pucchsim.Rel15.txt "Built target nr_pucchsim" ./phy_sim_row8.html
- fi
- if [ -f ./archives/phy_sim/smallblocktest.Rel15.txt ]
- then
- summary_table_row "NR Small Block Test - Release 15" ./archives/phy_sim/smallblocktest.Rel15.txt "Built target smallblocktest" ./phy_sim_row9.html
- fi
- if [ -f ./archives/phy_sim/nr_dlsim.Rel15.txt ]
- then
- summary_table_row "NR DL Sim Test - Release 15" ./archives/phy_sim/nr_dlsim.Rel15.txt "Built target nr_dlsim" ./phy_sim_row10.html
- fi
- if [ -f ./archives/phy_sim/nr_ulschsim.Rel15.txt ]
- then
- summary_table_row "NR ULSCH Test - Release 15" ./archives/phy_sim/nr_ulschsim.Rel15.txt "Built target nr_ulschsim" ./phy_sim_row11.html
- fi
- if [ -f ./archives/phy_sim/nr_ulsim.Rel15.txt ]
- then
- summary_table_row "NR UL Sim Test - Release 15" ./archives/phy_sim/nr_ulsim.Rel15.txt "Built target nr_ulsim" ./phy_sim_row12.html
- fi
- summary_table_footer
-
if [ -f archives/gnb_usrp/nr-softmodem.Rel15.txt ]
then
summary_table_header "OAI Build: 5G NR gNB -- USRP option" ./archives/gnb_usrp
@@ -683,9 +613,7 @@ function report_build {
summary_table_row "Coding - Release 15" ./archives/gnb_usrp/coding.Rel15.txt "Built target coding" ./gnb_usrp_row2.html
summary_table_row "OAI USRP device if - Release 15" ./archives/gnb_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./gnb_usrp_row3.html
summary_table_row "OAI ETHERNET transport - Release 15" ./archives/gnb_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./gnb_usrp_row4.html
- summary_table_row "NASMESH - Release 15" ./archives/gnb_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./gnb_usrp_row5.html
summary_table_row "Parameters Lib Config - Release 15" ./archives/gnb_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./gnb_usrp_row6.html
- summary_table_row "RB Tool - Release 15" ./archives/gnb_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./gnb_usrp_row7.html
summary_table_footer
fi
@@ -696,9 +624,7 @@ function report_build {
summary_table_row "Coding - Release 15" ./archives/nr_ue_usrp/coding.Rel15.txt "Built target coding" ./nr_ue_usrp_row2.html
summary_table_row "OAI USRP device if - Release 15" ./archives/nr_ue_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./nr_ue_usrp_row3.html
summary_table_row "OAI ETHERNET transport - Release 15" ./archives/nr_ue_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./nr_ue_usrp_row4.html
- summary_table_row "NASMESH - Release 15" ./archives/nr_ue_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./nr_ue_usrp_row5.html
summary_table_row "Parameters Lib Config - Release 15" ./archives/nr_ue_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./nr_ue_usrp_row6.html
- summary_table_row "RB Tool - Release 15" ./archives/nr_ue_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./nr_ue_usrp_row7.html
summary_table_footer
fi
@@ -718,14 +644,7 @@ function report_build {
echo " Details for Compilation Errors and Warnings " >> ./build_results.html
echo " " >> ./build_results.html
-# if [ -f ./enb_usrp_row1.html ] || [ -f ./enb_usrp_row2.html ] || [ -f ./enb_usrp_row3.html ] || [ -f ./enb_usrp_row4.html ]
-# then
-# for DETAILS_TABLE in `ls ./enb_usrp_row*.html`
-# do
-# cat $DETAILS_TABLE >> ./build_results.html
-# done
-# fi
- if [ -f ./enb_eth_row1.html ] || [ -f ./enb_eth_row2.html ] || [ -f ./enb_eth_row3.html ] || [ -f ./enb_eth_row4.html ] || [ -f ./enb_eth_row5.html ] || [ -f ./enb_eth_row6.html ] || [ -f ./enb_eth_row7.html ] || [ -f ./enb_eth_row8.html ] || [ -f ./enb_eth_row9.html ]
+ if [ -f ./enb_eth_row1.html ] || [ -f ./enb_eth_row2.html ] || [ -f ./enb_eth_row3.html ] || [ -f ./enb_eth_row4.html ] || [ -f ./enb_eth_row5.html ] || [ -f ./enb_eth_row6.html ] || [ -f ./enb_eth_row7.html ]
then
for DETAILS_TABLE in `ls ./enb_eth_row*.html`
do
@@ -746,13 +665,6 @@ function report_build {
cat $DETAILS_TABLE >> ./build_results.html
done
fi
- if [ -f ./phy_sim_row1.html ] || [ -f ./phy_sim_row2.html ] || [ -f ./phy_sim_row3.html ] || [ -f ./phy_sim_row4.html ] || [ -f ./phy_sim_row5.html ] || [ -f ./phy_sim_row6.html ] || [ -f ./phy_sim_row7.html ] || [ -f ./phy_sim_row8.html ]
- then
- for DETAILS_TABLE in `ls ./phy_sim_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- fi
if [ -f ./gnb_usrp_row1.html ] || [ -f ./gnb_usrp_row2.html ] || [ -f ./gnb_usrp_row3.html ] || [ -f ./gnb_usrp_row4.html ]
then
for DETAILS_TABLE in `ls ./gnb_usrp_row*.html`
@@ -767,13 +679,6 @@ function report_build {
cat $DETAILS_TABLE >> ./build_results.html
done
fi
- if [ -f ./enb_usrp_rh_row1.html ] || [ -f ./enb_usrp_rh_row2.html ] || [ -f ./enb_usrp_rh_row3.html ] || [ -f ./enb_usrp_rh_row4.html ]
- then
- for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html`
- do
- cat $DETAILS_TABLE >> ./build_results.html
- done
- fi
rm -f ./*_row*.html
echo "
" >> ./build_results.html
diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh
index 8562f4b2de..19fac7fd78 100755
--- a/ci-scripts/reportTestLocally.sh
+++ b/ci-scripts/reportTestLocally.sh
@@ -309,14 +309,14 @@ function report_test {
NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG`
NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG`
- if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
+ if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
then
echo " OK " >> ./test_simulator_results.html
else
echo " KO " >> ./test_simulator_results.html
fi
echo " " >> ./test_simulator_results.html
- if [ $NB_ENB_GOT_SYNC -eq 1 ]
+ if [ $NB_ENB_GOT_SYNC -gt 0 ]
then
echo "- eNB --> got sync " >> ./test_simulator_results.html
else
@@ -717,7 +717,11 @@ function report_test {
done
echo " " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
+ fi
+ ARCHIVES_LOC=archives/rf5g_sim/test
+ if [ -d $ARCHIVES_LOC ]
+ then
echo " 5G NR RF Simulator Check " >> ./test_simulator_results.html
if [ -f $ARCHIVES_LOC/test_final_status.log ]
@@ -748,8 +752,10 @@ function report_test {
echo " Statistics " >> ./test_simulator_results.html
echo " " >> ./test_simulator_results.html
+ #SA
EPC_CONFIGS=("noS1")
TRANS_MODES=("tdd")
+ FR_MODE=("SA")
BW_CASES=(106)
for CN_CONFIG in ${EPC_CONFIGS[@]}
do
@@ -760,13 +766,159 @@ function report_test {
echo " " >> ./test_simulator_results.html
if [[ $CN_CONFIG =~ .*wS1.* ]]
then
- echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB " >> ./test_simulator_results.html
+ echo " Test with CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
else
- echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB " >> ./test_simulator_results.html
+ echo " Test without CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
fi
echo " " >> ./test_simulator_results.html
- #RA test (--do-ra option)
+
+ #SA test (--sa option)
+
+ SA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_sa_test.log
+ SA_UE_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ue_sa_test.log
+ if [ -f $RA_ENB_LOG ] && [ -f $RA_UE_LOG ]
+ then
+ #get rid of full path
+ NAME_ENB=`echo $SA_ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+ NAME_UE=`echo $SA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+ echo " " >> ./test_simulator_results.html
+ echo " $NAME_ENB --- $NAME_UE " >> ./test_simulator_results.html
+ echo " Check if SA proc succeeded " >> ./test_simulator_results.html
+
+
+ RRC_CHECK=`egrep -c "Received rrcSetupComplete" $SA_ENB_LOG`
+ CBRA_CHECK=`egrep -c "Received Ack of RA-Msg4\. CBRA procedure succeeded" $SA_ENB_LOG`
+ SIB1_CHECK=`egrep -c "SIB1 decoded" $SA_UE_LOG`
+
+
+ if [ $RRC_CHECK -gt 0 ] && [ $CBRA_CHECK -gt 0 ] && [ $SIB1_CHECK -gt 0 ]
+ then
+ echo " OK " >> ./test_simulator_results.html
+ else
+ echo " KO " >> ./test_simulator_results.html
+ fi
+
+ echo " " >> ./test_simulator_results.html
+ if [ $RRC_CHECK -gt 0 ]
+ then
+ echo "- Received rrcSetupComplete OK " >> ./test_simulator_results.html
+ else
+ echo "- Received rrcSetupComplete KO " >> ./test_simulator_results.html
+ fi
+ if [ $CBRA_CHECK -gt 0 ]
+ then
+ echo "- CBRA procedure succeeded OK " >> ./test_simulator_results.html
+ else
+ echo "- CBRA procedure succeeded KO " >> ./test_simulator_results.html
+ fi
+ if [ $SIB1_CHECK -gt 0 ]
+ then
+ echo "- SIB1 decoded OK " >> ./test_simulator_results.html
+ else
+ echo "- SIB1 decoded KO " >> ./test_simulator_results.html
+ fi
+
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
+
+ done
+ done
+ done
+
+
+ EPC_CONFIGS=("noS1")
+ TRANS_MODES=("tdd")
+ FR_MODE=("FR2")
+ BW_CASES=(32)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
+ do
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ for BW in ${BW_CASES[@]}
+ do
+ echo " " >> ./test_simulator_results.html
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo " Test with CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
+ else
+ echo " Test without CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+
+
+ #FR2 RA test (--do-ra option)
+
+ #build log files names tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_fr2_test.log
+
+ RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_fr2_test.log
+ RA_UE_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ue_ra_fr2_test.log
+ if [ -f $RA_ENB_LOG ] && [ -f $RA_UE_LOG ]
+ then
+ #get rid of full path
+ NAME_ENB=`echo $RA_ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+ NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+ echo " " >> ./test_simulator_results.html
+ echo " $NAME_ENB --- $NAME_UE " >> ./test_simulator_results.html
+ echo " Check if FR2 RA proc succeeded " >> ./test_simulator_results.html
+
+ #gNB RA check
+ GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG`
+ #UE RA check
+ UE_RA_PROC_OK=`egrep -c "\[RAPROC\] RA procedure succeeded" $RA_UE_LOG`
+
+
+ if [ $GNB_RECEIVED -gt 0 ] && [ $UE_RA_PROC_OK -gt 0 ]
+ then
+ echo " OK " >> ./test_simulator_results.html
+ else
+ echo " KO " >> ./test_simulator_results.html
+ fi
+
+ echo " " >> ./test_simulator_results.html
+ if [ $GNB_RECEIVED -gt 0 ]
+ then
+ echo "- gNB --> RA received " >> ./test_simulator_results.html
+ else
+ echo "- gNB RA NOT RECEIVED " >> ./test_simulator_results.html
+ fi
+ if [ $UE_RA_PROC_OK -gt 0 ]
+ then
+ echo "- NR UE --> RA procedure succeded " >> ./test_simulator_results.html
+ else
+ echo "- NR UE RA procedure failed " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+ echo " " >> ./test_simulator_results.html
+ fi
+
+ done
+ done
+ done
+
+
+ EPC_CONFIGS=("noS1")
+ FR_MODE=("FR1")
+ TRANS_MODES=("fdd" "tdd")
+ BW_CASES=(106)
+ for CN_CONFIG in ${EPC_CONFIGS[@]}
+ do
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ for BW in ${BW_CASES[@]}
+ do
+ echo " " >> ./test_simulator_results.html
+ if [[ $CN_CONFIG =~ .*wS1.* ]]
+ then
+ echo " Test with CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
+ else
+ echo " Test without CN5G : ${TMODE} -- ${BW}PRB -- ${FR_MODE} " >> ./test_simulator_results.html
+ fi
+ echo " " >> ./test_simulator_results.html
+
+
+ #FR1 RA test (--do-ra option)
#build log files names
RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_test.log
@@ -778,7 +930,7 @@ function report_test {
NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
echo " " >> ./test_simulator_results.html
echo " $NAME_ENB --- $NAME_UE " >> ./test_simulator_results.html
- echo " Check if RA proc succeeded " >> ./test_simulator_results.html
+ echo " Check if FR1 RA proc succeeded " >> ./test_simulator_results.html
#gNB RA check
GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG`
diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh
index 70eabb7b69..de696cdc64 100755
--- a/ci-scripts/runTestOnVM.sh
+++ b/ci-scripts/runTestOnVM.sh
@@ -277,6 +277,46 @@ function check_ping_result {
}
+function check_sa_result {
+ local LOC_GNB_LOG=$1
+ local LOC_UE_LOG=$2
+
+ #if log files exist
+ if [ -f $LOC_GNB_LOG ] && [ -f $LOC_UE_LOG ]
+ then
+
+ #gNB SA test
+ #console check
+ echo "Checking gNB Log for SA success"
+ egrep "Received rrcSetupComplete" $1
+ egrep "Received Ack of RA-Msg4\. CBRA procedure succeeded" $1
+
+ #script check
+ local RRC_CHECK=`egrep -c "Received rrcSetupComplete" $1`
+ local CBRA_CHECK=`egrep -c "Received Ack of RA-Msg4\. CBRA procedure succeeded" $1`
+
+ #UE SA test
+ #console check
+ echo 'Checking UE Log for SA success'
+ egrep "SIB1 decoded" $2
+ #script check
+ local SIB1_CHECK=`egrep -c "SIB1 decoded" $2`
+
+ #generate status
+ if [ $RRC_CHECK -eq 0 ] || [ $CBRA_CHECK -eq 0 ] || [ $SIB1_CHECK -eq 0 ]
+ then
+ SA_STATUS=-1
+ echo "SA test FAILED, could not find the markers"
+ fi
+ #case where log files do not exist
+ else
+ echo "SA test log files not present"
+ SA_STATUS=-1
+ fi
+
+}
+
+
function check_ra_result {
local LOC_GNB_LOG=$1
local LOC_UE_LOG=$2
@@ -379,7 +419,7 @@ function check_iperf {
local LOC_IS_DL=`echo $LOC_BASE_LOG | grep -c _dl`
local LOC_IS_BASIC_SIM=`echo $LOC_BASE_LOG | grep -c basic_sim`
local LOC_IS_RF_SIM=`echo $LOC_BASE_LOG | grep -c rf_sim`
- local LOC_IS_NR=`echo $LOC_BASE_LOG | grep -c tdd_106prb`
+ local LOC_IS_NR=`echo $LOC_BASE_LOG | grep -c _106prb`
if [ -f ${LOC_BASE_LOG}_client.txt ]
then
local FILE_COMPLETE=`egrep -c "Server Report" ${LOC_BASE_LOG}_client.txt`
@@ -964,6 +1004,12 @@ function start_l2_sim_ue {
echo "ifconfig" > $1
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
rm $1
+ else
+ echo "Setting Routes for all UEs"
+ echo "cd /home/ubuntu/tmp/cmake_targets/tools" > $1
+ echo "./setup_routes.sh $LOC_NB_UES" >> $1
+ ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_UE_VM_IP_ADDR < $1
+ rm $1
fi
}
@@ -1209,8 +1255,8 @@ function start_rf_sim_gnb {
local LOC_CONF_FILE=$5
# 1 is with S1 and 0 without S1 aka noS1
local LOC_S1_CONFIGURATION=$6
- #LOC_RA_TEST=1 will run the RA test check
- local LOC_RA_TEST=$7
+ #LOC_RA_SA_TEST=1 will run the RA test check ; =2 will run the SA test
+ local LOC_RA_SA_TEST=$7
if [ -e rbconfig.raw ]; then rm -f rbconfig.raw; fi
if [ -e reconfig.raw ]; then rm -f reconfig.raw; fi
@@ -1233,11 +1279,14 @@ function start_rf_sim_gnb {
echo "sudo rm -f r*config.raw" >> $1
if [ $LOC_S1_CONFIGURATION -eq 0 ]
then
- if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
+ if [ $LOC_RA_SA_TEST -eq 0 ] #no RA test => use --phy-test option
then
- echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test\" > ./my-nr-softmodem-run.sh " >> $1
- else #RA test => use --do-ra option
- echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra\" > ./my-nr-softmodem-run.sh " >> $1
+ echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
+ elif [ $LOC_RA_SA_TEST -eq 1 ] #RA test => use --do-ra option
+ then
+ echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
+ else #SA test => use --sa option
+ echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --sa --lowmem \" > ./my-nr-softmodem-run.sh " >> $1
fi
fi
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
@@ -1273,7 +1322,7 @@ function start_rf_sim_gnb {
fi
# check noS1 config only outside RA test (as it does not support noS1)
- if [ $LOC_S1_CONFIGURATION -eq 0 ] && [ $LOC_RA_TEST -eq 0 ]
+ if [ $LOC_S1_CONFIGURATION -eq 0 ] && [ $LOC_RA_SA_TEST -eq 0 ]
then
echo "ifconfig oaitun_enb1 | egrep -c \"inet addr\"" > $1
# Checking oaitun_enb1 interface has now an IP address
@@ -1306,8 +1355,11 @@ function start_rf_sim_gnb {
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR < $1
rm $1
# Copy the RAW files from the gNB run for the NR-UE
- scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/rbconfig.raw .
- scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/reconfig.raw .
+ if [ $LOC_RA_SA_TEST -ne 2 ]
+ then
+ scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/rbconfig.raw .
+ scp -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/ran_build/build/reconfig.raw .
+ fi
}
function start_rf_sim_nr_ue {
@@ -1318,12 +1370,15 @@ function start_rf_sim_nr_ue {
local LOC_FREQUENCY=$6
# 1 is with S1 and 0 without S1 aka noS1
local LOC_S1_CONFIGURATION=$7
- #LOC_RA_TEST=1 will run the RA test check
- local LOC_RA_TEST=$8
+ #LOC_RA_SA_TEST=1 will run the RA test check ; =2 will run the SA test
+ local LOC_RA_SA_TEST=$8
# Copy the RAW files from the gNB run
- scp -o StrictHostKeyChecking=no rbconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp
- scp -o StrictHostKeyChecking=no reconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp
+ if [ $LOC_RA_SA_TEST -ne 2 ]
+ then
+ scp -o StrictHostKeyChecking=no rbconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp
+ scp -o StrictHostKeyChecking=no reconfig.raw ubuntu@$LOC_NR_UE_VM_IP_ADDR:/home/ubuntu/tmp
+ fi
echo "echo \"sudo apt-get --yes --quiet install daemon \"" > $1
echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1
@@ -1331,16 +1386,23 @@ function start_rf_sim_nr_ue {
echo "export RFSIMULATOR=${LOC_GNB_VM_IP_ADDR}" >> $1
echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" >> $1
echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
- echo "sudo cp /home/ubuntu/tmp/r*config.raw /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
- echo "sudo chmod 666 /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1
+ echo "sudo rm -f /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1
+ if [ $LOC_RA_SA_TEST -ne 2 ]
+ then
+ echo "sudo cp /home/ubuntu/tmp/r*config.raw /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
+ echo "sudo chmod 666 /home/ubuntu/tmp/cmake_targets/ran_build/build/r*config.raw" >> $1
+ fi
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
if [ $LOC_S1_CONFIGURATION -eq 0 ]
then
- if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option
+ if [ $LOC_RA_SA_TEST -eq 0 ] #no RA test => use --phy-test option
then
echo "echo \"./nr-uesoftmodem --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/ --log_config.global_log_options level,nocolor --noS1\" > ./my-nr-softmodem-run.sh " >> $1
- else #RA test => use --do-ra option
+ elif [ $LOC_RA_SA_TEST -eq 1 ] #RA test => use --do-ra option
+ then
echo "echo \"./nr-uesoftmodem --rfsim --do-ra --log_config.global_log_options level,nocolor --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/\" > ./my-nr-softmodem-run.sh " >> $1
+ else #SA test => use --sa option
+ echo "echo \"./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --log_config.global_log_options level,nocolor\" > ./my-nr-softmodem-run.sh " >> $1
fi
fi
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
@@ -1375,7 +1437,7 @@ function start_rf_sim_nr_ue {
echo "RF-SIM NR-UE is sync'ed w/ gNB"
fi
# Checking oaitun_ue1 interface has now an IP address (only outside RA test)
- if [ $LOC_RA_TEST -eq 0 ]
+ if [ $LOC_RA_SA_TEST -eq 0 ]
then
i="0"
echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1
@@ -1420,11 +1482,13 @@ function run_test_on_vm {
UE_VM_CMDS=${UE_VM_NAME}_cmds.txt
echo "UE_VM_NAME = $UE_VM_NAME"
echo "UE_VM_CMD_FILE = $UE_VM_CMDS"
- GNB_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#gnb-usrp#" -e "s#rf-sim#gnb-usrp#"`
+ elif [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf5g-sim.* )) ]]
+ then
+ GNB_VM_NAME=`echo $VM_NAME | sed -e "s#rf5g-sim#gnb-usrp#"`
GNB_VM_CMDS=${GNB_VM_NAME}_cmds.txt
echo "GNB_VM_NAME = $GNB_VM_NAME"
echo "GNB_VM_CMD_FILE = $GNB_VM_CMDS"
- NR_UE_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#nr-ue-usrp#" -e "s#rf-sim#nr-ue-usrp#"`
+ NR_UE_VM_NAME=`echo $VM_NAME | sed -e "s#rf5g-sim#nr-ue-usrp#"`
NR_UE_VM_CMDS=${UE_VM_NAME}_cmds.txt
echo "NR_UE_VM_NAME = $NR_UE_VM_NAME"
echo "NR_UE_VM_CMD_FILE = $NR_UE_VM_CMDS"
@@ -1453,6 +1517,8 @@ function run_test_on_vm {
UE_VM_IP_ADDR=`uvt-kvm ip $UE_VM_NAME`
echo "$UE_VM_NAME has for IP addr = $UE_VM_IP_ADDR"
+ elif [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf5g-sim.* )) ]]
+ then
echo "############################################################"
echo "Waiting for GNB VM to be started"
echo "############################################################"
@@ -1478,13 +1544,13 @@ function run_test_on_vm {
echo "$VM_NAME has for IP addr = $VM_IP_ADDR"
fi
- if [ "$RUN_OPTIONS" == "none" ]
+ if [ "$RUN_OPTIONS" == "none" ] || [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]]
then
echo "No run on VM testing for this variant currently"
return
fi
- if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]]
+ if [[ $RUN_OPTIONS =~ .*run_XXXX_autotests.* ]]
then
echo "############################################################"
echo "Running test script on VM ($VM_NAME)"
@@ -2187,10 +2253,23 @@ function run_test_on_vm {
fi
- if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]]
+ if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf5g-sim.* ]]
then
+ PING_STATUS=0
+ IPERF_STATUS=0
+ NR_STATUS=0
+ if [ -d $ARCHIVES_LOC ]
+ then
+ rm -Rf $ARCHIVES_LOC
+ fi
+ mkdir --parents $ARCHIVES_LOC
+
+ echo "############################################################"
+ echo "SA TEST"
+ echo "############################################################"
+ #SA test, attention : has a different config file from the rest of the test
CN_CONFIG="noS1"
- CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
+ CONF_FILE=gnb.band78.sa.fr1.106PRB.usrpn310.conf
S1_NOS1_CFG=0
PRB=106
FREQUENCY=3510
@@ -2201,27 +2280,109 @@ function run_test_on_vm {
fi
local try_cnt=0
- NR_STATUS=0
+
+ ######### start of SA TEST loop
+ while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI
+ do
+
+ SYNC_STATUS=0
+ SA_STATUS=0
+ rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*sa_test.log
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the gNB"
+ echo "############################################################"
+ CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_sa_test.log
+ #last argument = 2 is to enable --sa for SA test
+ start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 2
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the NR-UE"
+ echo "############################################################"
+ CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_sa_test.log
+ #last argument = 2 is to enable --sa for SA test
+ start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 2
+ if [ $NR_UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ gNB and NR-UE not syncing"
+ terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2
+ terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1
+ scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC
+ SYNC_STATUS=-1
+ try_cnt=$((try_cnt+1))
+ continue
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Terminate gNB/NR-UE simulators"
+ echo "############################################################"
+ sleep 20
+ terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2
+ terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1
+ scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC
+
+ #check SA markers in gNB and NR UE log files
+ echo "############################################################"
+ echo "${CN_CONFIG} : Checking SA on gNB / NR-UE"
+ echo "############################################################"
+
+ # Proper check to be done when SA test is working!
+ check_sa_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE
+ if [ $SA_STATUS -ne 0 ]
+ then
+ echo "SA test NOT OK"
+ echo "try_cnt = " $try_cnt
+ try_cnt=$((try_cnt+1))
+ else
+ echo "SA test OK"
+ try_cnt=$((try_cnt+10))
+ fi
+ done
+ ########### end SA test
+
+ sleep 30
+
+
+
+ echo "############################################################"
+ echo "RA TEST FR2"
+ echo "############################################################"
+ #RA FR2 test, attention : has a different config file from the rest of the test
+ CN_CONFIG="noS1"
+ CONF_FILE=gnb.band261.tm1.32PRB.usrpn300.conf
+ S1_NOS1_CFG=0
+ PRB=32
+ FREQUENCY=28000 #28GHz
+
+ if [ ! -d $ARCHIVES_LOC ]
+ then
+ mkdir --parents $ARCHIVES_LOC
+ fi
+
+ local try_cnt=0
######### start of RA TEST loop
+ RA_FR2_STATUS=0
while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI
do
SYNC_STATUS=0
RA_STATUS=0
- rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_test.log
+ rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_fr2_test.log
echo "############################################################"
echo "${CN_CONFIG} : Starting the gNB"
echo "############################################################"
- CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_test.log
+ CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_fr2_test.log
#last argument = 1 is to enable --do-ra for RA test
start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 1
echo "############################################################"
echo "${CN_CONFIG} : Starting the NR-UE"
echo "############################################################"
- CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_ra_test.log
+ CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_ra_fr2_test.log
#last argument = 1 is to enable --do-ra for RA test
start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1
if [ $NR_UE_SYNC -eq 0 ]
@@ -2247,48 +2408,165 @@ function run_test_on_vm {
#check RA markers in gNB and NR UE log files
echo "############################################################"
- echo "${CN_CONFIG} : Checking RA on gNB / NR-UE"
+ echo "${CN_CONFIG} : Checking FR2 RA on gNB / NR-UE"
echo "############################################################"
# Proper check to be done when RA test is working!
check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE
if [ $RA_STATUS -ne 0 ]
then
- echo "RA test NOT OK"
+ echo "RA FR2 test NOT OK"
echo "try_cnt = " $try_cnt
try_cnt=$((try_cnt+1))
+ RA_FR2_STATUS=-1
else
+ echo "RA FR2 test OK"
+ RA_FR2_STATUS=0
try_cnt=$((try_cnt+10))
fi
done
+ ########### end RA FR2 test
+
+ sleep 30
+
+
+ echo "############################################################"
+ echo "RA TEST FR1"
+ echo "############################################################"
+ ######### redefine config for the rest of the test
+
+ CN_CONFIG="noS1"
+ CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
+ S1_NOS1_CFG=0
+ PRB=106
+ FREQUENCY=3510
+
+ if [ ! -d $ARCHIVES_LOC ]
+ then
+ mkdir --parents $ARCHIVES_LOC
+ fi
+
+ CN_CONFIG="noS1"
+ S1_NOS1_CFG=0
+
+ ######### start of RA TEST loop
+ # for the moment only TDD
+ TRANS_MODES=("tdd")
+ for TMODE in ${TRANS_MODES[@]}
+ do
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ CONF_FILE=gnb.band66.tm1.106PRB.usrpn300.conf
+ PRB=106
+ FREQUENCY=37000
+ else
+ CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
+ PRB=106
+ FREQUENCY=3510
+ fi
+
+ RA_FR1_STATUS=0
+ local try_cnt=0
+ while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI
+
+ do
+ SYNC_STATUS=0
+ RA_STATUS=0
+ rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}*ra_test.log
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (RA TEST)"
+ echo "############################################################"
+ CURRENT_GNB_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_gnb_ra_test.log
+ #last argument = 1 is to enable --do-ra for RA test
+ start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 1
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (RA TEST)"
+ echo "############################################################"
+ CURRENT_NR_UE_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ue_ra_test.log
+ #last argument = 1 is to enable --do-ra for RA test
+ start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1
+ if [ $NR_UE_SYNC -eq 0 ]
+ then
+ echo "Problem w/ gNB and NR-UE not syncing"
+ terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2
+ terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1
+ scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC
+ SYNC_STATUS=-1
+ try_cnt=$((try_cnt+1))
+ continue
+ fi
+
+ echo "############################################################"
+ echo "${CN_CONFIG} : Terminate gNB/NR-UE simulators"
+ echo "############################################################"
+ sleep 20
+ terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2
+ terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1
+ scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC
+ scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC
+
+ #check RA markers in gNB and NR UE log files
+ echo "############################################################"
+ echo "${CN_CONFIG} : Checking FR1 RA on gNB / NR-UE"
+ echo "############################################################"
+
+ # Proper check to be done when RA test is working!
+ check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE
+ if [ $RA_STATUS -ne 0 ]
+ then
+ echo "RA FR1 test NOT OK"
+ echo "try_cnt = " $try_cnt
+ RA_FR1_STATUS=-1
+ try_cnt=$((try_cnt+1))
+ else
+ echo "RA FR1 test OK"
+ RA_FR1_STATUS=0
+ try_cnt=$((try_cnt+10))
+ fi
+ done
+ done
########### end RA test
sleep 30
-
######### start of PHY TEST loop
- try_cnt=0
- while [ $try_cnt -lt 4 ]
+ SYNC_STATUS=0
+ PING_STATUS=0
+ IPERF_STATUS=0
+ TRANS_MODES=("fdd tdd")
+ for TMODE in ${TRANS_MODES[@]}
do
+ if [[ $TMODE =~ .*fdd.* ]]
+ then
+ CONF_FILE=gnb.band66.tm1.106PRB.usrpn300.conf
+ PRB=106
+ FREQUENCY=37000
+ else
+ CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
+ PRB=106
+ FREQUENCY=3510
+ fi
-
- SYNC_STATUS=0
- PING_STATUS=0
- IPERF_STATUS=0
- rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_gnb.log $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ue.log
- rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log
- rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_iperf_dl*txt $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_iperf_ul*txt
+ try_cnt=0
+ while [ $try_cnt -lt 4 ]
+ do
+ rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_gnb.log $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ue.log
+ rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log
+ rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_dl*txt $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_ul*txt
echo "############################################################"
- echo "${CN_CONFIG} : Starting the gNB"
+ echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (PHY TEST)"
echo "############################################################"
- CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb.log
+ CURRENT_GNB_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_gnb.log
start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 0
echo "############################################################"
- echo "${CN_CONFIG} : Starting the NR-UE"
+ echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (PHY TEST)"
echo "############################################################"
- CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue.log
+ CURRENT_NR_UE_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ue.log
start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 0
if [ $NR_UE_SYNC -eq 0 ]
then
@@ -2306,7 +2584,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : Pinging the gNB from NR-UE"
echo "############################################################"
get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR
- PING_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log
+ PING_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log
ping_epc_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE 1 0
scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
@@ -2315,7 +2593,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : Pinging the NR-UE from gNB"
echo "############################################################"
get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1
- PING_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log
+ PING_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log
ping_enb_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
@@ -2324,7 +2602,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : iperf DL -- NR-UE is server and gNB is client"
echo "############################################################"
THROUGHPUT="30K"
- CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_dl
+ CURR_IPERF_LOG_BASE=${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_dl
get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR
get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1
generic_iperf $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0
@@ -2346,7 +2624,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : iperf UL -- gNB is server and NR-UE is client"
echo "############################################################"
THROUGHPUT="30K"
- CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_ul
+ CURR_IPERF_LOG_BASE=${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_ul
get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR
get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1
generic_iperf $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0
@@ -2368,6 +2646,7 @@ function run_test_on_vm {
else
try_cnt=$((try_cnt+10))
fi
+ done
done
######### end of loop
full_l2_sim_destroy
@@ -2377,17 +2656,19 @@ function run_test_on_vm {
echo "Checking run status"
echo "############################################################"
- if [ $RA_STATUS -ne 0 ]; then NR_STATUS=-1; fi
+ if [ $SA_STATUS -ne 0 ]; then NR_STATUS=-1; fi
+ if [ $RA_FR2_STATUS -ne 0 ]; then NR_STATUS=-1; fi
+ if [ $RA_FR1_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $SYNC_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $PING_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $IPERF_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $NR_STATUS -eq 0 ]
then
echo "5G-NR RFSIM seems OK"
- echo "5G-NR: TEST_OK" >> $ARCHIVES_LOC/test_final_status.log
+ echo "5G-NR: TEST_OK" > $ARCHIVES_LOC/test_final_status.log
else
echo "5G-NR RFSIM seems to FAIL"
- echo "5G-NR: TEST_KO" >> $ARCHIVES_LOC/test_final_status.log
+ echo "5G-NR: TEST_KO" > $ARCHIVES_LOC/test_final_status.log
STATUS=-1
fi
fi
diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py
index 5bfe5da70f..b4087c9695 100644
--- a/ci-scripts/sshconnection.py
+++ b/ci-scripts/sshconnection.py
@@ -35,6 +35,7 @@ import pexpect # pexpect
import logging
import time # sleep
import re
+import subprocess
import sys
#-----------------------------------------------------------
@@ -44,6 +45,9 @@ class SSHConnection():
def __init__(self):
self.ssh = ''
self.picocom_closure = False
+ self.ipaddress = ''
+ self.username = ''
+ self.cmd2Results = ''
def disablePicocomClosure(self):
self.picocom_closure = False
@@ -98,6 +102,8 @@ class SSHConnection():
pass
else:
sys.exit('SSH Connection Failed')
+ self.ipaddress = ipaddress
+ self.username = username
@@ -111,11 +117,20 @@ class SSHConnection():
self.sshresponse = self.ssh.expect(expected)
return self.sshresponse
- def command(self, commandline, expectedline, timeout):
- logging.debug(commandline)
+ def command(self, commandline, expectedline, timeout, silent=False, resync=False):
+ if not silent:
+ logging.debug(commandline)
self.ssh.timeout = timeout
- self.ssh.sendline(commandline)
- self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT])
+ # Nasty patch when pexpect output is out of sync.
+ # Much pronounced when running back-to-back-back oc commands
+ if resync:
+ self.ssh.send(commandline)
+ self.ssh.expect([commandline, pexpect.TIMEOUT])
+ self.ssh.send('\r\n')
+ self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT])
+ else:
+ self.ssh.sendline(commandline)
+ self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT])
if self.sshresponse == 0:
return 0
elif self.sshresponse == 1:
@@ -137,10 +152,23 @@ class SSHConnection():
logging.debug('Expected Line : ' + expectedline)
sys.exit(self.sshresponse)
+ def command2(self, commandline, timeout, silent=False):
+ if not silent:
+ logging.debug(commandline)
+ self.cmd2Results = ''
+ myHost = self.username + '@' + self.ipaddress
+ # CAUTION: THIS METHOD IMPLIES THAT THERE ARE VALID SSH KEYS
+ # BETWEEN THE PYTHON EXECUTOR NODE AND THE REMOTE HOST
+ # OTHERWISE IT WON'T WORK
+ lSsh = subprocess.Popen(["ssh", "%s" % myHost, commandline],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ self.cmd2Results = str(lSsh.stdout.readlines())
+
def close(self):
self.ssh.timeout = 5
self.ssh.sendline('exit')
self.sshresponse = self.ssh.expect([pexpect.EOF, pexpect.TIMEOUT])
+ self.ipaddress = ''
+ self.username = ''
if self.sshresponse == 0:
pass
elif self.sshresponse == 1:
diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh
index ff2129a187..4a604a1fe9 100755
--- a/ci-scripts/waitBuildOnVM.sh
+++ b/ci-scripts/waitBuildOnVM.sh
@@ -47,7 +47,7 @@ function wait_on_vm_build {
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
echo "BUILD_OPTIONS = $BUILD_OPTIONS"
- if [[ "$VM_NAME" == *"-enb-usrp"* ]]
+ if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]]
then
echo "This VM type is no longer supported in the pipeline framework"
return
@@ -73,6 +73,9 @@ function wait_on_vm_build {
echo "############################################################"
echo "Waiting build process to end on VM ($VM_NAME)"
echo "############################################################"
+ # Since the last VM was cppcheck and is removed
+ # we are going too fast in wait and the build_oai is not yet started
+ sleep 120
if [[ "$VM_NAME" == *"-cppcheck"* ]]
then
@@ -90,7 +93,7 @@ function wait_on_vm_build {
}
function check_on_vm_build {
- if [[ "$VM_NAME" == *"-enb-usrp"* ]]
+ if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]]
then
echo "This VM type is no longer supported in the pipeline framework"
return
diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml
index 0e00a2e7d4..a43e5b79c0 100755
--- a/ci-scripts/xml_class_list.yml
+++ b/ci-scripts/xml_class_list.yml
@@ -27,6 +27,8 @@
- Terminate_MME
- Initialize_SPGW
- Terminate_SPGW
+ - Initialize_5GCN
+ - Terminate_5GCN
- Initialize_CatM_module
- Terminate_CatM_module
- Attach_CatM_module
@@ -37,3 +39,5 @@
- Build_Image
- Deploy_Object
- Undeploy_Object
+ - Cppcheck_Analysis
+ - Deploy_Run_PhySim
diff --git a/ci-scripts/xml_files/benetel_multi_node_build.xml b/ci-scripts/xml_files/benetel_multi_node_build.xml
new file mode 100644
index 0000000000..5ac28951b4
--- /dev/null
+++ b/ci-scripts/xml_files/benetel_multi_node_build.xml
@@ -0,0 +1,54 @@
+
+
+ build-tab
+ Build
+ wrench
+
+ 000001 000002
+
+
+
+
+ Build_eNB
+ Build eNB
+ --eNB -t benetel4g -w None
+ True
+ 0
+ 0
+
+
+
+
+ Build_eNB
+ Build gNB
+ --gNB -t benetel5g -w None
+ True
+ 1
+ 1
+
+
+
+
+
+
diff --git a/ci-scripts/xml_files/benetel_nsa_quectel.xml b/ci-scripts/xml_files/benetel_nsa_quectel.xml
new file mode 100644
index 0000000000..ed93f59e81
--- /dev/null
+++ b/ci-scripts/xml_files/benetel_nsa_quectel.xml
@@ -0,0 +1,147 @@
+
+
+ TEST-NSA-FR1-TM1
+ NSA Ping DL UL with QUECTEL
+ tasks
+ 3
+
+ 030000
+ 040000
+ 000002
+ 010000
+ 050000
+ 050001
+ 000001
+ 070000
+ 000001
+ 070001
+ 000001
+ 010002
+ 000001
+ 080001
+ 080000
+
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ idefix
+
+
+
+
+ Detach_UE
+ Detach UE
+ idefix
+
+
+
+
+ Initialize_eNB
+ Initialize eNB
+ -O ci-scripts/conf_files/benetel-4g.conf
+ 0
+ 0
+ lte
+
+
+
+
+ Initialize_eNB
+ Initialize gNB
+ -O ci-scripts/conf_files/benetel-5g.conf -q
+ 1
+ 1
+ nr
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 20
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ idefix
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ idefix
+ -c 100 -i 0.2
+ 50
+
+
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 20M -t 60 -i 1
+ DL
+ idefix
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 3M -t 60 -i 1
+ UL
+ idefix
+ 50
+ single-ue
+
+
+
+
+ Terminate_eNB
+ Terminate eNB
+ 0
+ 0
+ lte
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ 1
+ 1
+ nr
+
+
+
+
diff --git a/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml b/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml
new file mode 100644
index 0000000000..93c0c5a00a
--- /dev/null
+++ b/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml
@@ -0,0 +1,149 @@
+
+
+ TEST-NSA-FR1-TM1
+ NSA Ping DL UL with QUECTEL
+ tasks
+ 3
+
+ 030000
+ 040000
+ 000002
+ 010000
+ 000001
+ 050000
+ 050001
+ 000001
+ 070000
+ 000001
+ 070001
+ 000001
+ 010002
+ 000001
+ 080001
+ 080000
+
+
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ idefix
+
+
+
+
+ Detach_UE
+ Detach UE
+ idefix
+
+
+
+
+ Initialize_eNB
+ Initialize eNB
+ -O ci-scripts/conf_files/benetel-4g.conf
+ 0
+ 0
+ lte
+
+
+
+
+ Initialize_eNB
+ Initialize gNB
+ -O ci-scripts/conf_files/benetel-5g.conf -q
+ 1
+ 1
+ nr
+
+
+
+ IdleSleep
+ Sleep
+ 10
+
+
+
+ IdleSleep
+ Sleep
+ 30
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ idefix
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ idefix
+ -c 100 -i 0.2
+ 50
+
+
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(20 min)(single-ue profile)
+ -u -b 20M -t 1200 -i 1
+ DL
+ idefix
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(20 min)(single-ue profile)
+ -u -b 2M -t 1200 -i 1
+ UL
+ idefix
+ 50
+ single-ue
+
+
+
+
+ Terminate_eNB
+ Terminate eNB
+ 0
+ 0
+ lte
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ 1
+ 1
+ nr
+
+
+
+
diff --git a/ci-scripts/xml_files/fr1_image_build.xml b/ci-scripts/xml_files/container_image_build.xml
similarity index 90%
rename from ci-scripts/xml_files/fr1_image_build.xml
rename to ci-scripts/xml_files/container_image_build.xml
index 9dd386b646..e7eabc0794 100644
--- a/ci-scripts/xml_files/fr1_image_build.xml
+++ b/ci-scripts/xml_files/container_image_build.xml
@@ -22,7 +22,7 @@
-->
build-tab
- Build
+ Build Container Images
wrench
000001
@@ -31,10 +31,11 @@
Build_Image
- Build eNB Image
+ Build all Images
all
0
0
+ True
diff --git a/ci-scripts/xml_files/cppcheck.xml b/ci-scripts/xml_files/cppcheck.xml
new file mode 100644
index 0000000000..dd90d88f7e
--- /dev/null
+++ b/ci-scripts/xml_files/cppcheck.xml
@@ -0,0 +1,37 @@
+
+
+ build-tab
+ CPPCHECK Analysis
+ wrench
+
+ 000001
+
+
+
+
+ Cppcheck_Analysis
+ Static Code Analysis with cppcheck
+
+
+
diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_build.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_build.xml
index 64c3517166..bfaaceaa2d 100644
--- a/ci-scripts/xml_files/enb_ue_usrp210_band7_build.xml
+++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_build.xml
@@ -32,7 +32,7 @@
Build_eNB
Build eNB (USRP)
- -w USRP -c --eNB
+ -w USRP -c --eNB --ninja
diff --git a/ci-scripts/xml_files/enb_usrp210_band13_build.xml b/ci-scripts/xml_files/enb_usrp210_band13_build.xml
index 888a1230ae..53066573c8 100644
--- a/ci-scripts/xml_files/enb_usrp210_band13_build.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band13_build.xml
@@ -33,7 +33,7 @@
Build_eNB
Build eNB (USRP)
- -w USRP -c --eNB
+ -w USRP -c --eNB --ninja
diff --git a/ci-scripts/xml_files/enb_usrp210_band40_build.xml b/ci-scripts/xml_files/enb_usrp210_band40_build.xml
index 64c3517166..bfaaceaa2d 100644
--- a/ci-scripts/xml_files/enb_usrp210_band40_build.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band40_build.xml
@@ -32,7 +32,7 @@
Build_eNB
Build eNB (USRP)
- -w USRP -c --eNB
+ -w USRP -c --eNB --ninja
diff --git a/ci-scripts/xml_files/enb_usrp210_band7_build.xml b/ci-scripts/xml_files/enb_usrp210_band7_build.xml
index 64c3517166..bfaaceaa2d 100644
--- a/ci-scripts/xml_files/enb_usrp210_band7_build.xml
+++ b/ci-scripts/xml_files/enb_usrp210_band7_build.xml
@@ -32,7 +32,7 @@
Build_eNB
Build eNB (USRP)
- -w USRP -c --eNB
+ -w USRP -c --eNB --ninja
diff --git a/ci-scripts/xml_files/fr1_gnb_build.xml b/ci-scripts/xml_files/fr1_gnb_build.xml
new file mode 100644
index 0000000000..d0c91f407d
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_gnb_build.xml
@@ -0,0 +1,50 @@
+
+
+ build-tab
+ Build
+ wrench
+
+ 000001
+ 000002
+
+
+
+
+ Build_eNB
+ Build gNB
+ -w USRP -c --gNB --ninja
+ 0
+ 0
+ True
+ True
+
+
+
+ WaitEndBuild_eNB
+ Wait for end of Build gNB
+ 0
+ 0
+
+
+
diff --git a/ci-scripts/xml_files/fr1_multi_node_build.xml b/ci-scripts/xml_files/fr1_multi_node_build.xml
index 7b4eacef3a..57c4685341 100644
--- a/ci-scripts/xml_files/fr1_multi_node_build.xml
+++ b/ci-scripts/xml_files/fr1_multi_node_build.xml
@@ -37,6 +37,7 @@
0
0
True
+ True
@@ -53,6 +54,7 @@
1
1
True
+ True
diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml
new file mode 100644
index 0000000000..a8e385b854
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml
@@ -0,0 +1,146 @@
+
+
+ TEST-NSA-FR1-TM1
+ NSA Ping DL UL with QUECTEL
+ tasks
+ 1
+
+ 030000
+ 040000
+ 000002
+ 010000
+ 000001
+ 050000
+ 000001
+ 010002
+ 080001
+ 080000
+
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ nrmodule2_quectel
+ yes
+
+
+
+
+ Terminate_UE
+ Terminate Quectel
+ nrmodule2_quectel
+
+
+
+
+ Initialize_eNB
+ Initialize eNB
+ -O ci-scripts/conf_files/enb.band38.nsa_2x2.100PRB.usrpn310.conf
+ 0
+ 0
+ lte
+ yes
+ 192.168.18.241
+
+
+
+
+ Initialize_eNB
+ Initialize gNB
+ -O ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf -q
+ 1
+ 1
+ nr
+ 192.168.18.240
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 20
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ nrmodule2_quectel
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ nrmodule2_quectel
+ -c 100 -i 0.2
+ 50
+
+
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 20M -t 60
+ DL
+ nrmodule2_quectel
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 3M -t 60
+ UL
+ nrmodule2_quectel
+ 50
+ single-ue
+
+
+
+
+ Terminate_eNB
+ Terminate eNB
+ 0
+ 0
+ lte
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ 1
+ 1
+ nr
+
+
+
+
diff --git a/ci-scripts/xml_files/fr1_ran_ue_iperf.xml b/ci-scripts/xml_files/fr1_nsa_base.xml
similarity index 80%
rename from ci-scripts/xml_files/fr1_ran_ue_iperf.xml
rename to ci-scripts/xml_files/fr1_nsa_base.xml
index 8ead3afc62..96bdc79f0f 100644
--- a/ci-scripts/xml_files/fr1_ran_ue_iperf.xml
+++ b/ci-scripts/xml_files/fr1_nsa_base.xml
@@ -21,8 +21,8 @@
-->
- TEST-FR1-TM1
- FR1
+ TEST-NSA-FR1-TM1
+ NSA FULL
tasks
010000
@@ -31,14 +31,17 @@
010001
000001
050000
+ 050001
000001
060000
060001
000001
+ 070000
+ 070001
010002
000001
- 070001
- 070000
+ 080001
+ 080000
010003
@@ -96,6 +99,13 @@
50
+
+ Ping
+ Ping: 100pings in 20sec
+ -c 100 -i 0.2
+ 50
+
+
Iperf
@@ -113,7 +123,26 @@
single-ue
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(20 sec)(single-ue profile)
+ -u -b 20M -t 20 -i 1
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(20 sec)(single-ue profile)
+ -u -b 3M -t 20 -i 1 -R
+ 50
+ single-ue
+
+
+
+
+
Terminate_eNB
Terminate eNB
0
@@ -121,7 +150,7 @@
lte
-
+
Terminate_eNB
Terminate gNB
1
diff --git a/ci-scripts/xml_files/fr1_multi_node_test.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml
similarity index 51%
rename from ci-scripts/xml_files/fr1_multi_node_test.xml
rename to ci-scripts/xml_files/fr1_nsa_quectel.xml
index 8c56f0bcec..7ec3a5f140 100644
--- a/ci-scripts/xml_files/fr1_multi_node_test.xml
+++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml
@@ -21,19 +21,43 @@
-->
- test-fr1-tm1
- Test-FR1-TM1
+ TEST-NSA-FR1-TM1
+ NSA Ping DL UL with QUECTEL
tasks
1
030000
040000
+ 000002
+ 010000
+ 000001
+ 050000
+ 050001
+ 000001
+ 070000
000001
070001
- 070000
+ 000001
+ 010002
+ 080001
+ 080000
-
-
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ idefix
+ yes
+
+
+
+
+ Terminate_UE
+ Terminate Quectel
+ idefix
+
+
Initialize_eNB
@@ -42,12 +66,14 @@
0
0
lte
+ yes
+
Initialize_eNB
- Initialize gNB (3/4 sampling rate)
- -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E
+ Initialize gNB
+ -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q
1
1
nr
@@ -56,21 +82,67 @@
IdleSleep
Sleep
- 30
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 20
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ idefix
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ idefix
+ -c 100 -i 0.2
+ 50
+ Iperf
+ iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 20M -t 60
+ DL
+ idefix
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 3M -t 60
+ UL
+ idefix
+ 50
+ single-ue
+
+
+
+
Terminate_eNB
Terminate eNB
0
0
+ lte
-
+
Terminate_eNB
Terminate gNB
1
1
+ nr
diff --git a/ci-scripts/xml_files/fr1_nsa_quectel_attach_detach.xml b/ci-scripts/xml_files/fr1_nsa_quectel_attach_detach.xml
new file mode 100644
index 0000000000..2263f731c5
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_nsa_quectel_attach_detach.xml
@@ -0,0 +1,168 @@
+
+
+ TEST-NSA-FR1-TM1
+ NSA Ping Attach Detach with QUECTEL
+ tasks
+ 1
+
+ 030000
+ 040000
+ 000002
+ 010000
+ 000001
+ 050000
+ 000001
+ 010004
+ 000001
+ 010003
+ 000001
+ 050000
+ 000001
+ 010004
+ 000001
+ 010003
+ 000001
+ 050000
+ 000001
+ 010002
+ 080001
+ 080000
+
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ idefix
+ yes
+
+
+
+
+ Terminate_UE
+ Terminate Quectel
+ idefix
+
+
+
+ Attach_UE
+ Attach Quectel
+ idefix
+
+
+
+ Detach_UE
+ Detach Quectel
+ idefix
+
+
+
+
+ Initialize_eNB
+ Initialize eNB
+ -O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf
+ 0
+ 0
+ lte
+ yes
+
+
+
+
+ Initialize_eNB
+ Initialize gNB
+ -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q
+ 1
+ 1
+ nr
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 20
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ idefix
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ idefix
+ -c 100 -i 0.2
+ 50
+
+
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 20M -t 60
+ DL
+ idefix
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 3M -t 60
+ UL
+ idefix
+ 50
+ single-ue
+
+
+
+
+ Terminate_eNB
+ Terminate eNB
+ 0
+ 0
+ lte
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ 1
+ 1
+ nr
+
+
+
+
diff --git a/ci-scripts/xml_files/fr1_ran_ue_base.xml b/ci-scripts/xml_files/fr1_nsa_quectel_long.xml
similarity index 78%
rename from ci-scripts/xml_files/fr1_ran_ue_base.xml
rename to ci-scripts/xml_files/fr1_nsa_quectel_long.xml
index 847967f81e..21ff7a63c5 100644
--- a/ci-scripts/xml_files/fr1_ran_ue_base.xml
+++ b/ci-scripts/xml_files/fr1_nsa_quectel_long.xml
@@ -21,49 +21,40 @@
-->
- TEST-FR1-TM1
- FR1
+ TEST-NSA-FR1-TM1
+ NSA Ping DL UL with QUECTEL (Longer)
tasks
+ 1
- 010000
030000
040000
- 010001
+ 000002
+ 010000
000001
050000
050001
- 050002
- 050002
000001
- 060000
- 060001
- 000001
- 010002
+ 070000
000001
070001
- 070000
- 010003
+ 000001
+ 010002
+ 080001
+ 080000
Initialize_UE
- Initialize UE
+ Initialize Quectel
+ idefix
-
- Terminate_UE
- Terminate UE
-
-
-
- Attach_UE
- Attach UE
-
- Detach_UE
- Detach UE
+ Terminate_UE
+ Terminate Quectel
+ idefix
@@ -74,63 +65,70 @@
0
0
lte
-
+ yes
+
Initialize_eNB
Initialize gNB
- -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E
+ -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q
1
1
nr
+ IdleSleep
+ Sleep
+ 5
+
+
+
IdleSleep
Sleep
20
+
Ping
Ping: 20pings in 20sec
+ idefix
-c 20
50
- Ping
- Ping: 5pings in 1sec
- -c 5 -i 0.2
- 50
-
-
-
Ping
Ping: 100pings in 20sec
+ idefix
-c 100 -i 0.2
50
-
-
- Iperf
- iperf (DL/1Mbps/UDP)(30 sec)(single-ue profile)
- -u -b 1M -t 30 -i 1
- 50
- single-ue
-
-
-
- Iperf
- iperf (UL/1Mbps/UDP)(30 sec)(single-ue profile)
- -u -b 1M -t 30 -i 1 -R
- 50
- single-ue
-
-
+ Iperf
+ iperf (DL/20Mbps/UDP)(600 sec)(single-ue profile)
+ -u -b 20M -t 600
+ DL
+ idefix
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(600 sec)(single-ue profile)
+ -u -b 3M -t 600
+ UL
+ idefix
+ 50
+ single-ue
+
+
+
+
Terminate_eNB
Terminate eNB
0
@@ -138,7 +136,7 @@
lte
-
+
Terminate_eNB
Terminate gNB
1
diff --git a/ci-scripts/xml_files/fr1_sa_quectel.xml b/ci-scripts/xml_files/fr1_sa_quectel.xml
new file mode 100644
index 0000000000..4c8fba0611
--- /dev/null
+++ b/ci-scripts/xml_files/fr1_sa_quectel.xml
@@ -0,0 +1,125 @@
+
+
+ TEST-SA-FR1-TM1
+ SA Ping DL UL with QUECTEL
+ tasks
+ 1
+
+ 040000
+ 000002
+ 010000
+ 000001
+ 050000
+ 000001
+ 010002
+ 080000
+
+
+
+
+ Initialize_UE
+ Initialize Quectel
+ nrmodule2_quectel
+ yes
+
+
+
+
+ Terminate_UE
+ Terminate Quectel
+ nrmodule2_quectel
+
+
+
+
+ Initialize_eNB
+ Initialize gNB
+ -O ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf --sa -q
+ 0
+ 0
+ nr
+ yes
+ 192.168.18.240
+
+
+
+ IdleSleep
+ Sleep
+ 5
+
+
+
+ IdleSleep
+ Sleep
+ 20
+
+
+
+
+ Ping
+ Ping: 20pings in 20sec
+ nrmodule2_quectel
+ -c 20
+ 50
+
+
+
+ Ping
+ Ping: 100pings in 20sec
+ nrmodule2_quectel
+ -c 100 -i 0.2
+ 50
+
+
+
+ Iperf
+ iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 20M -t 60
+ DL
+ nrmodule2_quectel
+ 50
+ single-ue
+
+
+
+ Iperf
+ iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 3M -t 60
+ UL
+ nrmodule2_quectel
+ 50
+ single-ue
+
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ 0
+ 0
+ nr
+
+
+
+
diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml
new file mode 100644
index 0000000000..9e798afdc4
--- /dev/null
+++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml
@@ -0,0 +1,53 @@
+
+
+ gNB-PHY-Test
+ Run-gNB-PHY-Test
+ tasks
+ 3
+
+090101 000001 090109
+
+
+
+
+ Initialize_eNB
+ Initialize gNB USRP
+ -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106
+ NR
+
+
+
+ IdleSleep
+ Sleep
+ 300
+
+
+
+
+ Terminate_eNB
+ Terminate gNB
+ NR
+
+
+
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml
index ab221c918d..d383dbb61b 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band40_build.xml
@@ -33,7 +33,7 @@
Build_eNB
Build eNB (USRP -- Ethernet Fronthaul)
- -w USRP -c --eNB
+ -w USRP -c --eNB --ninja
diff --git a/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml b/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml
index ab221c918d..d383dbb61b 100644
--- a/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml
+++ b/ci-scripts/xml_files/if4p5_usrp210_band7_build.xml
@@ -33,7 +33,7 @@
Build_eNB
Build eNB (USRP -- Ethernet Fronthaul)
- -w USRP -c --eNB
+ -w USRP -c --eNB --ninja
diff --git a/ci-scripts/xml_files/multi_rru_band38_build.xml b/ci-scripts/xml_files/multi_rru_band38_build.xml
index ba45eab10a..1370a3a396 100644
--- a/ci-scripts/xml_files/multi_rru_band38_build.xml
+++ b/ci-scripts/xml_files/multi_rru_band38_build.xml
@@ -26,7 +26,7 @@
wrench
010101 010102 010103
- 000101 000102 000103
+ 000102 000103 000101
@@ -50,7 +50,7 @@
Build_eNB
Build Master RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
1
1
True
@@ -59,7 +59,7 @@
WaitEndBuild_eNB
Wait for end of Build Master RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
1
1
@@ -67,7 +67,7 @@
Build_eNB
Build Slave RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
2
2
True
@@ -76,7 +76,7 @@
WaitEndBuild_eNB
Wait for end of Build Slave RRU
- -w USRP -c --eNB --ninja
+ -w USRP -c --RU --ninja
2
2
diff --git a/ci-scripts/xml_files/physim_deploy_run.xml b/ci-scripts/xml_files/physim_deploy_run.xml
new file mode 100644
index 0000000000..63152c1fb5
--- /dev/null
+++ b/ci-scripts/xml_files/physim_deploy_run.xml
@@ -0,0 +1,37 @@
+
+
+ build-tab
+ Physical Simulators Check
+ wrench
+
+ 010201
+
+
+
+
+ Deploy_Run_PhySim
+ Deploy and run physical simulator on openshift
+
+
+
diff --git a/ci-scripts/xml_files/sa_cn5g_closure.xml b/ci-scripts/xml_files/sa_cn5g_closure.xml
new file mode 100644
index 0000000000..7174da3b7b
--- /dev/null
+++ b/ci-scripts/xml_files/sa_cn5g_closure.xml
@@ -0,0 +1,37 @@
+
+
+ cn5g-closure
+ CN5G-Closure
+ log-out
+
+060000
+
+
+
+
+ Terminate_5GCN
+ Terminate 5G Core
+
+
+
diff --git a/ci-scripts/xml_files/sa_cn5g_start.xml b/ci-scripts/xml_files/sa_cn5g_start.xml
new file mode 100644
index 0000000000..a524610569
--- /dev/null
+++ b/ci-scripts/xml_files/sa_cn5g_start.xml
@@ -0,0 +1,38 @@
+
+
+ cn5g-start-tab
+ CN5G-Start
+ log-in
+
+ 000100
+
+
+
+
+
+ Initialize_5GCN
+ Initialize 5G Core
+
+
+
diff --git a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_build.xml b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_build.xml
index c5a912a33d..0ac6bfcc0d 100644
--- a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_build.xml
+++ b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_build.xml
@@ -42,7 +42,7 @@
Build_eNB
Build Slave eNB (USRP)
- -w USRP -c --eNB
+ -w USRP -c --eNB --ninja
1
1
diff --git a/ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml b/ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml
new file mode 100644
index 0000000000..d8be6679b1
--- /dev/null
+++ b/ci-scripts/yaml_files/4g_rfsimulator/docker-compose.yml
@@ -0,0 +1,272 @@
+version: '3.8'
+
+services:
+ cassandra:
+ image: cassandra:2.1
+ container_name: rfsim4g-cassandra
+ networks:
+ private_net:
+ ipv4_address: 192.168.68.2
+ environment:
+ CASSANDRA_CLUSTER_NAME: "OAI HSS Cluster"
+ CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
+ healthcheck:
+ test: /bin/bash -c "nodetool status"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ db_init:
+ image: cassandra:2.1
+ container_name: rfsim4g-db-init
+ depends_on: [cassandra]
+ deploy:
+ restart_policy:
+ condition: on-failure
+ max_attempts: 10
+ networks:
+ private_net:
+ ipv4_address: 192.168.68.4
+ volumes:
+ - ./oai_db.cql:/home/oai_db.cql
+ entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'"
+
+ oai_hss:
+ image: oai-hss:develop-2021-06-14
+ container_name: rfsim4g-oai-hss
+ privileged: true
+ depends_on: [cassandra]
+ networks:
+ private_net:
+ ipv4_address: 192.168.68.3
+ public_net:
+ ipv4_address: 192.168.61.2
+ environment:
+ REALM: openairinterface.org
+ HSS_FQDN: hss.openairinterface.org
+ PREFIX: /openair-hss/etc
+ cassandra_Server_IP: 192.168.68.2
+ OP_KEY: 1006020f0a478bf6b699f15c062e42b3
+ LTE_K: fec86ba6eb707ed08905757b1bb44b8f
+ APN1: oai.ipv4
+ APN2: internet
+ FIRST_IMSI: 208960100000001
+ NB_USERS: 10
+ healthcheck:
+ test: /bin/bash -c "pgrep oai_hss"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ oai_mme:
+ image: oai-mme:production
+ container_name: rfsim4g-oai-mme
+ privileged: true
+ depends_on: [oai_hss]
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.3
+ environment:
+ REALM: openairinterface.org
+ PREFIX: /openair-mme/etc
+ INSTANCE: 1
+ PID_DIRECTORY: /var/run
+ HSS_IP_ADDR: 192.168.61.2
+ HSS_HOSTNAME: hss
+ HSS_FQDN: hss.openairinterface.org
+ HSS_REALM: openairinterface.org
+ MCC: '208'
+ MNC: '96'
+ MME_GID: 32768
+ MME_CODE: 3
+ TAC_0: 1
+ TAC_1: 2
+ TAC_2: 3
+ MME_FQDN: mme.openairinterface.org
+ MME_S6A_IP_ADDR: 192.168.61.3
+ MME_INTERFACE_NAME_FOR_S1_MME: eth0
+ MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3
+ MME_INTERFACE_NAME_FOR_S11: eth0
+ MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3
+ MME_INTERFACE_NAME_FOR_S10: lo
+ MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10
+ OUTPUT: CONSOLE
+ SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4
+ PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0
+ PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0
+ MCC_SGW_0: '208'
+ MNC3_SGW_0: '096'
+ TAC_LB_SGW_0: '01'
+ TAC_HB_SGW_0: '00'
+ MCC_MME_0: '208'
+ MNC3_MME_0: '096'
+ TAC_LB_MME_0: '02'
+ TAC_HB_MME_0: '00'
+ MCC_MME_1: '208'
+ MNC3_MME_1: '096'
+ TAC_LB_MME_1: '03'
+ TAC_HB_MME_1: '00'
+ TAC_LB_SGW_TEST_0: '03'
+ TAC_HB_SGW_TEST_0: '00'
+ SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0
+ healthcheck:
+ test: /bin/bash -c "pgrep oai_mme"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ oai_spgwc:
+ image: oai-spgwc:develop-2021-06-14
+ privileged: true
+ depends_on: [oai_mme]
+ container_name: rfsim4g-oai-spgwc
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.4
+ environment:
+ TZ: Europe/Paris
+ SGW_INTERFACE_NAME_FOR_S11: eth0
+ PGW_INTERFACE_NAME_FOR_SX: eth0
+ DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129
+ DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4
+ PUSH_PROTOCOL_OPTION: 'true'
+ APN_NI_1: oai.ipv4
+ APN_NI_2: oai.ipv4_2
+ DEFAULT_APN_NI_1: oai.ipv4
+ UE_IP_ADDRESS_POOL_1: '12.0.0.2 - 12.0.0.254'
+ UE_IP_ADDRESS_POOL_2: '12.1.1.2 - 12.1.1.254'
+ MCC: '208'
+ MNC: '96'
+ MNC03: '096'
+ TAC: 1
+ GW_ID: 1
+ REALM: openairinterface.org
+ healthcheck:
+ test: /bin/bash -c "pgrep oai_spgwc"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ oai_spgwu:
+ image: oai-spgwu-tiny:develop-2021-06-14
+ privileged: true
+ container_name: rfsim4g-oai-spgwu-tiny
+ depends_on: [oai_spgwc]
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.5
+ environment:
+ TZ: Europe/Paris
+ PID_DIRECTORY: /var/run
+ INSTANCE: 1
+ SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0
+ PGW_INTERFACE_NAME_FOR_SGI: eth0
+ SGW_INTERFACE_NAME_FOR_SX: eth0
+ SPGWC0_IP_ADDRESS: 192.168.61.4
+ NETWORK_UE_IP: '12.0.0.0/24'
+ NETWORK_UE_NAT_OPTION: 'yes'
+ MCC: '208'
+ MNC: '96'
+ MNC03: '096'
+ TAC: 1
+ GW_ID: 1
+ REALM: openairinterface.org
+ healthcheck:
+ test: /bin/bash -c "pgrep oai_spgwu"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ flexran_rtc:
+ image: flexran-rtc:production
+ privileged: true
+ container_name: rfsim4g-flexran-rtc
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.10
+ healthcheck:
+ test: /bin/bash -c "pgrep rt_controller"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ trf_gen:
+ image: trf-gen:production
+ privileged: true
+ container_name: rfsim4g-trf-gen
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.11
+ entrypoint: /bin/bash -c "ip route add 12.0.0.0/24 via 192.168.61.5 dev eth0; sleep infinity"
+ healthcheck:
+ test: /bin/bash -c "ping -c 2 192.168.61.5"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ enb:
+ image: oai-enb:develop
+ privileged: true
+ container_name: rfsim4g-oai-enb
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.20
+ environment:
+ TZ: Europe/Paris
+ USE_FDD_MONO: 'yes'
+ RFSIMULATOR: enb
+ ENB_NAME: eNB-rf-sim
+ MCC: '208'
+ MNC: '96'
+ MNC_LENGTH: 2
+ TAC: 1
+ UTRA_BAND_ID: 7
+ DL_FREQUENCY_IN_MHZ: 2680
+ UL_FREQUENCY_OFFSET_IN_MHZ: 120
+ NID_CELL: 10
+ NB_PRB: 25
+ MME_S1C_IP_ADDRESS: 192.168.61.3
+ ENB_S1C_IF_NAME: eth0
+ ENB_S1C_IP_ADDRESS: 192.168.61.20
+ ENB_S1U_IF_NAME: eth0
+ ENB_S1U_IP_ADDRESS: 192.168.61.20
+ ENB_X2_IP_ADDRESS: 192.168.61.20
+ FLEXRAN_ENABLED: 'no'
+ FLEXRAN_INTERFACE_NAME: eth0
+ FLEXRAN_IPV4_ADDRESS: 192.168.61.10
+ USE_ADDITIONAL_OPTIONS: --rfsim
+
+ oai_ue0:
+ image: oai-lte-ue:develop
+ privileged: true
+ container_name: rfsim4g-oai-lte-ue0
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.30
+ expose:
+ - "10000"
+ environment:
+ TZ: Europe/Paris
+ HOSTNAME: oai_ue0
+ RFSIMULATOR: 192.168.61.20
+ MCC: '208'
+ MNC: '96'
+ SHORT_IMSI: '0100000001'
+ LTE_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'
+ OPC: 'c42449363bbad02b66d16bc975d77cc1'
+ MSISDN: '001011234561010'
+ HPLMN: 20896
+ USE_ADDITIONAL_OPTIONS: --rfsim -C 2680000000 -r 25 --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1
+
+networks:
+ private_net:
+ name: rfsim4g-oai-private-net
+ ipam:
+ config:
+ - subnet: 192.168.68.0/26
+ public_net:
+ name: rfsim4g-oai-public-net
+ ipam:
+ config:
+ - subnet: 192.168.61.0/26
+
diff --git a/ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql b/ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql
new file mode 100644
index 0000000000..2be0a8e2e9
--- /dev/null
+++ b/ci-scripts/yaml_files/4g_rfsimulator/oai_db.cql
@@ -0,0 +1,93 @@
+CREATE KEYSPACE IF NOT EXISTS vhss WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '1'};
+
+CREATE TABLE IF NOT EXISTS vhss.users_imsi (
+ imsi text PRIMARY KEY,
+ access_restriction int,
+ idmmeidentity int,
+ imei text,
+ imei_sv text,
+ key text,
+ lipa_permissions text,
+ mme_cap int,
+ mmehost text,
+ mmeidentity_idmmeidentity int,
+ mmerealm text,
+ ms_ps_status text,
+ msisdn bigint,
+ niddvalidity text,
+ nir_dest_host text,
+ nir_dest_realm text,
+ opc text,
+ pgw_id int,
+ rand text,
+ rfsp_index varint,
+ sqn bigint,
+ subscription_data text,
+ ue_reachability varint,
+ urrp_mme varint,
+ user_identifier text,
+ visited_plmnid text);
+
+CREATE TABLE IF NOT EXISTS vhss.msisdn_imsi (
+ msisdn bigint PRIMARY KEY,
+ imsi text
+);
+
+CREATE TABLE IF NOT EXISTS vhss.global_ids (
+ table_name text PRIMARY KEY,
+ id counter);
+
+CREATE TABLE IF NOT EXISTS vhss.mmeidentity_host (
+ mmehost text PRIMARY KEY,
+ idmmeidentity int,
+ mmerealm text,
+ ue_reachability varint,
+ mmeisdn text);
+
+CREATE TABLE IF NOT EXISTS vhss.mmeidentity (
+ idmmeidentity int PRIMARY KEY,
+ mmehost text,
+ mmerealm text,
+ ue_reachability varint,
+ mmeisdn text);
+
+CREATE TABLE IF NOT EXISTS vhss.events (
+ scef_id text,
+ scef_ref_id bigint,
+ extid text,
+ monitoring_event_configuration text,
+ monitoring_type int,
+ msisdn bigint,
+ user_identifier text,
+ primary key (scef_id, scef_ref_id)
+);
+
+CREATE TABLE IF NOT EXISTS vhss.events_msisdn (
+ msisdn bigint,
+ scef_id text,
+ scef_ref_id bigint,
+ primary key (msisdn, scef_id, scef_ref_id)
+);
+
+CREATE TABLE IF NOT EXISTS vhss.events_extid (
+ extid text,
+ scef_id text,
+ scef_ref_id bigint,
+ primary key (extid, scef_id, scef_ref_id)
+);
+
+CREATE TABLE IF NOT EXISTS vhss.extid (
+ extid text primary key
+);
+
+CREATE TABLE IF NOT EXISTS vhss.extid_imsi (
+ extid text,
+ imsi text,
+ primary key (extid, imsi)
+);
+
+CREATE TABLE IF NOT EXISTS vhss.extid_imsi_xref (
+ imsi text,
+ extid text,
+ primary key (imsi, extid)
+);
diff --git a/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml
index 28ae154838..73a6b3a1ff 100644
--- a/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml
+++ b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml
@@ -40,18 +40,19 @@ services:
private_net:
ipv4_address: 192.168.68.3
public_net:
- ipv4_address: 192.168.61.2
+ ipv4_address: 192.168.61.194
environment:
+ TZ: Europe/Paris
REALM: openairinterface.org
HSS_FQDN: hss.openairinterface.org
PREFIX: /openair-hss/etc
cassandra_Server_IP: 192.168.68.2
OP_KEY: 1006020f0a478bf6b699f15c062e42b3
- LTE_K: fec86ba6eb707ed08905757b1bb44b8f
+ LTE_K: FEC86BA6EB707ED08905757B1BB44B8F
APN1: oai.ipv4
- APN2: internet
- FIRST_IMSI: 222010100001120
- NB_USERS: 10
+ APN2: oai2.ipv4
+ FIRST_IMSI: 208990100001127
+ NB_USERS: 5
healthcheck:
test: /bin/bash -c "pgrep oai_hss"
interval: 10s
@@ -65,45 +66,46 @@ services:
depends_on: [oai_hss]
networks:
public_net:
- ipv4_address: 192.168.61.3
+ ipv4_address: 192.168.61.195
environment:
+ TZ: Europe/Paris
REALM: openairinterface.org
PREFIX: /openair-mme/etc
INSTANCE: 1
PID_DIRECTORY: /var/run
- HSS_IP_ADDR: 192.168.61.2
+ HSS_IP_ADDR: 192.168.61.194
HSS_HOSTNAME: hss
HSS_FQDN: hss.openairinterface.org
HSS_REALM: openairinterface.org
- MCC: '222'
- MNC: '01'
+ MCC: '208'
+ MNC: '99'
MME_GID: 32768
MME_CODE: 3
TAC_0: 1
TAC_1: 2
TAC_2: 3
MME_FQDN: mme.openairinterface.org
- MME_S6A_IP_ADDR: 192.168.61.3
+ MME_S6A_IP_ADDR: 192.168.61.195
MME_INTERFACE_NAME_FOR_S1_MME: eth0
- MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3
+ MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.195
MME_INTERFACE_NAME_FOR_S11: eth0
- MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3
+ MME_IPV4_ADDRESS_FOR_S11: 192.168.61.195
MME_INTERFACE_NAME_FOR_S10: lo
MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10
OUTPUT: CONSOLE
- SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4
+ SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.196
PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0
PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0
- MCC_SGW_0: '222'
- MNC3_SGW_0: '001'
+ MCC_SGW_0: '208'
+ MNC3_SGW_0: '099'
TAC_LB_SGW_0: '01'
TAC_HB_SGW_0: '00'
- MCC_MME_0: '222'
- MNC3_MME_0: '001'
+ MCC_MME_0: '208'
+ MNC3_MME_0: '099'
TAC_LB_MME_0: '02'
TAC_HB_MME_0: '00'
- MCC_MME_1: '222'
- MNC3_MME_1: '001'
+ MCC_MME_1: '208'
+ MNC3_MME_1: '099'
TAC_LB_MME_1: '03'
TAC_HB_MME_1: '00'
TAC_LB_SGW_TEST_0: '03'
@@ -122,18 +124,25 @@ services:
container_name: prod-oai-spgwc
networks:
public_net:
- ipv4_address: 192.168.61.4
+ ipv4_address: 192.168.61.196
environment:
- PID_DIRECTORY: /var/run
+ TZ: Europe/Paris
SGW_INTERFACE_NAME_FOR_S11: eth0
- SGW_IP_FOR_S5_S8_CP: 127.0.0.11/8
- PGW_IP_FOR_S5_S8_CP: 127.0.0.12/8
PGW_INTERFACE_NAME_FOR_SX: eth0
- DEFAULT_APN: oai.ipv4
DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129
DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4
- UE_IP_ADDRESS_POOL: '12.1.1.2 - 12.1.1.254'
- PUSH_PROTOCOL_OPTION: 'yes'
+ PUSH_PROTOCOL_OPTION: 'true'
+ APN_NI_1: oai.ipv4
+ APN_NI_2: oai2.ipv4
+ DEFAULT_APN_NI_1: oai.ipv4
+ UE_IP_ADDRESS_POOL_1: '12.1.1.2 - 12.1.1.254'
+ UE_IP_ADDRESS_POOL_2: '12.0.0.2 - 12.0.0.254'
+ MCC: '208'
+ MNC: '99'
+ MNC03: '099'
+ TAC: 1
+ GW_ID: 1
+ REALM: openairinterface.org
healthcheck:
test: /bin/bash -c "pgrep oai_spgwc"
interval: 10s
@@ -147,45 +156,39 @@ services:
depends_on: [oai_spgwc]
networks:
public_net:
- ipv4_address: 192.168.61.5
+ ipv4_address: 192.168.61.197
environment:
+ TZ: Europe/Paris
PID_DIRECTORY: /var/run
INSTANCE: 1
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0
PGW_INTERFACE_NAME_FOR_SGI: eth0
SGW_INTERFACE_NAME_FOR_SX: eth0
- SPGWC0_IP_ADDRESS: 192.168.61.4
+ SPGWC0_IP_ADDRESS: 192.168.61.196
NETWORK_UE_IP: '12.1.1.0/24'
NETWORK_UE_NAT_OPTION: 'yes'
+ MCC: '208'
+ MNC: '99'
+ MNC03: '099'
+ TAC: 1
+ GW_ID: 1
+ REALM: openairinterface.org
healthcheck:
test: /bin/bash -c "pgrep oai_spgwu"
interval: 10s
timeout: 5s
retries: 5
- flexran_rtc:
- image: flexran-rtc:production
- privileged: true
- container_name: prod-flexran-rtc
- networks:
- public_net:
- ipv4_address: 192.168.61.10
- healthcheck:
- test: /bin/bash -c "pgrep rt_controller"
- interval: 10s
- timeout: 5s
- retries: 5
-
trf_gen:
image: trf-gen:production
privileged: true
container_name: prod-trf-gen
networks:
public_net:
- ipv4_address: 192.168.61.11
- entrypoint: /bin/bash -c "ip route add 12.1.1.0/24 via 192.168.61.5 dev eth0; sleep infinity"
+ ipv4_address: 192.168.61.200
+ entrypoint: /bin/bash -c "ip route add 12.1.1.0/24 via 192.168.61.197 dev eth0; sleep infinity"
healthcheck:
- test: /bin/bash -c "ping -c 2 192.168.61.5"
+ test: /bin/bash -c "ping -c 2 192.168.61.197"
interval: 10s
timeout: 5s
retries: 5
@@ -200,4 +203,4 @@ networks:
name: prod-oai-public-net
ipam:
config:
- - subnet: 192.168.61.0/26
+ - subnet: 192.168.61.192/26
diff --git a/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml.orig b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml.orig
new file mode 100644
index 0000000000..28ae154838
--- /dev/null
+++ b/ci-scripts/yaml_files/fr1_epc_tim/docker-compose.yml.orig
@@ -0,0 +1,203 @@
+version: '3.8'
+
+services:
+ cassandra:
+ image: cassandra:2.1
+ container_name: prod-cassandra
+ networks:
+ private_net:
+ ipv4_address: 192.168.68.2
+ environment:
+ CASSANDRA_CLUSTER_NAME: "OAI HSS Cluster"
+ CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
+ healthcheck:
+ test: /bin/bash -c "nodetool status"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ db_init:
+ image: cassandra:2.1
+ container_name: prod-db-init
+ depends_on: [cassandra]
+ deploy:
+ restart_policy:
+ condition: on-failure
+ max_attempts: 10
+ networks:
+ private_net:
+ ipv4_address: 192.168.68.4
+ volumes:
+ - ./oai_db.cql:/home/oai_db.cql
+ entrypoint: /bin/bash -c "cqlsh --file /home/oai_db.cql 192.168.68.2 && echo 'OK'"
+
+ oai_hss:
+ image: oai-hss:production
+ container_name: prod-oai-hss
+ privileged: true
+ depends_on: [cassandra]
+ networks:
+ private_net:
+ ipv4_address: 192.168.68.3
+ public_net:
+ ipv4_address: 192.168.61.2
+ environment:
+ REALM: openairinterface.org
+ HSS_FQDN: hss.openairinterface.org
+ PREFIX: /openair-hss/etc
+ cassandra_Server_IP: 192.168.68.2
+ OP_KEY: 1006020f0a478bf6b699f15c062e42b3
+ LTE_K: fec86ba6eb707ed08905757b1bb44b8f
+ APN1: oai.ipv4
+ APN2: internet
+ FIRST_IMSI: 222010100001120
+ NB_USERS: 10
+ healthcheck:
+ test: /bin/bash -c "pgrep oai_hss"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ oai_mme:
+ image: oai-mme:production
+ container_name: prod-oai-mme
+ privileged: true
+ depends_on: [oai_hss]
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.3
+ environment:
+ REALM: openairinterface.org
+ PREFIX: /openair-mme/etc
+ INSTANCE: 1
+ PID_DIRECTORY: /var/run
+ HSS_IP_ADDR: 192.168.61.2
+ HSS_HOSTNAME: hss
+ HSS_FQDN: hss.openairinterface.org
+ HSS_REALM: openairinterface.org
+ MCC: '222'
+ MNC: '01'
+ MME_GID: 32768
+ MME_CODE: 3
+ TAC_0: 1
+ TAC_1: 2
+ TAC_2: 3
+ MME_FQDN: mme.openairinterface.org
+ MME_S6A_IP_ADDR: 192.168.61.3
+ MME_INTERFACE_NAME_FOR_S1_MME: eth0
+ MME_IPV4_ADDRESS_FOR_S1_MME: 192.168.61.3
+ MME_INTERFACE_NAME_FOR_S11: eth0
+ MME_IPV4_ADDRESS_FOR_S11: 192.168.61.3
+ MME_INTERFACE_NAME_FOR_S10: lo
+ MME_IPV4_ADDRESS_FOR_S10: 127.0.0.10
+ OUTPUT: CONSOLE
+ SGW_IPV4_ADDRESS_FOR_S11_0: 192.168.61.4
+ PEER_MME_IPV4_ADDRESS_FOR_S10_0: 0.0.0.0
+ PEER_MME_IPV4_ADDRESS_FOR_S10_1: 0.0.0.0
+ MCC_SGW_0: '222'
+ MNC3_SGW_0: '001'
+ TAC_LB_SGW_0: '01'
+ TAC_HB_SGW_0: '00'
+ MCC_MME_0: '222'
+ MNC3_MME_0: '001'
+ TAC_LB_MME_0: '02'
+ TAC_HB_MME_0: '00'
+ MCC_MME_1: '222'
+ MNC3_MME_1: '001'
+ TAC_LB_MME_1: '03'
+ TAC_HB_MME_1: '00'
+ TAC_LB_SGW_TEST_0: '03'
+ TAC_HB_SGW_TEST_0: '00'
+ SGW_IPV4_ADDRESS_FOR_S11_TEST_0: 0.0.0.0
+ healthcheck:
+ test: /bin/bash -c "pgrep oai_mme"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ oai_spgwc:
+ image: oai-spgwc:production
+ privileged: true
+ depends_on: [oai_mme]
+ container_name: prod-oai-spgwc
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.4
+ environment:
+ PID_DIRECTORY: /var/run
+ SGW_INTERFACE_NAME_FOR_S11: eth0
+ SGW_IP_FOR_S5_S8_CP: 127.0.0.11/8
+ PGW_IP_FOR_S5_S8_CP: 127.0.0.12/8
+ PGW_INTERFACE_NAME_FOR_SX: eth0
+ DEFAULT_APN: oai.ipv4
+ DEFAULT_DNS_IPV4_ADDRESS: 192.168.18.129
+ DEFAULT_DNS_SEC_IPV4_ADDRESS: 8.8.4.4
+ UE_IP_ADDRESS_POOL: '12.1.1.2 - 12.1.1.254'
+ PUSH_PROTOCOL_OPTION: 'yes'
+ healthcheck:
+ test: /bin/bash -c "pgrep oai_spgwc"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ oai_spgwu:
+ image: oai-spgwu-tiny:production
+ privileged: true
+ container_name: prod-oai-spgwu-tiny
+ depends_on: [oai_spgwc]
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.5
+ environment:
+ PID_DIRECTORY: /var/run
+ INSTANCE: 1
+ SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP: eth0
+ PGW_INTERFACE_NAME_FOR_SGI: eth0
+ SGW_INTERFACE_NAME_FOR_SX: eth0
+ SPGWC0_IP_ADDRESS: 192.168.61.4
+ NETWORK_UE_IP: '12.1.1.0/24'
+ NETWORK_UE_NAT_OPTION: 'yes'
+ healthcheck:
+ test: /bin/bash -c "pgrep oai_spgwu"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ flexran_rtc:
+ image: flexran-rtc:production
+ privileged: true
+ container_name: prod-flexran-rtc
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.10
+ healthcheck:
+ test: /bin/bash -c "pgrep rt_controller"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ trf_gen:
+ image: trf-gen:production
+ privileged: true
+ container_name: prod-trf-gen
+ networks:
+ public_net:
+ ipv4_address: 192.168.61.11
+ entrypoint: /bin/bash -c "ip route add 12.1.1.0/24 via 192.168.61.5 dev eth0; sleep infinity"
+ healthcheck:
+ test: /bin/bash -c "ping -c 2 192.168.61.5"
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+networks:
+ private_net:
+ name: prod-oai-private-net
+ ipam:
+ config:
+ - subnet: 192.168.68.0/26
+ public_net:
+ name: prod-oai-public-net
+ ipam:
+ config:
+ - subnet: 192.168.61.0/26
diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 9d60631bc3..52f0e60663 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -45,6 +45,8 @@ include_directories(${CONFIG_INCLUDE_DIRS})
pkg_search_module(CRYPTO libcrypto REQUIRED)
include_directories(${CRYPTO_INCLUDE_DIRS})
+#uhd 4.0 and iris installs by default in /usr/local
+include_directories("/usr/local/include/")
#use native cmake method as this package is not in pkg-config
if (${RF_BOARD} STREQUAL "OAI_USRP")
find_package(Boost REQUIRED)
@@ -52,7 +54,7 @@ if (${RF_BOARD} STREQUAL "OAI_USRP")
elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/")
- include_directories("/usr/local/include/")
+
set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp)
LINK_DIRECTORIES("/usr/local/lib")
@@ -60,6 +62,8 @@ elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
endif (${RF_BOARD} STREQUAL "OAI_USRP")
+message("RU=${RU}")
+
pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2)
if(NOT ${OPENPGM_FOUND})
message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built")
@@ -316,7 +320,7 @@ if (CUDA_FOUND)
set(CUDA_CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -Werror -fno-strict-aliasing -rdynamic -std=c++11 -D CUDA_FLAG"
)
-
+
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER} -D CUDA_FLAG"
)
@@ -334,14 +338,10 @@ else (CUDA_FOUND)
endif ()
if (SANITIZE_ADDRESS)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-common")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-common")
endif ()
-# Uncomment these lines to enable gprof profiling
-#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg -DUSING_GPROF")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -DUSING_GPROF")
-
add_definitions("-DASN_DISABLE_OER_SUPPORT")
#########################
@@ -349,7 +349,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
#########################
# set a flag for changes in the source code
# these changes are related to hardcoded path to include .h files
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 -DMALLOC_CHECK_=3")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -Og -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3")
@@ -426,7 +426,6 @@ add_library(ITTI
)
add_dependencies(ITTI rrc_flag)
set(ITTI_LIB ITTI)
- set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
##################################################
@@ -443,7 +442,6 @@ set(asn1_generated_dir ${OPENAIR_BIN_DIR})
set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf")
set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
-
# RRC
######
set (RRC_ASN1_VERSION "Rel15")
@@ -454,15 +452,18 @@ add_definitions(-DLTE_RRC_VERSION=${LTE_RRC_VERSION})
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
- RESULT_VARIABLE ret)
+if (${RU} STREQUAL 0)
+ execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "LTE_" " " "${RRC_FULL_DIR}" "${RRC_GRAMMAR}"
+ RESULT_VARIABLE ret)
+endif (${RU} STREQUAL 0)
+
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
add_custom_target (
rrc_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_"
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "LTE_" " " "${RRC_FULL_DIR}" "${RRC_GRAMMAR}"
DEPENDS ${RRC_GRAMMAR}
)
@@ -483,20 +484,22 @@ add_definitions(-DNR_RRC_VERSION=${NR_RRC_VERSION})
set (NR_RRC_FULL_DIR ${asn1_generated_dir}/RRC_${NR_RRC_ASN1_VERSION})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice"
- RESULT_VARIABLE ret)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NR_" "-findirect-choice" "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}"
+ RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif ()
file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c)
file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h)
+
add_custom_target (
nr_rrc_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice"
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NR_" "-findirect-choice" "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}"
DEPENDS ${NR_RRC_GRAMMAR}
)
-add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source}
+add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source}
${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c
)
add_dependencies(NR_RRC_LIB nr_rrc_flag)
@@ -517,18 +520,21 @@ set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${S1AP_RELEASE})
set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${S1AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
-file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
+if (${RU} STREQUAL 0)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "S1AP_" -fno-include-deps "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+ file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
+endif (${RU} STREQUAL 0)
-add_custom_target (
- s1ap_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps
- DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
-)
+ add_custom_target (
+ s1ap_flag ALL
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "S1AP_" -fno-include-deps "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
+ DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}"
+ )
add_library(S1AP_LIB
${S1AP_source}
@@ -571,8 +577,9 @@ set(NGAP_ASN_DIR ${NGAP_DIR}/MESSAGES/ASN1/ASN1_files)
set(NGAP_C_DIR ${asn1_generated_dir}/NGAP_${NGAP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" "NGAP_" -fno-include-deps -findirect-choice
- RESULT_VARIABLE ret)
+execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NGAP_" "-fno-include-deps -findirect-choice" "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}"
+ RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
@@ -580,8 +587,8 @@ file(GLOB NGAP_source ${NGAP_C_DIR}/*.c)
add_custom_target (
ngap_flag ALL
- ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" "NGAP_" -fno-include-deps
- DEPENDS "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}"
+ ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NGAP_" "-fno-include-deps -findirect-choice" "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}"
+ DEPENDS "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}"
)
add_library(NGAP_LIB
@@ -637,17 +644,20 @@ set(M2AP_ASN_DIR ${M2AP_DIR}/MESSAGES/ASN1/${M2AP_RELEASE})
set(M2AP_C_DIR ${asn1_generated_dir}/M2AP_${M2AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" "M2AP_" -fno-include-deps -DEMIT_ASN_DEBUG=1
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+if (${RU} STREQUAL 0)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps -DEMIT_ASN_DEBUG=1" "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}"
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB M2AP_source ${M2AP_C_DIR}/*.c)
add_custom_target (
m2_flag ALL
- COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" "M2AP_" -fno-include-deps
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps -DEMIT_ASN_DEBUG=1" "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}"
DEPENDS ${M2AP_ASN_DIR}/${M2AP_ASN_FILES}
)
@@ -707,17 +717,20 @@ set(M3AP_ASN_DIR ${M3AP_DIR}/MESSAGES/ASN1/${M3AP_RELEASE})
set(M3AP_C_DIR ${asn1_generated_dir}/M3AP_${M3AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" "M3AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+if (${RU} STREQUAL 0)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M3AP_" -fno-include-deps "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}"
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB M3AP_source ${M3AP_C_DIR}/*.c)
add_custom_target (
m3_flag ALL
- COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" "M3AP_" -fno-include-deps
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M3AP_" -fno-include-deps "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}"
DEPENDS ${M3AP_ASN_DIR}/${M3AP_ASN_FILES}
)
@@ -761,17 +774,20 @@ add_definitions(-DX2AP_VERSION=${X2AP_VERSION})
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${X2AP_RELEASE})
set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${X2AP_RELEASE})
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
-execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps
- RESULT_VARIABLE ret)
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "${ret}: error")
-endif (NOT ${ret} STREQUAL 0)
+if (${RU} STREQUAL 0)
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "X2AP_" -fno-include-deps "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}"
+ RESULT_VARIABLE ret)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "${ret}: error")
+ endif (NOT ${ret} STREQUAL 0)
+endif (${RU} STREQUAL 0)
file(GLOB X2AP_source ${X2AP_C_DIR}/*.c)
add_custom_target (
x2_flag ALL
- COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "X2AP_" -fno-include-deps "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}"
DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
)
@@ -800,12 +816,13 @@ add_dependencies(X2AP_ENB X2AP_LIB rrc_flag x2_flag)
# F1AP
##############
-add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15)
+set (F1AP_RELEASE R16)
+add_list1_option(F1AP_RELEASE R16 "F1AP ASN.1 grammar version" R16)
set(F1AP_DIR ${OPENAIR2_DIR}/F1AP)
-if (${F1AP_RELEASE} STREQUAL "R15")
- make_version(F1AP_VERSION 15 2 1)
- set (ASN1RELDIR R15.2.1)
-endif(${F1AP_RELEASE} STREQUAL "R15")
+if (${F1AP_RELEASE} STREQUAL "R16")
+ make_version(F1AP_VERSION 16 3 1)
+ set (ASN1RELDIR R16.3.1)
+endif(${F1AP_RELEASE} STREQUAL "R16")
add_definitions(-DF1AP_VERSION=${F1AP_VERSION})
set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(F1AP_ASN_FILES
@@ -817,22 +834,28 @@ set(F1AP_ASN_FILES
${F1AP_ASN_DIR}/F1AP-Containers.asn
)
-set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
-message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}")
-execute_process(COMMAND mkdir -p ${F1AP_ASN_GENERATED_C_DIR}
- COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
- RESULT_VARIABLE ret
- OUTPUT_QUIET
- ERROR_QUIET)
+if (${RU} STREQUAL 0)
+ set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
+ message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}")
+ execute_process(
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
+ RESULT_VARIABLE ret
+ )
-if (NOT ${ret} STREQUAL 0)
- message(FATAL_ERROR "asn1c: error")
-endif (NOT ${ret} STREQUAL 0)
+ if (NOT ${ret} STREQUAL 0)
+ message(FATAL_ERROR "asn1c: error")
+ endif (NOT ${ret} STREQUAL 0)
-file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c)
-add_library(F1AP_LIB
- ${F1AP_ASN_GENERATED_C_FILES}
-)
+ add_custom_target (
+ f1_flag ALL
+ COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}
+ DEPENDS ${F1AP_ASN_FILES}
+ )
+ file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c)
+ add_library(F1AP_LIB
+ ${F1AP_ASN_GENERATED_C_FILES}
+ )
+ add_dependencies (F1AP_LIB f1_flag)
include_directories ("${F1AP_ASN_GENERATED_C_DIR}")
include_directories ("${F1AP_DIR}")
@@ -842,16 +865,15 @@ add_library(F1AP
${F1AP_C_FILES}
)
+endif (${RU} STREQUAL 0)
# Hardware dependant options
###################################
-add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
+add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU")
-
-
add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
#NOKIA config enhancement
set (CONFIG_ROOTDIR
@@ -939,6 +961,9 @@ set_target_properties(tcp_bridge_oai PROPERTIES COMPILE_FLAGS "-fvisibility=hidd
# Benetel 4G library
######################################################################
+
+include_directories ("/usr/include/dpdk")
+
set(HWLIB_BENETEL_4G_SOURCE
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/benetel.c
${OPENAIR_TARGETS}/ARCH/ETHERNET/benetel/4g/shared_buffers.c
@@ -1481,11 +1506,11 @@ add_dependencies(SCHED_UE_LIB rrc_flag)
set(SCHED_SRC_NR_UE
${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c
${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c
- ${OPENAIR1_DIR}/SCHED_NR_UE/fapi_nr_ue_l1.c
+ ${OPENAIR1_DIR}/SCHED_NR_UE/fapi_nr_ue_l1.c
${OPENAIR1_DIR}/SCHED_NR_UE/phy_frame_config_nr_ue.c
${OPENAIR1_DIR}/SCHED_NR_UE/harq_nr.c
${OPENAIR1_DIR}/SCHED_NR_UE/pucch_uci_ue_nr.c
- ${OPENAIR1_DIR}/SCHED_NR_UE/pucch_power_control_ue_nr.c
+ ${OPENAIR1_DIR}/SCHED_NR_UE/pucch_power_control_ue_nr.c
)
add_library(SCHED_NR_UE_LIB ${SCHED_SRC_NR_UE})
@@ -1645,7 +1670,6 @@ set(PHY_SRC_COMMON
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
${OPENAIR1_DIR}/PHY/INIT/init_top.c
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
- ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
${OPENAIR1_DIR}/PHY/TOOLS/dfts_load.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
@@ -1796,7 +1820,7 @@ set(PHY_SRC_UE
${PHY_POLARSRC}
${PHY_SMALLBLOCKSRC}
${PHY_NR_CODINGIF}
- ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/pucch_rx.c
+ ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/pucch_rx.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_uci_tools_common.c
)
set(PHY_NR_UE_SRC
@@ -1975,13 +1999,15 @@ set(NR_RLC_SRC
${OPENAIR2_DIR}/LAYER2/nr_rlc/nr_rlc_sdu.c
${OPENAIR2_DIR}/LAYER2/nr_rlc/nr_rlc_ue_manager.c
)
-
+
set(NR_PDCP_SRC
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity.c
- ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c
+ ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_sdu.c
+ ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c
+ ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
)
@@ -2000,12 +2026,13 @@ set(L2_SRC
${RRC_DIR}/rrc_eNB_S1AP.c
${RRC_DIR}/rrc_eNB_M2AP.c
${RRC_DIR}/rrc_eNB_UE_context.c
+ ${NR_RRC_DIR}/rrc_gNB_UE_context.c
${RRC_DIR}/rrc_common.c
${RRC_DIR}/L2_interface.c
${RRC_DIR}/L2_interface_common.c
${RRC_DIR}/L2_interface_ue.c
)
-
+
set(L2_RRC_SRC
${OPENAIR2_DIR}/LAYER2/openair2_proc.c
# ${RRC_DIR}/rrc_UE.c
@@ -2051,14 +2078,14 @@ set(L2_SRC_UE
${RRC_DIR}/L2_interface_common.c
${RRC_DIR}/L2_interface_ue.c
)
-
+
set(L2_RRC_SRC_UE
${RRC_DIR}/rrc_UE.c
${RRC_DIR}/rrc_common.c
${RRC_DIR}/L2_interface_common.c
${RRC_DIR}/L2_interface_ue.c
- )
-
+ )
+
set(NR_L2_SRC_UE
${NR_RLC_SRC}
${NR_PDCP_SRC}
@@ -2117,7 +2144,7 @@ set (MAC_SRC_UE
${MAC_DIR}/rar_tools_ue.c
${MAC_DIR}/config_ue.c
)
-
+
set (MAC_NR_SRC_UE
${NR_UE_PHY_INTERFACE_DIR}/NR_IF_Module.c
${NR_UE_MAC_DIR}/config_ue.c
@@ -2189,6 +2216,7 @@ add_library(L2_NR
${MAC_NR_SRC}
${GNB_APP_SRC}
)
+target_compile_definitions(L2_NR PUBLIC NEW_GTPU)
add_library(L2_LTE_NR
${L2_RRC_SRC}
@@ -2196,7 +2224,8 @@ add_library(L2_LTE_NR
${ENB_APP_SRC}
${MCE_APP_SRC}
)
-
+target_compile_definitions(L2_LTE_NR PUBLIC NEW_GTPU)
+
add_dependencies(L2_NR rrc_flag nr_rrc_flag s1ap_flag x2_flag)
add_library(L2_UE
@@ -2237,26 +2266,22 @@ add_library(CN_UTILS
)
set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U)
-set (GTPV1U_SRC
- ${RRC_DIR}/rrc_eNB_GTPV1U.c
- ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c
- ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c
- ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c
- ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c
- ${GTPV1U_DIR}/gtpv1u_teid_pool.c
-)
-add_library(GTPV1U ${GTPV1U_SRC})
-add_dependencies(GTPV1U rrc_flag)
-#add_library (GTPV1U_OCP
-#${OPENAIR3_DIR}/ocp-gtp/gtp_itf.cpp
-#)
-#include_directories(${OPENAIR3_DIR}/ocp-gtp)
+add_library (GTPV1U_OCP
+ ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
+ ${RRC_DIR}/rrc_eNB_GTPV1U.c
+${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp
+)
+target_compile_definitions(GTPV1U_OCP PUBLIC NEW_GTPU)
+add_dependencies(GTPV1U_OCP rrc_flag)
+include_directories(${OPENAIR3_DIR}/ocp-gtp)
#NR case
set (NR_GTPV1U_SRC
${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
${RRC_DIR}/rrc_eNB_GTPV1U.c
+ ${GTPV1U_DIR}/gtpv1u_eNB.c
+ ${GTPV1U_DIR}/gtpv1u_gNB.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c
${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c
@@ -2443,108 +2468,6 @@ set (libnas_utils_OBJS
${NAS_SRC}COMMON/UTIL/OctetString.c
)
-if(NAS_UE)
- set(libnas_ue_api_OBJS
- ${NAS_SRC}UE/API/USER/at_command.c
- ${NAS_SRC}UE/API/USER/at_error.c
- ${NAS_SRC}UE/API/USER/at_response.c
- ${NAS_SRC}UE/API/USER/user_api.c
- ${NAS_SRC}UE/API/USER/user_indication.c
- ${NAS_SRC}UE/API/USIM/aka_functions.c
- ${NAS_SRC}UE/API/USIM/usim_api.c
- )
- set(libnas_ue_emm_OBJS
- ${NAS_SRC}UE/EMM/Attach.c
- ${NAS_SRC}UE/EMM/Authentication.c
- ${NAS_SRC}UE/EMM/Detach.c
- ${NAS_SRC}UE/EMM/emm_main.c
- ${NAS_SRC}UE/EMM/EmmStatusHdl.c
- ${NAS_SRC}UE/EMM/Identification.c
- ${NAS_SRC}UE/EMM/IdleMode.c
- ${NAS_SRC}UE/EMM/LowerLayer.c
- ${NAS_SRC}UE/EMM/SecurityModeControl.c
- ${NAS_SRC}UE/EMM/ServiceRequestHdl.c
- ${NAS_SRC}UE/EMM/TrackingAreaUpdate.c
- )
- set(libnas_ue_emm_sap_OBJS
- ${NAS_SRC}UE/EMM/SAP/emm_as.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregistered.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredInitiated.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredLimitedService.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoImsi.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNormalService.c
- ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
- ${NAS_SRC}UE/EMM/SAP/emm_esm.c
- ${NAS_SRC}UE/EMM/SAP/emm_fsm.c
- ${NAS_SRC}UE/EMM/SAP/EmmNull.c
- ${NAS_SRC}UE/EMM/SAP/emm_recv.c
- ${NAS_SRC}UE/EMM/SAP/emm_reg.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegistered.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegisteredInitiated.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegisteredLimitedService.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNormalService.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegisteredPlmnSearch.c
- ${NAS_SRC}UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
- ${NAS_SRC}UE/EMM/SAP/emm_sap.c
- ${NAS_SRC}UE/EMM/SAP/emm_send.c
- ${NAS_SRC}UE/EMM/SAP/EmmServiceRequestInitiated.c
- ${NAS_SRC}UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
- )
- set (libnas_ue_esm_OBJS
- ${NAS_SRC}UE/ESM/DedicatedEpsBearerContextActivation.c
- ${NAS_SRC}UE/ESM/DefaultEpsBearerContextActivation.c
- ${NAS_SRC}UE/ESM/EpsBearerContextDeactivation.c
- ${NAS_SRC}UE/ESM/esm_ebr.c
- ${NAS_SRC}UE/ESM/esm_ebr_context.c
- ${NAS_SRC}UE/ESM/esm_ip.c
- ${NAS_SRC}UE/ESM/esm_main.c
- ${NAS_SRC}UE/ESM/esm_pt.c
- ${NAS_SRC}UE/ESM/EsmStatusHdl.c
- ${NAS_SRC}UE/ESM/PdnConnectivity.c
- ${NAS_SRC}UE/ESM/PdnDisconnect.c
- )
- set(libnas_ue_esm_sap_OBJS
- ${NAS_SRC}UE/ESM/SAP/esm_recv.c
- ${NAS_SRC}UE/ESM/SAP/esm_send.c
- ${NAS_SRC}UE/ESM/SAP/esm_sap.c
- )
- add_library(LIB_NAS_UE
- ${NAS_SRC}UE/nas_itti_messaging.c
- ${NAS_SRC}UE/nas_network.c
- ${NAS_SRC}UE/nas_parser.c
- ${NAS_SRC}UE/nas_proc.c
- ${NAS_SRC}UE/nas_user.c
- ${libnas_api_OBJS}
- ${libnas_ue_api_OBJS}
- ${libnas_emm_msg_OBJS}
- ${libnas_esm_msg_OBJS}
- ${libnas_ies_OBJS}
- ${libnas_utils_OBJS}
- ${libnas_ue_emm_OBJS}
- ${libnas_ue_emm_sap_OBJS}
- ${libnas_ue_esm_OBJS}
- ${libnas_ue_esm_sap_OBJS}
- )
- add_dependencies(LIB_NAS_UE rrc_flag)
- set(NAS_UE_LIB LIB_NAS_UE)
-
- include_directories(${NAS_SRC}UE)
- include_directories(${NAS_SRC}UE/API/USER)
- include_directories(${NAS_SRC}UE/API/USIM)
- include_directories(${NAS_SRC}UE/EMM)
- include_directories(${NAS_SRC}UE/EMM/SAP)
- include_directories(${NAS_SRC}UE/ESM)
- include_directories(${NAS_SRC}UE/ESM/SAP)
-endif()
-
-
-if(ITTI_SIM)
set(libnas_ue_api_OBJS
${NAS_SRC}UE/API/USER/at_command.c
${NAS_SRC}UE/API/USER/at_error.c
@@ -2662,6 +2585,27 @@ if(ITTI_SIM)
add_dependencies(LIB_NAS_SIMUE rrc_flag)
set(NAS_SIM_LIB LIB_NAS_SIMUE)
+ add_library(LIB_NAS_UE
+ ${NAS_SRC}UE/nas_itti_messaging.c
+ ${NAS_SRC}UE/nas_network.c
+ ${NAS_SRC}UE/nas_parser.c
+ ${NAS_SRC}UE/nas_proc.c
+ ${NAS_SRC}UE/nas_user.c
+ ${libnas_api_OBJS}
+ ${libnas_ue_api_OBJS}
+ ${libnas_emm_msg_OBJS}
+ ${libnas_esm_msg_OBJS}
+ ${libnas_ies_OBJS}
+ ${libnas_utils_OBJS}
+ ${libnas_ue_emm_OBJS}
+ ${libnas_ue_emm_sap_OBJS}
+ ${libnas_ue_esm_OBJS}
+ ${libnas_ue_esm_sap_OBJS}
+ )
+ add_dependencies(LIB_NAS_UE rrc_flag)
+ set(NAS_UE_LIB LIB_NAS_UE)
+
+
include_directories(${NAS_SRC}NR_UE)
include_directories(${NAS_SRC}UE)
include_directories(${NAS_SRC}UE/API/USER)
@@ -2670,7 +2614,6 @@ if(ITTI_SIM)
include_directories(${NAS_SRC}UE/EMM/SAP)
include_directories(${NAS_SRC}UE/ESM)
include_directories(${NAS_SRC}UE/ESM/SAP)
-endif()
# nbiot
add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16")
@@ -2737,7 +2680,7 @@ add_library(SIMU_COMMON
# Simulation library
##########################
-set (SIMUSRC
+set (SIMUSRC
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_channel.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_tv_channel.c
@@ -2800,14 +2743,15 @@ add_library(nrscope MODULE ${XFORMS_SOURCE_NR})
target_link_libraries(nrscope ${XFORMS_LIBRARIES})
-add_library(rfsimulator MODULE
+add_library(rfsimulator MODULE
${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c
${OPENAIR_TARGETS}/ARCH/rfsimulator/apply_channelmod.c
${OPENAIR_TARGETS}/ARCH/rfsimulator/new_channel_sim.c
+ ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
)
target_link_libraries(rfsimulator SIMU_COMMON ${ATLAS_LIBRARIES})
-add_library(oai_iqplayer MODULE
+add_library(oai_iqplayer MODULE
${OPENAIR_TARGETS}/ARCH/iqplayer/iqplayer_lib.c
)
set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODULE_PATH}")
@@ -2818,6 +2762,7 @@ include_directories("${OPENAIR_DIR}/common/utils/T")
if (${T_TRACER})
set(T_SOURCE
+ ${OPENAIR_DIR}/common/utils/T/T_IDs.h
${OPENAIR_DIR}/common/utils/T/T.c
${OPENAIR_DIR}/common/utils/T/local_tracer.c)
set(T_LIB "rt")
@@ -2827,8 +2772,6 @@ endif (${T_TRACER})
#This rule and the following deal with it.
add_custom_command (
OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h
- COMMAND make clean
- COMMAND make -j2
COMMAND make check_vcd
WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T
DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt
@@ -2836,6 +2779,10 @@ add_custom_command (
${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.h
)
+execute_process (
+ COMMAND make check_vcd
+ WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T
+)
#This rule is specifically needed to generate T files
#before anything else in a project that uses the T.
#See below, there are some 'add_dependencies' showing that.
@@ -2874,7 +2821,7 @@ add_executable(measurement_display
${OPENAIR_DIR}/common/utils/threadPool/measurement_display.c)
target_link_libraries (measurement_display minimal_lib)
-add_executable(test5Gnas
+add_executable(test5Gnas
${OPENAIR_DIR}/openair3/TEST/test5Gnas.c
)
target_link_libraries (test5Gnas LIB_5GNAS_GNB CONFIG_LIB minimal_lib )
@@ -2899,6 +2846,7 @@ add_executable(lte-softmodem
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
+ ${OPENAIR2_DIR}/F1AP/dummy_enb.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
@@ -2907,6 +2855,8 @@ add_executable(lte-softmodem
${OPENAIR_DIR}/common/utils/system.c
${PHY_INTERFACE_DIR}/queue.c
${GTPU_need_ITTI}
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -2916,11 +2866,12 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
target_link_libraries (lte-softmodem
-Wl,--start-group
- RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
+
+ RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
-Wl,--end-group z dl)
-
+
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
target_link_libraries (lte-softmodem pthread m ${CONFIG_LIB} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES})
@@ -2947,7 +2898,8 @@ add_executable(ocp-enb
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
- ${GTPU_need_ITTI}
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -2957,7 +2909,8 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l
target_link_libraries (ocp-enb
-Wl,--start-group
- RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
+
+ RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB}
-Wl,--end-group z dl)
@@ -2991,6 +2944,33 @@ target_link_libraries(du_test
${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB}
)
+add_executable(oairu
+ ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
+ ${OPENAIR_TARGETS}/RT/USER/ru_control.c
+ ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
+ ${OPENAIR_DIR}/executables/softmodem-common.c
+ ${OPENAIR_DIR}/openair1/SCHED/phy_procedures_lte_common.c
+ ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
+ ${OPENAIR_DIR}/executables/main_ru.c
+ ${T_SOURCE}
+ ${OPENAIR_DIR}/common/utils/LOG/log.c
+ ${CONFIG_SOURCES}
+ ${OPENAIR_DIR}/common/utils/utils.c
+ ${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
+ ${SHLIB_LOADER_SOURCES}
+)
+target_link_libraries (oairu
+ -Wl,--start-group
+ SCHED_RU_LIB
+ PHY_COMMON PHY_RU
+ -Wl,--end-group z dl)
+
+target_link_libraries (oairu pthread m ${CONFIG_LIB} rt ${CMAKE_DL_LIBS} ${T_LIB})
+
+
# lte-uesoftmodem is UE implementation
#######################################
@@ -2999,9 +2979,6 @@ add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR_DIR}/executables/softmodem-common.c
- ${OPENAIR_TARGETS}/RT/USER/lte-ru.c
- ${OPENAIR_TARGETS}/RT/USER/ru_control.c
- ${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
@@ -3013,6 +2990,8 @@ add_executable(lte-uesoftmodem
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -3027,7 +3006,8 @@ endif()
target_link_libraries (lte-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP F1AP_LIB
- GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
+
+ NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON
PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES}
-Wl,--end-group z dl)
@@ -3055,10 +3035,11 @@ add_executable(nr-softmodem
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
- ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${PHY_INTERFACE_DIR}/queue.c
${GTPU_need_ITTI}
@@ -3066,12 +3047,14 @@ add_executable(nr-softmodem
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
+ ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c
)
+target_compile_definitions(nr-softmodem PUBLIC NEW_GTPU)
target_link_libraries (nr-softmodem
-Wl,--start-group
- UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
- ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
+ UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA
+ ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
-Wl,--end-group z dl)
@@ -3100,7 +3083,6 @@ add_executable(ocp-gnb
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
- ${GTPU_need_ITTI}
${XFORMS_SOURCE_NR}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -3110,8 +3092,8 @@ add_executable(ocp-gnb
target_link_libraries (ocp-gnb
-Wl,--start-group
- UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
- ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
+ UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA
+ ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON
-Wl,--end-group z dl)
@@ -3157,9 +3139,9 @@ target_link_libraries (nr-uesoftmodem
RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB
- ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
NFAPI_USER_LIB S1AP_LIB S1AP_ENB
- ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB
+ ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB LIB_NAS_SIMUE ${NAS_SIM_LIB}
-Wl,--end-group z dl)
target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
@@ -3189,7 +3171,18 @@ target_link_libraries (dlsim_tm4
pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB}
)
-add_executable(polartest
+add_executable(rftest
+ ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_test.c
+ ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_scope.c
+ ${OPENAIR_DIR}/common/utils/system.c
+ ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+ ${OPENAIR_DIR}/executables/softmodem-common.c
+ ${CONFIG_SOURCES}
+ ${SHLIB_LOADER_SOURCES}
+)
+target_link_libraries(rftest minimal_lib PHY_NR_COMMON pthread dl m forms ${T_LIB} )
+
+add_executable(polartest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
@@ -3202,7 +3195,7 @@ target_link_libraries(polartest
m pthread ${ATLAS_LIBRARIES} dl
)
-add_executable(smallblocktest
+add_executable(smallblocktest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/smallblocktest.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
@@ -3220,17 +3213,17 @@ target_link_libraries(smallblocktest
# temp_C_flag = CMAKE_C_FLAGS
#set(CMAKE_C_FLAGS " ")
-set (TEMP_C_FLAG ${CMAKE_C_FLAGS})
+set (TEMP_C_FLAG ${CMAKE_C_FLAGS})
set (CMAKE_C_FLAGS ${CUDA_CMAKE_C_FLAGS})
-set (TEMP_CXX_FLAG ${CMAKE_CXX_FLAGS})
+set (TEMP_CXX_FLAG ${CMAKE_CXX_FLAGS})
set (CMAKE_CXX_FLAGS ${CUDA_CMAKE_CXX_FLAGS})
if (CUDA_FOUND)
###################################################
-# For CUDA library
+# For CUDA library
###################################################
-
- CUDA_ADD_LIBRARY(LDPC_CU
+
+ CUDA_ADD_LIBRARY(LDPC_CU
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu
)
CUDA_ADD_CUFFT_TO_TARGET(LDPC_CU)
@@ -3240,14 +3233,14 @@ if (CUDA_FOUND)
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(ldpctest -ldl
- -Wl,--start-group
- LDPC_CU UTIL SIMU PHY_NR CONFIG_LIB
+ -Wl,--start-group
+ LDPC_CU UTIL SIMU PHY_NR CONFIG_LIB
-Wl,--end-group
m pthread ${ATLAS_LIBRARIES} dl
)
else (CUDA_FOUND)
- add_executable(ldpctest
+ add_executable(ldpctest
${PHY_NR_CODINGIF}
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c
${T_SOURCE}
@@ -3259,21 +3252,21 @@ set (CMAKE_C_FLAGS ${TEMP_C_FLAG})
set (CMAKE_CXX_FLAGS ${TEMP_CXX_FLAG})
-# add_executable(ldpctest
+# add_executable(ldpctest
# ${PHY_NR_CODINGIF}
# ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c
# ${T_SOURCE}
# ${SHLIB_LOADER_SOURCES}
# )
-add_dependencies( ldpctest ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
+add_dependencies( ldpctest ldpc_orig ldpc_optim ldpc_optim8seg ldpc )
target_link_libraries(ldpctest
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_NR PHY_COMMON PHY_NR_COMMON CONFIG_LIB -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} dl
)
-add_executable(nr_dlschsim
- ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c
+add_executable(nr_dlschsim
+ ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/common/utils/utils.c
@@ -3282,13 +3275,13 @@ add_executable(nr_dlschsim
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
-target_link_libraries(nr_dlschsim
+target_link_libraries(nr_dlschsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB MAC_NR_COMMON -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
)
-add_executable(nr_pbchsim
- ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c
+add_executable(nr_pbchsim
+ ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/common/utils/utils.c
@@ -3303,8 +3296,8 @@ target_link_libraries(nr_pbchsim
)
#PUCCH ---> Prashanth
-add_executable(nr_pucchsim
- ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pucchsim.c
+add_executable(nr_pucchsim
+ ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pucchsim.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/common/utils/system.c
@@ -3332,15 +3325,15 @@ add_executable(nr_dlsim
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
- )
+ )
target_link_libraries(nr_dlsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
- m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
+ m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl
)
target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR)
add_executable(nr_prachsim
- ${OPENAIR1_DIR}/SIMULATION/NR_PHY/prachsim.c
+ ${OPENAIR1_DIR}/SIMULATION/NR_PHY/prachsim.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
@@ -3352,9 +3345,9 @@ add_executable(nr_prachsim
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES})
-target_link_libraries(nr_prachsim
+target_link_libraries(nr_prachsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
- m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl)
+ m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl)
add_executable(nr_ulschsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
@@ -3387,18 +3380,21 @@ add_executable(nr_ulsim
)
target_link_libraries(nr_ulsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
- m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl
+ m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl
)
target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR)
foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
-
+
add_executable(${myExe}
${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/utils.c
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
+ ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${XFORMS_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
@@ -3409,7 +3405,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
-Wl,--start-group SIMU_COMMON SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_NR_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
)
-
+
endforeach(myExe)
add_executable(test_epc_generate_scenario
@@ -3421,7 +3417,7 @@ add_executable(test_epc_generate_scenario
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
)
target_link_libraries (test_epc_generate_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
+ -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP NR_GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
)
add_executable(test_epc_play_scenario
@@ -3440,7 +3436,7 @@ add_executable(test_epc_play_scenario
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
- -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
+ -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP NR_GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB}
)
@@ -3472,13 +3468,13 @@ endforeach(myExe)
if (${T_TRACER})
foreach(i
#all "add_executable" definitions (except tests, rb_tool, updatefw)
- lte-softmodem lte-uesoftmodem nr-softmodem
+ lte-softmodem lte-uesoftmodem nr-softmodem
nr-uesoftmodem dlsim dlsim_tm4 dlsim_tm7 nr-ittisim
ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim
syncsim nr_ulsim nr_dlsim nr_dlschsim nr_pbchsim nr_pucchsim
nr_ulschsim ldpctest polartest smallblocktest cu_test du_test
#all "add_library" definitions
- ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP
+ ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP
params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer
oai_eth_transpro oai_mobipass tcp_bridge tcp_bridge_oai
coding FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO
@@ -3486,7 +3482,7 @@ if (${T_TRACER})
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB
- CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
+ CN_UTILS NR_GTPV1U GTPV1U_OCP SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB
ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts)
if (TARGET ${i})
add_dependencies(${i} generate_T)
@@ -3577,24 +3573,26 @@ add_executable(nr-ittisim
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
- ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
- ${GTPU_need_ITTI}
+ ${OPENAIR_DIR}/common/utils/lte/ue_power.c
+ ${OPENAIR_DIR}/common/utils/lte/prach_utils.c
+ ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
+target_compile_definitions(nr-ittisim PUBLIC NEW_GTPU)
target_link_libraries (nr-ittisim
-Wl,--start-group
- UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
- ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB
+ UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS GTPV1U_OCP SECU_CN SECU_OSA
+ ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE
diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/core.py b/cmake_targets/autotests/core.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/log.py b/cmake_targets/autotests/log.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/openair.py b/cmake_targets/autotests/openair.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/templates/index.html b/cmake_targets/autotests/templates/index.html
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/templates/testcase_report.html b/cmake_targets/autotests/templates/testcase_report.html
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
old mode 100644
new mode 100755
index 089d0503fd..3472b14efc
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -1099,8 +1099,11 @@
(Test14: 3 PTRS, 8 Interpolated Symbols),
(Test15: 6 PTRS, 5 Interpolated Symbols),
(Test16: 11 PTRS, 0 Interpolated Symbols),
- (Test17: 2 DMRS Symbols),
- (Test18: 3 DMRS Symbols)
+ (Test17: Mapping type A, 2 DMRS Symbols),
+ (Test18: Mapping type A, 3 DMRS Symbols),
+ (Test19: Mapping type B, 4 DMRS Symbols),
+ (Test20: 4x4 MIMO, 1 Layer),
+ (Test21: 4x4 MIMO, 2 Layers)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1124,8 +1127,11 @@
-n100 -s5 -T 2 1 2
-n100 -s5 -T 2 0 4
-n100 -s2 -U 2 0 1
- -n100 -s2 -U 2 0 2
- nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18
+ -n100 -s2 -U 2 0 2
+ -n100 -s2 -U 2 1 3
+ -n10 -s20 -U 3 0 0 2 -gR -x1 -y4 -z4
+ -n10 -s20 -U 3 0 0 2 -gR -x2 -y4 -z4
+ nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18 nr_dlsim.test19 nr_dlsim.test20 nr_dlsim.test21
PDSCH test OK
segmentation fault|assertion|exiting|fatal
3
@@ -1287,14 +1293,16 @@
(Test3: MCS 28 50 PRBs),
(Test4: MCS 9 217 PRBs),
(Test5: MCS 9 273 PRBs),
- (Test6: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols),
- (Test7: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols),
- (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
- (Test9: SC-FDMA, 50 PRBs),
- (Test10: SC-FDMA, 75 PRBs),
- (Test11: SC-FDMA, 216 PRBs),
- (Test12: SC-FDMA, 273 PRBs),
- (Test13: SC-FDMA, 3 DMRS)
+ (Test6: DMRS Type A, 2 DMRS Symbols),
+ (Test7: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols),
+ (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols),
+ (Test9: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
+ (Test10: SC-FDMA, 50 PRBs),
+ (Test11: SC-FDMA, 75 PRBs),
+ (Test12: SC-FDMA, 216 PRBs),
+ (Test13: SC-FDMA, 273 PRBs),
+ (Test14: SC-FDMA, 3 DMRS),
+ (Test15: MCS 16 50 PRBs 2 RX_Antenna)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1306,16 +1314,18 @@
-n100 -m28 -s20
-n100 -m9 -R217 -r217 -s5
-n100 -m9 -R273 -r273 -s5
+ -n100 -s5 -U 2 0 1
-n100 -s5 -T 2 1 2 -U 2 0 2
-n100 -s5 -T 2 2 2 -U 2 1 2
-n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3
- -n100 -s2 -Z
- -n100 -s2 -Z -r75
- -n100 -s2 -Z -r216 -R217
- -n100 -s2 -Z -r270 -R273
- -n100 -s2 -Z -U 2 0 2
+ -n100 -s5 -Z
+ -n100 -s5 -Z -r75
+ -n50 -s5 -Z -r216 -R217
+ -n50 -s5 -Z -r270 -R273
+ -n100 -s5 -Z -U 2 0 2
+ -n100 -m16 -s10 -z2
- nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13
+ nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14 nr_ulsim.test15
PUSCH test OK
segmentation fault|assertion|exiting|fatal
3
@@ -1328,7 +1338,8 @@
(Test3: 30kHz SCS, 273 PRBs, Prach format A2),
(Test4: 30kHz SCS, 106 PRBs, Prach format 0),
(Test5: 120kHz SCS, 32 PRBs, Prach format A2),
- (Test6: 120kHz SCS, 66 PRBs, Prach format A2)
+ (Test6: 120kHz SCS, 66 PRBs, Prach format A2),
+ (Test7: 120kHz SCS, 66 PRBs, High Speed Enabled)
$OPENAIR_DIR/cmake_targets/build_oai
--phy_simulators -c
@@ -1340,8 +1351,9 @@
-a -s -30 -n 100 -p 63 -R 273
-a -s -30 -n 100 -p 63 -R 106 -c 4
-a -s -30 -n 100 -p 32 -R 32 -m 3 -c52
- -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52
- nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 nr_prachsim.test5 nr_prachsim.test6
+ -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52
+ -a -s -30 -n 100 -R 66 -m 3 -c52 -H
+ nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 nr_prachsim.test5 nr_prachsim.test6 nr_prachsim.test7
PRACH test OK
segmentation fault|assertion|exiting|fatal
3
diff --git a/cmake_targets/autotests/testsuite_ue_noS1.xml b/cmake_targets/autotests/testsuite_ue_noS1.xml
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/testsuite_ue_noS1_TCL.xml b/cmake_targets/autotests/testsuite_ue_noS1_TCL.xml
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/lib_autotest.py b/cmake_targets/autotests/tools/lib_autotest.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/lib_autotest_analyser.py b/cmake_targets/autotests/tools/lib_autotest_analyser.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/tools/wdial.bandrich.conf b/cmake_targets/autotests/tools/wdial.bandrich.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/3276.txt b/cmake_targets/autotests/v2/actions/3276.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_epc.bash b/cmake_targets/autotests/v2/actions/alu_epc.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_epc_stop.bash b/cmake_targets/autotests/v2/actions/alu_epc_stop.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/alu_hss.bash b/cmake_targets/autotests/v2/actions/alu_hss.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/bandrich.txt b/cmake_targets/autotests/v2/actions/bandrich.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/client_tcp.bash b/cmake_targets/autotests/v2/actions/client_tcp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/client_udp.bash b/cmake_targets/autotests/v2/actions/client_udp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/clone_repository.bash b/cmake_targets/autotests/v2/actions/clone_repository.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/compilation.bash b/cmake_targets/autotests/v2/actions/compilation.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/execution.bash b/cmake_targets/autotests/v2/actions/execution.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/execution_compile.bash b/cmake_targets/autotests/v2/actions/execution_compile.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/modem.py b/cmake_targets/autotests/v2/actions/modem.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/run_enb.bash b/cmake_targets/autotests/v2/actions/run_enb.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/server_tcp.bash b/cmake_targets/autotests/v2/actions/server_tcp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/server_udp.bash b/cmake_targets/autotests/v2/actions/server_udp.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_3276.bash b/cmake_targets/autotests/v2/actions/start_3276.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_3276.py b/cmake_targets/autotests/v2/actions/start_3276.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_bandrich.bash b/cmake_targets/autotests/v2/actions/start_bandrich.bash
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/start_bandrich.py b/cmake_targets/autotests/v2/actions/start_bandrich.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/stop_3276.py b/cmake_targets/autotests/v2/actions/stop_3276.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/stop_bandrich.py b/cmake_targets/autotests/v2/actions/stop_bandrich.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/wvdial.3276.conf b/cmake_targets/autotests/v2/actions/wvdial.3276.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/actions/wvdial.bandrich.conf b/cmake_targets/autotests/v2/actions/wvdial.bandrich.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/alu_test.py b/cmake_targets/autotests/v2/alu_test.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/connection.py b/cmake_targets/autotests/v2/connection.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/machine_list.py b/cmake_targets/autotests/v2/machine_list.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/main.py b/cmake_targets/autotests/v2/main.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/task.py b/cmake_targets/autotests/v2/task.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/autotests/v2/utils.py b/cmake_targets/autotests/v2/utils.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index dc3faf664e..c9390d67ce 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -48,8 +48,9 @@ DEADLINE_SCHEDULER_FLAG_USER=""
CPU_AFFINITY_FLAG_USER="False" #Only valid when low-latency flag is set to False
REL="Rel15"
HW="None"
-TP="None"
+TP="Ethernet"
EPC=0
+VERBOSE_CI=0
VERBOSE_COMPILE=0
CFLAGS_PROCESSOR_USER=""
RUN_GROUP=0
@@ -69,6 +70,7 @@ NR="False"
ITTI_SIM="False"
SANITIZE_ADDRESS="False"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc"
+RU=0
trap handle_ctrl_c INT
function print_help() {
@@ -103,6 +105,8 @@ Options
Makes the NR softmodem
--nrUE
Makes the NR UE softmodem
+--RU
+ Makes the OAI RRU (without full stack)
--UE
Makes the UE specific parts (ue_ip, usim, nvram) from the given configuration file
--UE-conf-nvram [configuration file]
@@ -240,26 +244,36 @@ function main() {
shift;;
--eNB)
eNB=1
+ RU=0
echo_info "Will compile eNB"
shift;;
--eNBocp)
eNBocp=1
+ RU=0
echo_info "Will compile OCP eNB"
shift;;
--gNB)
gNB=1
+ RU=0
NR="True"
echo_info "Will compile gNB"
shift;;
+ --RU)
+ RU=1
+ echo_info "Will compile RRU"
+ shift;;
-a | --agent)
echo_info "FlexRAN support is always compiled into the eNB"
shift;;
--UE)
+ RU=0
UE=1
echo_info "Will compile UE"
shift;;
--nrUE)
+ RU=0
nrUE=1
+ rfsimNas=1
NR="True"
echo_info "Will compile NR UE"
shift;;
@@ -290,8 +304,12 @@ function main() {
esac
echo_info "Setting hardware to: $HW"
shift 2;;
+ -t | --transport)
+ TP=$2
+ shift 2;;
-P | --phy_simulators)
SIMUS_PHY=1
+ RU=0
echo_info "Will compile dlsim, ulsim, ..."
shift;;
-S | --core_simulators)
@@ -325,6 +343,10 @@ function main() {
HWLAT_TEST=1
echo_info "Will compile hw latency test program"
shift;;
+ --verbose-ci)
+ VERBOSE_CI=1
+ echo_info "Will compile with verbose instructions in CI Docker env"
+ shift;;
--verbose-compile)
VERBOSE_COMPILE=1
echo_info "Will compile with verbose instructions"
@@ -456,7 +478,7 @@ function main() {
########################################################
# to be discussed
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" -o "$RU" = "1" ] ; then
if [ "$HW" = "None" -a "$TP" = "None" ] ; then
echo_info "No local radio head and no transport protocol selected"
fi
@@ -583,7 +605,7 @@ function main() {
config_libconfig_shlib=params_libconfig
# first generate the CMakefile in the right directory
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" -o "$rfsimNas" = "1" ] ; then
# softmodem compilation
@@ -607,6 +629,7 @@ function main() {
echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file
echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file
echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file
+ echo "set ( RU $RU )" >> $cmake_file
echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file
echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file
echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file
@@ -623,6 +646,9 @@ function main() {
if [ "$gNB" = "1" ] ; then
execlist="$execlist nr-softmodem"
fi
+ if [ "$RU" = "1" ] ; then
+ execlist="$execlist oairu"
+ fi
if [ "$UE" = 1 ] ; then
execlist="$execlist lte-uesoftmodem"
fi
@@ -651,28 +677,15 @@ function main() {
$build_dir $config_libconfig_shlib \
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
- compilations \
- $build_dir coding \
- libcoding.so $dbin/libcoding.so
-
-
- #check if we run inside a container or not
- #IS_CONTAINER variable is defined in build_helper file
- #compile nasmesh and rb_tool only if NOT running in a container
- if [ $IS_CONTAINER -eq 0 ]
- then
- compilations \
- $build_dir nasmesh \
- CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko
+ if [ "$RU" = "0" ] ; then
compilations \
- $build_dir rb_tool \
- rb_tool $dbin/rb_tool
+ $build_dir coding \
+ libcoding.so $dbin/libcoding.so
- cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin
- fi #IS_CONTAINER
+
+ fi
fi
-
fi
if [ "$UE" = 1 ] ; then
@@ -854,7 +867,7 @@ function main() {
####################################################
# Build RF device and transport protocol libraries #
####################################################
- if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
+ if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then
# build RF device libraries
if [ "$HW" != "None" ] ; then
@@ -941,12 +954,30 @@ function main() {
echo_info "Building transport protocol libraries"
rm -f liboai_transpro.so
rm -f $dbin/liboai_transpro.so
- compilations \
- $build_dir oai_eth_transpro \
- liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
- ln -sf liboai_eth_transpro.so liboai_transpro.so
- ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
- echo_info "liboai_transpro.so is linked to ETHERNET transport"
+ if [ "$TP" == "Ethernet" ]; then
+ compilations \
+ $build_dir oai_eth_transpro \
+ liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
+ ln -sf liboai_eth_transpro.so liboai_transpro.so
+ ln -sf $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
+ echo_info "liboai_transpro.so is linked to ETHERNET transport"
+ fi
+ if [ "$TP" == "benetel4g" ]; then
+ compilations \
+ $build_dir benetel_4g \
+ libbenetel_4g.so $dbin/libbenetel_4g.$REL
+ ln -sf libbenetel_4g.so liboai_transpro.so
+ ln -sf $dbin/libbenetel_4g.so.$REL $dbin/liboai_transpro.so
+ echo_info "liboai_transpro.so is linked to BENETEL4G transport"
+ fi
+ if [ "$TP" == "benetel5g" ]; then
+ compilations \
+ $build_dir benetel_5g \
+ libbenetel_5g.so $dbin/libbenetel_5g.$REL
+ ln -sf libbenetel_5g.so liboai_transpro.so
+ ln -sf $dbin/libbenetel_5g.so.$REL $dbin/liboai_transpro.so
+ echo_info "liboai_transpro.so is linked to BENETEL4G transport"
+ fi
fi
fi
diff --git a/cmake_targets/doxygen/CMakeLists.txt b/cmake_targets/doxygen/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template
old mode 100644
new mode 100755
diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20
index 9ef79be9c2..f0314ca575 100755
--- a/cmake_targets/install_external_packages.ubuntu20
+++ b/cmake_targets/install_external_packages.ubuntu20
@@ -83,6 +83,8 @@ get_distribution_release() {
check_supported_distribution() {
case $(get_distribution_release) in
"ubuntu20.04") return 0 ;;
+ "ubuntu20.10") return 0 ;;
+ "ubuntu21.04") return 0 ;;
esac
return 1
}
@@ -152,11 +154,11 @@ install_protobuf_from_source(){
cd /tmp || exit
echo "Downloading protobuf"
#rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1
- #wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
+ #wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
#tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner
#cd protobuf-2.6.1/
rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0
- wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
+ wget --tries=3 --retry-connrefused https://github.com/protocolbuffers/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner
cd protobuf-3.3.0/ || exit
./configure
@@ -198,15 +200,15 @@ install_usrp_uhd_driver_from_source(){
rm -rf /tmp/uhd
git clone https://github.com/EttusResearch/uhd.git
cd uhd || exit
- git checkout tags/v3.13.0.2
+ git checkout UHD-3.15.LTS
mkdir -p host/build
cd host/build || exit
- $CMAKE ../
+ $CMAKE ../ -GNinja
echo "Compiling UHD"
- make -j"$(nproc)"
- make test
- $SUDO make install
+ ninja
+ $SUDO ninja install
$SUDO ldconfig
+ $SUDO /usr/lib/uhd/utils/uhd_images_downloader.py
) >& "$uhd_install_log"
}
@@ -333,6 +335,11 @@ check_install_ubuntu_packages() {
LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
;;
+ "ubuntu21.04")
+ specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev"
+ LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu"
+ LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so"
+ ;;
esac
$SUDO $INSTALLER install -y \
$specific_packages \
@@ -345,7 +352,6 @@ check_install_ubuntu_packages() {
openvpn \
pkg-config \
python3-dev \
- python-pexpect \
sshfs \
swig \
tshark \
@@ -358,7 +364,6 @@ check_install_ubuntu_packages() {
iperf3 \
android-tools-adb \
wvdial \
- python-numpy \
sshpass \
nscd \
bc \
@@ -379,7 +384,6 @@ check_install_ubuntu_packages() {
git \
graphviz \
gtkwave \
- guile-2.0-dev \
iperf \
iptables \
libxtables-dev \
@@ -419,7 +423,8 @@ check_install_ubuntu_packages() {
libxpm-dev \
libboost-all-dev \
nettle-dev \
- nettle-bin
+ nettle-bin \
+ libreadline-dev
fi
$SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET"
diff --git a/cmake_targets/nas_sim_tools/CMakeLists.txt b/cmake_targets/nas_sim_tools/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/phy_simulators/CMakeLists.txt b/cmake_targets/phy_simulators/CMakeLists.txt
old mode 100644
new mode 100755
index 447e90bcab..f8c659959f
--- a/cmake_targets/phy_simulators/CMakeLists.txt
+++ b/cmake_targets/phy_simulators/CMakeLists.txt
@@ -17,4 +17,5 @@ set ( UE_TIMING_TRACE False )
set ( USRP_REC_PLAY False )
set ( SKIP_SHARED_LIB_FLAG False )
set ( PHYSIM True)
+set ( RU 0)
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)
diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/Kbuild.cmake b/cmake_targets/tools/Kbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeParseArguments.cmake b/cmake_targets/tools/MODULES/CMakeParseArguments.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserFindMySQL.cmake b/cmake_targets/tools/MODULES/CMakeUserFindMySQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserUseBison.cmake b/cmake_targets/tools/MODULES/CMakeUserUseBison.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/CMakeUserUseFlex.cmake b/cmake_targets/tools/MODULES/CMakeUserUseFlex.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindFreeDiameter.cmake b/cmake_targets/tools/MODULES/FindFreeDiameter.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGCCXML.cmake b/cmake_targets/tools/MODULES/FindGCCXML.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGcrypt.cmake b/cmake_targets/tools/MODULES/FindGcrypt.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindGnuTLS.cmake b/cmake_targets/tools/MODULES/FindGnuTLS.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindKbuild.cmake b/cmake_targets/tools/MODULES/FindKbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindLibXml2.cmake b/cmake_targets/tools/MODULES/FindLibXml2.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindMySQL.cmake b/cmake_targets/tools/MODULES/FindMySQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindNettle.cmake b/cmake_targets/tools/MODULES/FindNettle.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindPostgreSQL.cmake b/cmake_targets/tools/MODULES/FindPostgreSQL.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/FindSCTP.cmake b/cmake_targets/tools/MODULES/FindSCTP.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/Kbuild.cmake b/cmake_targets/tools/MODULES/Kbuild.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/cmake_useful.cmake b/cmake_targets/tools/MODULES/cmake_useful.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/kbuild_system.cmake b/cmake_targets/tools/MODULES/kbuild_system.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/kmodule.cmake b/cmake_targets/tools/MODULES/kmodule.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/MODULES/path_prefixes.cmake b/cmake_targets/tools/MODULES/path_prefixes.cmake
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/asn1tostruct.py b/cmake_targets/tools/asn1tostruct.py
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 977827b0c9..d3fcf615e2 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -41,7 +41,7 @@ KERNEL_VERSION=$(uname -r | cut -d '.' -f1)
KERNEL_MAJOR=$(uname -r | cut -d '.' -f2)
#check if we run inside a container
-IS_CONTAINER=`egrep -c "docker|podman|kubepods" /proc/self/cgroup || true`
+IS_CONTAINER=`egrep -c "docker|podman|kubepods|libpod|buildah" /proc/self/cgroup || true`
#sudo is not needed when we are root
if [ "$UID" = 0 ]
then
@@ -113,6 +113,7 @@ check_supported_distribution() {
"rhel7.6") return 0 ;;
"rhel7.7") return 0 ;;
"rhel7.8") return 0 ;;
+ "rhel7.9") return 0 ;;
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
"rhel8.4") return 0 ;;
@@ -221,6 +222,11 @@ compilations() {
ret=$?
} > $dlog/$2.$REL.txt 2>&1
set -e
+ if [ "$VERBOSE_CI" == "1" ]; then
+ echo_info "====== Start of log for $2.$REL.txt ======"
+ cat $dlog/$2.$REL.txt
+ echo_info "====== End of log for $2.$REL.txt ======"
+ fi
if [[ $ret -ne 0 ]]; then
check_warnings "$dlog/$2.$REL.txt"
check_errors "$dlog/$2.$REL.txt"
@@ -250,14 +256,14 @@ install_protobuf_from_source(){
cd /tmp
echo "Downloading protobuf"
#rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1
- #wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
+ #wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
#tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner
#cd protobuf-2.6.1/
if [ $IS_CONTAINER -eq 0 ]
then
rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0
- wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
+ wget --tries=3 --retry-connrefused https://github.com/protocolbuffers/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner
cd protobuf-3.3.0/
else
@@ -359,10 +365,10 @@ check_install_usrp_uhd_driver(){
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
if [ $IS_CONTAINER -eq 0 ]
then
- $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake
+ $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils $CMAKE
$SUDO -H pip install requests
else
- $SUDO $INSTALLER -y install boost boost-devel cmake3
+ $SUDO $INSTALLER -y install boost boost-devel $CMAKE
$SUDO pip3 install mako requests
fi
if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then
@@ -488,7 +494,7 @@ install_soapy_from_source(){
#git checkout tags/release_003_010_001_001
mkdir -p build
cd build
- cmake ../
+ $CMAKE ../
echo "Compiling SoapyRemote"
make -j`nproc`
$SUDO make install
@@ -507,7 +513,7 @@ install_soapy_iris_from_source(){
cd sklk-soapyiris
mkdir -p build
cd build
- cmake ../
+ $CMAKE ../
echo "Compiling SoapyIris"
make -j`nproc`
$SUDO make install
@@ -684,7 +690,7 @@ check_install_oai_software() {
automake \
bison \
build-essential \
- cmake \
+ $CMAKE \
cmake-curses-gui \
ninja-build \
doxygen \
diff --git a/cmake_targets/tools/example_enb_exmimo_mme_hss.txt b/cmake_targets/tools/example_enb_exmimo_mme_hss.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt b/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo2_2arxg.lime b/cmake_targets/tools/exmimo2_2arxg.lime
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo2_2brxg.lime b/cmake_targets/tools/exmimo2_2brxg.lime
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/exmimo_stop_octave.m b/cmake_targets/tools/exmimo_stop_octave.m
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff b/cmake_targets/tools/fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff
old mode 100644
new mode 100755
diff --git a/cmake_targets/tools/make_asn1c_includes.sh b/cmake_targets/tools/make_asn1c_includes.sh
index 1598678a73..00c88d6497 100755
--- a/cmake_targets/tools/make_asn1c_includes.sh
+++ b/cmake_targets/tools/make_asn1c_includes.sh
@@ -1,13 +1,19 @@
#!/bin/bash
-GENERATED_FULL_DIR=$1
-shift
-ASN1_SOURCE_DIR=$1
-shift
export ASN1C_PREFIX=$1
shift
-options=$*
+options=$1
+shift
+GENERATED_FULL_DIR=$1
+shift
+ASN1_SOURCE_DIR=$*
done_flag="$GENERATED_FULL_DIR"/done
-if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
+rebuild=0
+for f in $ASN1_SOURCE_DIR ; do
+ if [ "$done_flag" -ot "$f" ] ; then
+ rebuild=1
+ fi
+done
+if [ $rebuild -eq 1 ] ; then
rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h
mkdir -p "$GENERATED_FULL_DIR"
asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u
diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp
index e119126683..1a4c6b10b8 100755
--- a/cmake_targets/tools/run_enb_s1_usrp
+++ b/cmake_targets/tools/run_enb_s1_usrp
@@ -101,7 +101,6 @@ function main()
local -i run_gdb=0
local -i show_stdout=0
local exe_arguments=""
- local itti_dump_file=""
until [ -z "$1" ]
do
@@ -154,18 +153,6 @@ function main()
exe_arguments="$exe_arguments --rf-config-file=$rf_config_file"
fi
;;
- -K | --itti-dump-file)
- itti_dump_file=$2
- # can omit file name if last arg on the line
- if [ "x$itti_dump_file" = "x" ]; then
- itti_dump_file="/tmp/enb_s1_usrp_itti.log"
- shift 1;
- else
- shift 2;
- fi
- echo "setting ITTI dump file to: $itti_dump_file"
- exe_arguments="$exe_arguments -K $itti_dump_file"
- ;;
-m | --mscgen)
g_msc_dir=$2
# can omit file name if last arg on the line
diff --git a/cmake_targets/tools/setup_routes.sh b/cmake_targets/tools/setup_routes.sh
new file mode 100755
index 0000000000..67fe250be7
--- /dev/null
+++ b/cmake_targets/tools/setup_routes.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+for i in $(seq 1 $1);
+do
+ let table=1000+$i
+ echo "sudo ip route add 10.0.1.0/24 dev oaitun_ue$i table $table"
+ sudo ip route add 10.0.1.0/24 dev oaitun_ue$i table $table
+ echo "sudo ip route add default via 10.0.1.1 dev oaitun_ue$i table $table"
+ sudo ip route add default via 10.0.1.1 dev oaitun_ue$i table $table
+ let octet=$i+1
+ echo "sudo ip rule add from 10.0.1.$octet table $table"
+ sudo ip rule add from 10.0.1.$octet table $table
+done
diff --git a/cmake_targets/tools/test_helper b/cmake_targets/tools/test_helper
old mode 100644
new mode 100755
diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c
index 6d01d98c65..f5dfae06b6 100644
--- a/common/config/config_cmdline.c
+++ b/common/config/config_cmdline.c
@@ -211,7 +211,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
while (c > 0 ) {
char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
-
+ if(!oneargv) abort();
/* first check help options, either --help, -h or --help_ */
if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
char *tokctx = NULL;
@@ -255,7 +255,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) || /* long option beginning with "--" */
((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgoptions[n].optname) == 0) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ||
- ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
+ ((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
char *valptr=NULL;
int ret;
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h
index 8baaa99bb8..0688f6531f 100644
--- a/common/config/config_load_configmodule.h
+++ b/common/config/config_load_configmodule.h
@@ -82,10 +82,12 @@ typedef struct configmodule_interface {
#ifdef CONFIG_LOADCONFIG_MAIN
configmodule_interface_t *cfgptr=NULL;
-static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]> \n \
- debugflags can also be defined in the config_libconfig section of the config file\n \
+static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \
+ debugflags can also be defined in the config section of the config file\n \
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
- 4->print command line processing debug messages\n ";
+ 4->print command line processing debug messages\n \
+ incp parameter can be used to define the include path used for config files (@include directive)\n \
+ defaults is set to the path of the main config file.\n";
#define CONFIG_SECTIONNAME "config"
#define CONFIGPARAM_DEBUGFLAGS_IDX 0
diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c
index eb08a70183..17266246f0 100644
--- a/common/config/libconfig/config_libconfig.c
+++ b/common/config/libconfig/config_libconfig.c
@@ -33,8 +33,9 @@
#include
#include
+#include
+ #include
-#include
#include "config_libconfig.h"
#include "config_libconfig_private.h"
@@ -347,17 +348,35 @@ int config_libconfig_init(char *cfgP[], int numP) {
config_get_if()->numptrs=0;
memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS);
memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated));
-
+ /* search for include path parameter and set config file include path accordingly */
+ for (int i=0; idump_mask & D)
-# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
+# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)/* */
/* define variable only used in LOG macro's */
# define LOG_VAR(A,B) A B
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
@@ -470,8 +471,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_DUMPFLAG(D) (g_log->debug_mask & D)
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
-# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
+# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
# define LOG_VAR(A,B) A B
+# define T_ACTIVE(a) (0)
# endif /* T_TRACER */
#endif // LOG_MINIMAL
@@ -480,9 +482,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
/* unfiltered macros, useful for simulators or messages at init time, before log is configured */
-#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
+#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
#define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */
+# define LOG_MM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 1);} while(0)
/* @}*/
diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c
index bd598b48da..5bf9759933 100644
--- a/common/utils/LOG/vcd_signal_dumper.c
+++ b/common/utils/LOG/vcd_signal_dumper.c
@@ -302,6 +302,9 @@ const char* eurecomFunctionsNames[] = {
/* PHY signals */
"ue_synch",
"ue_slot_fep",
+ "ue_slot_fep_pdcch",
+ "ue_slot_fep_pbch",
+ "ue_slot_fep_pdsch",
"ue_slot_fep_mbsfn",
"ue_slot_fep_mbsfn_khz_1dot25",
"ue_rrc_measurements",
@@ -390,6 +393,8 @@ const char* eurecomFunctionsNames[] = {
"rx_pmch",
"rx_pmch_khz_1dot25",
"pdsch_procedures",
+ "pdsch_procedures_crnti",
+ //"dlsch_procedures_crnti",
"pdsch_procedures_si",
"pdsch_procedures_p",
"pdsch_procedures_ra",
diff --git a/common/utils/LOG/vcd_signal_dumper.h b/common/utils/LOG/vcd_signal_dumper.h
index f9f5868260..fb27c19973 100644
--- a/common/utils/LOG/vcd_signal_dumper.h
+++ b/common/utils/LOG/vcd_signal_dumper.h
@@ -283,6 +283,9 @@ typedef enum {
/* PHY signals */
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP,
+ VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH,
+ VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH,
+ VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_MBSFN,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_MBSFN_KHZ_1DOT25,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_RRC_MEASUREMENTS,
@@ -371,9 +374,11 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PMCH,
VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PMCH_KHZ_1DOT25,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC,
+ VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA,
+ //VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PROC_C,
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2,
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB1_ENB,
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB2_ENB,
diff --git a/common/utils/T/.gitignore b/common/utils/T/.gitignore
index d754ff7c38..6a6e5817c5 100644
--- a/common/utils/T/.gitignore
+++ b/common/utils/T/.gitignore
@@ -4,6 +4,7 @@ T_IDs.h
T_messages.txt.h
genids
tracer/enb
+tracer/gnb
tracer/extract_config
tracer/record
tracer/replay
diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile
index 0588c88a45..d76ab93cb8 100644
--- a/common/utils/T/Makefile
+++ b/common/utils/T/Makefile
@@ -18,7 +18,7 @@ T_messages.txt.h: T_messages.txt
T_IDs.h: $(GENIDS) T_messages.txt
./$(GENIDS) T_messages.txt T_IDs.h
-check_vcd:
+check_vcd: T_IDs.h T_messages.txt.h
gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
rm -f ./_check_vcd
diff --git a/common/utils/T/T_defs.h b/common/utils/T/T_defs.h
index 11c816f002..b74c0567ce 100644
--- a/common/utils/T/T_defs.h
+++ b/common/utils/T/T_defs.h
@@ -42,9 +42,9 @@
/* maximum size of a message - increase if needed */
#if BASIC_SIMULATOR
/* let's have 100 RBs functional for the basic simulator */
-# define T_BUFFER_MAX (1024*64*2)
+# define T_BUFFER_MAX (1024*64*4)
#else
-# define T_BUFFER_MAX (1024*64*2)
+# define T_BUFFER_MAX (1024*64*4)
#endif
/* size of the local cache for messages (must be pow(2,something)) */
@@ -73,7 +73,7 @@ typedef struct {
} T_cache_t;
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
-#define VCD_NUM_FUNCTIONS (269)
+#define VCD_NUM_FUNCTIONS (273)
/* number of VCD variables (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_VARIABLES (187)
diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt
index bad6444e13..ca5690497d 100644
--- a/common/utils/T/T_messages.txt
+++ b/common/utils/T/T_messages.txt
@@ -1,7 +1,3 @@
-ID = BENETEL
- GROUP = ALL
- FORMAT = int,frame : int,slot : buffer,rxdataF
-
#general logs
ID = ENB_MASTER_TICK
DESC = eNodeB master tick - one tick per ms, to be used as "reference clock", mostly for ticktime view
@@ -93,6 +89,14 @@ ID = GNB_PHY_MIB
DESC = NR MIB data
GROUP = ALL:PHY:GNB:WIRESHARK
FORMAT = int,gNB_ID : int,frame : int,slot : buffer,data
+ID = GNB_PHY_PUCCH_PUSCH_IQ
+ DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done
+ GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
+ FORMAT = int,frame : int,slot : buffer,rxdataF
+ID = GNB_PHY_PRACH_INPUT_SIGNAL
+ DESC = gNodeB input data in the time domain for slots with PRACH detection
+ GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
+ FORMAT = int,frame : int,slot : int,antenna : buffer,rxdata
#MAC logs
ID = ENB_MAC_UE_DL_SDU
@@ -2407,6 +2411,21 @@ ID = VCD_FUNCTION_UE_SLOT_FEP
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
VCD_NAME = ue_slot_fep
+ID = VCD_FUNCTION_UE_SLOT_FEP_PDCCH
+ DESC = VCD function UE_SLOT_FEP_PDCCH
+ GROUP = ALL:VCD:UE:VCD_FUNCTION
+ FORMAT = int,value
+ VCD_NAME = ue_slot_fep_pdcch
+ID = VCD_FUNCTION_UE_SLOT_FEP_PBCH
+ DESC = VCD function UE_SLOT_FEP_PBCH
+ GROUP = ALL:VCD:UE:VCD_FUNCTION
+ FORMAT = int,value
+ VCD_NAME = ue_slot_fep_pbch
+ID = VCD_FUNCTION_UE_SLOT_FEP_PDSCH
+ DESC = VCD function UE_SLOT_FEP_PDSCH
+ GROUP = ALL:VCD:UE:VCD_FUNCTION
+ FORMAT = int,value
+ VCD_NAME = ue_slot_fep_pdsch
ID = VCD_FUNCTION_UE_SLOT_FEP_MBSFN
DESC = VCD function UE_SLOT_FEP_MBSFN
GROUP = ALL:VCD:UE:VCD_FUNCTION
@@ -2847,6 +2866,11 @@ ID = VCD_FUNCTION_PDSCH_PROC
GROUP = ALL:VCD:UE:VCD_FUNCTION
FORMAT = int,value
VCD_NAME = pdsch_procedures
+ID = VCD_FUNCTION_PDSCH_PROC_C
+ DESC = VCD function PDSCH_PROC_C
+ GROUP = ALL:VCD:UE:VCD_FUNCTION
+ FORMAT = int,value
+ VCD_NAME = pdsch_procedures_crnti
ID = VCD_FUNCTION_PDSCH_PROC_SI
DESC = VCD function PDSCH_PROC_SI
GROUP = ALL:VCD:UE:VCD_FUNCTION
diff --git a/common/utils/T/tracer/Makefile b/common/utils/T/tracer/Makefile
index 792c2a407c..0713d9a3df 100644
--- a/common/utils/T/tracer/Makefile
+++ b/common/utils/T/tracer/Makefile
@@ -7,7 +7,8 @@ LIBS=-lm
XLIBS=-lX11 -lpng -lXft
all: record replay extract_config textlog enb ue vcd macpdu2wireshark \
- extract_input_subframe extract_output_subframe to_vcd extract multi
+ extract_input_subframe extract_output_subframe to_vcd extract multi \
+ gnb
record: utils.o record.o database.o config.o
$(CC) $(CFLAGS) -o record $^ $(LIBS)
@@ -60,6 +61,11 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
multi: multi.o utils.o database.o config.o
$(CC) $(CFLAGS) -o multi $^ $(LIBS)
+gnb: utils.o gnb.o database.o event.o handler.o config.o \
+ view/view.a gui/gui.a logger/logger.a \
+ filter/filter.a
+ $(CC) $(CFLAGS) -o gnb $^ $(LIBS) $(XLIBS)
+
multi.o: ../T_IDs.h
../T_IDs.h:
@@ -85,7 +91,7 @@ filter/filter.a:
clean:
rm -f *.o core tracer_remote textlog enb ue vcd record replay
rm -f extract_config macpdu2wireshark extract_input_subframe
- rm -f extract_output_subframe to_vcd extract multi
+ rm -f extract_output_subframe to_vcd extract multi gnb
cd gui && $(MAKE) clean
cd view && $(MAKE) clean
cd logger && $(MAKE) clean
diff --git a/common/utils/T/tracer/gnb.c b/common/utils/T/tracer/gnb.c
new file mode 100644
index 0000000000..4aaa4898a1
--- /dev/null
+++ b/common/utils/T/tracer/gnb.c
@@ -0,0 +1,172 @@
+#include
+#include
+#include
+#include
+#include
+#include "database.h"
+#include "handler.h"
+#include "config.h"
+#include "logger/logger.h"
+#include "view/view.h"
+#include "gui/gui.h"
+
+typedef struct {
+ widget *pucch_pusch_iq_plot;
+ logger *pucch_pusch_iq_logger;
+} gnb_gui;
+
+typedef struct {
+ int socket;
+ int *is_on;
+ int nevents;
+ pthread_mutex_t lock;
+ gnb_gui *e;
+ void *database;
+} gnb_data;
+
+void is_on_changed(void *_d)
+{
+ gnb_data *d = _d;
+ char t;
+
+ if (pthread_mutex_lock(&d->lock)) abort();
+
+ if (d->socket == -1) goto no_connection;
+
+ t = 1;
+ if (socket_send(d->socket, &t, 1) == -1 ||
+ socket_send(d->socket, &d->nevents, sizeof(int)) == -1 ||
+ socket_send(d->socket, d->is_on, d->nevents * sizeof(int)) == -1)
+ goto connection_dies;
+
+no_connection:
+ if (pthread_mutex_unlock(&d->lock)) abort();
+ return;
+
+connection_dies:
+ close(d->socket);
+ d->socket = -1;
+ if (pthread_mutex_unlock(&d->lock)) abort();
+}
+
+void usage(void)
+{
+ printf(
+"options:\n"
+" -d this option is mandatory\n"
+" -ip connect to given IP address (default %s)\n"
+" -p connect to given port (default %d)\n",
+ DEFAULT_REMOTE_IP,
+ DEFAULT_REMOTE_PORT
+ );
+ exit(1);
+}
+
+static void *gui_thread(void *_g)
+{
+ gui *g = _g;
+ gui_loop(g);
+ return NULL;
+}
+
+static void gnb_main_gui(gnb_gui *e, gui *g, event_handler *h, void *database,
+ gnb_data *ed)
+{
+ widget *main_window;
+ widget *top_container;
+ widget *line;
+ widget *w;
+ logger *l;
+ view *v;
+
+ main_window = new_toplevel_window(g, 500, 300, "gNB tracer");
+
+ top_container = new_container(g, VERTICAL);
+ widget_add_child(g, main_window, top_container, -1);
+
+ line = new_container(g, HORIZONTAL);
+ widget_add_child(g, top_container, line, -1);
+
+ /* PUCCH/PUSCH IQ data */
+ w = new_xy_plot(g, 55, 55, "", 50);
+ e->pucch_pusch_iq_plot = w;
+ widget_add_child(g, line, w, -1);
+ xy_plot_set_range(g, w, -1000, 1000, -1000, 1000);
+ xy_plot_set_title(g, w, "rxdataF");
+ l = new_iqlog_full(h, database, "GNB_PHY_PUCCH_PUSCH_IQ", "rxdataF");
+ v = new_view_xy(300*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
+ logger_add_view(l, v);
+ e->pucch_pusch_iq_logger = l;
+}
+
+int main(int n, char **v)
+{
+ char *database_filename = NULL;
+ void *database;
+ char *ip = DEFAULT_REMOTE_IP;
+ int port = DEFAULT_REMOTE_PORT;
+ int *is_on;
+ int number_of_events;
+ int i;
+ event_handler *h;
+ gnb_data gnb_data;
+ gui *g;
+ gnb_gui eg;
+
+ for (i = 1; i < n; i++) {
+ if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
+ if (!strcmp(v[i], "-d"))
+ { if (i > n-2) usage(); database_filename = v[++i]; continue; }
+ usage();
+ }
+
+ if (database_filename == NULL) {
+ printf("ERROR: provide a database file (-d)\n");
+ exit(1);
+ }
+
+ database = parse_database(database_filename);
+
+ load_config_file(database_filename);
+
+ number_of_events = number_of_ids(database);
+ is_on = calloc(number_of_events, sizeof(int));
+ if (is_on == NULL) abort();
+
+ h = new_handler(database);
+
+ on_off(database, "GNB_PHY_PUCCH_PUSCH_IQ", is_on, 1);
+
+ gnb_data.database = database;
+ gnb_data.socket = -1;
+ gnb_data.is_on = is_on;
+ gnb_data.nevents = number_of_events;
+ if (pthread_mutex_init(&gnb_data.lock, NULL)) abort();
+
+ g = gui_init();
+ new_thread(gui_thread, g);
+
+ gnb_main_gui(&eg, g, h, database, &gnb_data);
+
+ OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
+
+restart:
+ clear_remote_config();
+ if (gnb_data.socket != -1) close(gnb_data.socket);
+ gnb_data.socket = connect_to(ip, port);
+
+ /* send the first message - activate selected traces */
+ is_on_changed(&gnb_data);
+
+ /* read messages */
+ while (1) {
+ event e;
+ e = get_event(gnb_data.socket, &ebuf, database);
+ if (e.type == -1) goto restart;
+ if (pthread_mutex_lock(&gnb_data.lock)) abort();
+ handle_event(h, e);
+ if (pthread_mutex_unlock(&gnb_data.lock)) abort();
+ }
+
+ return 0;
+}
diff --git a/common/utils/T/tracer/logger/iqlog.c b/common/utils/T/tracer/logger/iqlog.c
index 168c50e39b..1947de2bca 100644
--- a/common/utils/T/tracer/logger/iqlog.c
+++ b/common/utils/T/tracer/logger/iqlog.c
@@ -74,6 +74,44 @@ static void _event(void *p, event e)
l->common.v[i]->append(l->common.v[i], l->i, l->q, count);
}
+static void _event_full(void *p, event e)
+{
+ struct iqlog *l = p;
+ int i;
+ void *buffer;
+ int bsize;
+ int nsamples;
+ float *idst, *qdst;
+
+ if (l->common.filter != NULL && filter_eval(l->common.filter, e) == 0)
+ return;
+
+ buffer = e.e[l->buffer_arg].b;
+ bsize = e.e[l->buffer_arg].bsize;
+
+ nsamples = bsize / 4;
+
+ if (nsamples > l->max_length) {
+ l->i = realloc(l->i, nsamples * sizeof(float));
+ if (l->i == NULL) abort();
+ l->q = realloc(l->q, nsamples * sizeof(float));
+ if (l->q == NULL) abort();
+ l->max_length = nsamples;
+ }
+
+ idst = l->i;
+ qdst = l->q;
+ for (i = 0; i < nsamples; i++) {
+ *idst = ((int16_t *)buffer)[i * 2];
+ *qdst = ((int16_t *)buffer)[i * 2 + 1];
+ idst++;
+ qdst++;
+ }
+
+ for (i = 0; i < l->common.vsize; i++)
+ l->common.v[i]->append(l->common.v[i], l->i, l->q, nsamples);
+}
+
logger *new_iqlog(event_handler *h, void *database,
char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti,
char *buffer_varname)
@@ -149,3 +187,43 @@ logger *new_iqlog(event_handler *h, void *database,
return ret;
}
+
+logger *new_iqlog_full(event_handler *h, void *database, char *event_name,
+ char *buffer_varname)
+{
+ struct iqlog *ret;
+ int event_id;
+ database_event_format f;
+ int i;
+
+ ret = calloc(1, sizeof(struct iqlog)); if (ret == NULL) abort();
+
+ ret->common.event_name = strdup(event_name);
+ if (ret->common.event_name == NULL) abort();
+ ret->database = database;
+
+ event_id = event_id_from_name(database, event_name);
+
+ ret->common.handler_id = register_handler_function(h, event_id, _event_full,
+ ret);
+
+ f = get_format(database, event_id);
+
+ /* look for args */
+ ret->buffer_arg = -1;
+ for (i = 0; i < f.count; i++) {
+ if (!strcmp(f.name[i], buffer_varname)) ret->buffer_arg = i;
+ }
+ if (ret->buffer_arg == -1) {
+ printf("%s:%d: buffer argument '%s' not found in event '%s'\n",
+ __FILE__, __LINE__, buffer_varname, event_name);
+ abort();
+ }
+ if (strcmp(f.type[ret->buffer_arg], "buffer") != 0) {
+ printf("%s:%d: argument '%s' has wrong type (should be 'buffer')\n",
+ __FILE__, __LINE__, buffer_varname);
+ abort();
+ }
+
+ return ret;
+}
diff --git a/common/utils/T/tracer/logger/logger.h b/common/utils/T/tracer/logger/logger.h
index 7c019b4797..d746161e70 100644
--- a/common/utils/T/tracer/logger/logger.h
+++ b/common/utils/T/tracer/logger/logger.h
@@ -23,6 +23,8 @@ logger *new_ticklog(void *event_handler, void *database,
logger *new_iqlog(void *event_handler, void *database,
char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti,
char *buffer_varname);
+logger *new_iqlog_full(void *event_handler, void *database, char *event_name,
+ char *buffer_varname);
logger *new_iqdotlog(void *event_handler, void *database,
char *event_name, char *I, char *Q);
diff --git a/common/utils/assertions.h b/common/utils/assertions.h
index 48d8df401c..06d43bdbfa 100644
--- a/common/utils/assertions.h
+++ b/common/utils/assertions.h
@@ -39,7 +39,7 @@ void output_log_mem(void);
display_backtrace(); \
fflush(stdout); \
fflush(stderr); \
- exit(EXIT_FAILURE); \
+ abort();
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
diff --git a/common/utils/backtrace.c b/common/utils/backtrace.c
index f6de74f156..f61cf0349a 100644
--- a/common/utils/backtrace.c
+++ b/common/utils/backtrace.c
@@ -38,7 +38,7 @@ void display_backtrace(void) {
size_t i;
char *test=getenv("NO_BACKTRACE");
- if (test!=0) *((int *)0)=0;
+ if (test!=0) abort();
size = backtrace(array, 10);
strings = backtrace_symbols(array, size);
diff --git a/common/utils/lte/prach_utils.c b/common/utils/lte/prach_utils.c
new file mode 100644
index 0000000000..9ef29e55a5
--- /dev/null
+++ b/common/utils/lte/prach_utils.c
@@ -0,0 +1,425 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file common/utils/lte/prach_utils.c
+ * \brief utils for PRACH common to both PHY and MAC
+ * \author R. Knopp
+ * \date 2020
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include
+
+
+#include "PHY/LTE_TRANSPORT/transport_common.h"
+
+// This is table 5.7.1-4 from 36.211
+PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = {
+ // TDD Configuration Index 0
+ { {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}},
+ // TDD Configuration Index 1
+ { {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}},
+ // TDD Configuration Index 2
+ { {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}},
+ // TDD Configuration Index 3
+ { {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}},
+ // TDD Configuration Index 4
+ { {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}},
+ // TDD Configuration Index 5
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+ // TDD Configuration Index 6
+ { {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}},
+ // TDD Configuration Index 7
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+ // TDD Configuration Index 8
+ { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}},
+ // TDD Configuration Index 9
+ { {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}},
+ // TDD Configuration Index 10
+ { {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}},
+ // TDD Configuration Index 11
+ { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}},
+ // TDD Configuration Index 12
+ { {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}},
+ {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}},
+ {4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 13
+ { {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 14
+ { {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 15
+ { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}},
+ {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}},
+ {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}},
+ {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}}
+ },
+ // TDD Configuration Index 16
+ { {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}},
+ {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}},
+ {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
+ },
+ // TDD Configuration Index 17
+ { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}
+ },
+ // TDD Configuration Index 18
+ { {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}},
+ {6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}}
+ },
+ // TDD Configuration Index 19
+ { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}
+ },
+ // TDD Configuration Index 20
+ { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
+ // TDD Configuration Index 21
+ { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
+
+ // TDD Configuration Index 22
+ { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
+
+ // TDD Configuration Index 23
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+
+ // TDD Configuration Index 24
+ { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
+
+ // TDD Configuration Index 25
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+
+ // TDD Configuration Index 26
+ { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
+
+ // TDD Configuration Index 27
+ { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
+ },
+
+ // TDD Configuration Index 28
+ { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
+ {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
+ },
+
+ // TDD Configuration Index 29
+ { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
+ },
+
+
+ // TDD Configuration Index 30
+ { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}},
+
+ // TDD Configuration Index 31
+ { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}},
+
+ // TDD Configuration Index 32
+ { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}},
+
+ // TDD Configuration Index 33
+ { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}},
+
+ // TDD Configuration Index 34
+ { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}},
+
+ // TDD Configuration Index 35
+ { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}},
+
+ // TDD Configuration Index 36
+ { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}},
+
+ // TDD Configuration Index 37
+ { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}}
+ },
+
+ // TDD Configuration Index 38
+ { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}},
+ {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}}
+ },
+
+ // TDD Configuration Index 39
+ { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}},
+ {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}},
+ {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}}
+ },
+
+ // TDD Configuration Index 40
+ { {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}},
+ // TDD Configuration Index 41
+ { {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}},
+
+ // TDD Configuration Index 42
+ { {1,{{0,1,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 43
+ { {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 44
+ { {1,{{0,0,1,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}},
+
+ // TDD Configuration Index 45
+ { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}},
+
+ // TDD Configuration Index 46
+ { {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}},
+
+ // TDD Configuration Index 47
+ { {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}},
+ {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}
+ }
+};
+
+
+uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type) {
+ if (frame_type == FDD) // FDD
+ return(prach_ConfigIndex>>4);
+ else {
+ if (prach_ConfigIndex < 20)
+ return (0);
+
+ if (prach_ConfigIndex < 30)
+ return (1);
+
+ if (prach_ConfigIndex < 40)
+ return (2);
+
+ if (prach_ConfigIndex < 48)
+ return (3);
+ else
+ return (4);
+ }
+}
+
+uint8_t get_prach_prb_offset(int frame_type,
+ int tdd_config,
+ int N_RB_UL,
+ uint8_t prach_ConfigIndex,
+ uint8_t n_ra_prboffset,
+ uint8_t tdd_mapindex, uint16_t Nf) {
+ uint8_t n_ra_prb;
+ uint8_t f_ra,t1_ra;
+ uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
+ uint8_t Nsp=2;
+
+ if (frame_type == TDD) { // TDD
+ if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
+ LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex);
+ return(-1);
+ }
+
+ // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
+ f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
+
+ if (prach_fmt < 4) {
+ if ((f_ra&1) == 0) {
+ n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
+ } else {
+ n_ra_prb = N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
+ }
+ } else {
+ if ((tdd_config >2) && (tdd_config<6))
+ Nsp = 2;
+
+ t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
+
+ if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
+ n_ra_prb = 6*f_ra;
+ } else {
+ n_ra_prb = N_RB_UL - 6*(f_ra+1);
+ }
+ }
+ } else { //FDD
+ n_ra_prb = n_ra_prboffset;
+ }
+
+ return(n_ra_prb);
+}
+
+int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) {
+ uint8_t t0_ra;
+ uint8_t t1_ra;
+ uint8_t t2_ra;
+ int prach_mask = 0;
+
+ if (frame_type == FDD) { //FDD
+ //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
+ if ((((frame&1) == 1) && (subframe < 9)) ||
+ (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames
+ if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
+ ((prach_ConfigIndex&0x1f)==18) || // 18,50
+ ((prach_ConfigIndex&0xf)==15)) // 15,47
+ return(0);
+
+ switch (prach_ConfigIndex&0x1f) {
+ case 0:
+ case 3:
+ if (subframe==1) prach_mask = 1;
+
+ break;
+
+ case 1:
+ case 4:
+ if (subframe==4) prach_mask = 1;
+
+ break;
+
+ case 2:
+ case 5:
+ if (subframe==7) prach_mask = 1;
+
+ break;
+
+ case 6:
+ if ((subframe==1) || (subframe==6)) prach_mask=1;
+
+ break;
+
+ case 7:
+ if ((subframe==2) || (subframe==7)) prach_mask=1;
+
+ break;
+
+ case 8:
+ if ((subframe==3) || (subframe==8)) prach_mask=1;
+
+ break;
+
+ case 9:
+ if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
+
+ break;
+
+ case 10:
+ if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
+
+ break;
+
+ case 11:
+ if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
+
+ break;
+
+ case 12:
+ if ((subframe&1)==0) prach_mask=1;
+
+ break;
+
+ case 13:
+ if ((subframe&1)==1) prach_mask=1;
+
+ break;
+
+ case 14:
+ prach_mask=1;
+ break;
+
+ case 15:
+ if (subframe==9) prach_mask=1;
+
+ break;
+ }
+ } else { // TDD
+ AssertFatal(prach_ConfigIndex<64,
+ "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
+ AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
+ "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
+ t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
+ t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
+ t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
+#ifdef PRACH_DEBUG
+ LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
+ prach_ConfigIndex,
+ subframe,
+ t0_ra,t1_ra,t2_ra);
+#endif
+
+ if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames
+ ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames
+ (t0_ra == 0)) && // PRACH is in all frames
+ (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame
+ (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame
+ if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe
+ (((subframe%5)-2)==t2_ra)) prach_mask=1;
+ else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS
+ }
+ }
+
+ return(prach_mask);
+}
+
diff --git a/common/utils/lte/prach_utils.h b/common/utils/lte/prach_utils.h
new file mode 100644
index 0000000000..995805fbd2
--- /dev/null
+++ b/common/utils/lte/prach_utils.h
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file common/utils/prach_utils.h
+* \brief computation of some PRACH variables used in both MAC and PHY
+* \author R. Knopp
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
+* \note
+* \warning
+*/
+uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type);
+
+uint8_t get_prach_prb_offset(int frame_type,
+ int tdd_config,
+ int N_RB_UL,
+ uint8_t prach_ConfigIndex,
+ uint8_t n_ra_prboffset,
+ uint8_t tdd_mapindex, uint16_t Nf);
+int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe);
diff --git a/common/utils/lte/ue_power.c b/common/utils/lte/ue_power.c
new file mode 100644
index 0000000000..b377abf2ff
--- /dev/null
+++ b/common/utils/lte/ue_power.c
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file ue_power.c
+* \brief Routines to compute UE TX power according to 36.213
+* \author R. Knopp, F. Kaltenberger
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \note
+* \warning
+*/
+
+#include
+#include
+#include "PHY/defs_eNB.h"
+#include "PHY/TOOLS/dB_routines.h"
+
+extern int16_t hundred_times_delta_TF[100];
+extern uint16_t hundred_times_log10_NPRB[100];
+
+int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs)
+{
+
+ /// The payload + CRC size in bits, "B"
+ uint32_t B;
+ /// Number of code segments
+ uint32_t C;
+ /// Number of "small" code segments
+ uint32_t Cminus;
+ /// Number of "large" code segments
+ uint32_t Cplus;
+ /// Number of bits in "small" code segments (<6144)
+ uint32_t Kminus;
+ /// Number of bits in "large" code segments (<6144)
+ uint32_t Kplus;
+ /// Total number of bits across all segments
+ uint32_t sumKr;
+ /// Number of "Filler" bits
+ uint32_t F;
+ // num resource elements
+ uint32_t num_re=0.0;
+ // num symbols
+ uint32_t num_symb=0.0;
+ /// effective spectral efficiency of the PUSCH
+ uint32_t MPR_x100=0;
+ /// beta_offset
+ uint16_t beta_offset_pusch_x8=8;
+ /// delta mcs
+ float delta_mcs=0.0;
+ /// bandwidth factor
+ float bw_factor=0.0;
+
+ B= tbs+24;
+ lte_segmentation(NULL,
+ NULL,
+ B,
+ &C,
+ &Cplus,
+ &Cminus,
+ &Kplus,
+ &Kminus,
+ &F);
+
+
+ sumKr = Cminus*Kminus + Cplus*Kplus;
+ num_symb = 12-(ncp<<1)-(use_srs==0?0:1);
+ num_re = num_symb * nb_rb * 12;
+
+ if (num_re == 0)
+ return(0);
+
+ MPR_x100 = 100*sumKr/num_re;
+
+ if (control_only == 1 )
+ beta_offset_pusch_x8=8; // fixme
+
+ //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
+
+ // if deltamcs_enabledm
+ delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0);
+
+ bw_factor = (norm!=0) ? 0 : (hundred_times_log10_NPRB[nb_rb-1]/100.0);
+ LOG_D(PHY,"estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n",
+ (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor);
+ return (int16_t)ceil(delta_mcs + bw_factor);
+
+}
+
diff --git a/common/utils/lte/ue_power.h b/common/utils/lte/ue_power.h
new file mode 100644
index 0000000000..caeebec2c8
--- /dev/null
+++ b/common/utils/lte/ue_power.h
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file ue_power.h
+* \brief support routines used in MAC and PHY
+* \author R. Knopp, F. Kaltenberger
+* \date 2020
+* \version 0.1
+* \company Eurecom
+* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+* \note
+* \warning
+*/
+
+int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
+
diff --git a/common/utils/minimal_stub.c b/common/utils/minimal_stub.c
index 86454fe53f..79e35bf7a6 100644
--- a/common/utils/minimal_stub.c
+++ b/common/utils/minimal_stub.c
@@ -1,4 +1,6 @@
+#ifndef T_TRACER
int T_stdout;
+#endif
void exit_function(const char *file, const char *function, const int line, const char *s) {
}
diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c
index 7cc5f79f90..84b723b022 100644
--- a/common/utils/msc/msc.c
+++ b/common/utils/msc/msc.c
@@ -52,6 +52,7 @@
FILE *g_msc_fd;
char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH];
+msc_interface_t msc_interface;
typedef unsigned long msc_message_number_t;
typedef struct msc_queue_item_s {
diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h
index aab872cfe1..adb0d9e657 100644
--- a/common/utils/msc/msc.h
+++ b/common/utils/msc/msc.h
@@ -117,7 +117,7 @@ void msc_log_message(
#define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded
-msc_interface_t msc_interface;
+extern msc_interface_t msc_interface;
#define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2)
#define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use
#define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end
diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c
index 5f07fc00aa..cc2860191a 100644
--- a/common/utils/nr/nr_common.c
+++ b/common/utils/nr/nr_common.c
@@ -32,12 +32,85 @@
#include
#include "assertions.h"
+#include "nr_common.h"
+
+// Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101)
+// Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101)
+// Notes:
+// - N_OFFs for bands from 80 to 89 and band 95 is referred to UL
+// - Frequencies are expressed in KHz
+// - col: NR_band ul_min ul_max dl_min dl_max step N_OFFs_DL deltaf_raster
+nr_bandentry_t nr_bandtable[] = {
+ {1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100},
+ {2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100},
+ {3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100},
+ {5, 824000, 849000, 869000, 894000, 20, 173800, 100},
+ {7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100},
+ {8, 880000, 915000, 925000, 960000, 20, 185000, 100},
+ {12, 698000, 716000, 729000, 746000, 20, 145800, 100},
+ {14, 788000, 798000, 758000, 768000, 20, 151600, 100},
+ {18, 815000, 830000, 860000, 875000, 20, 172000, 100},
+ {20, 832000, 862000, 791000, 821000, 20, 158200, 100},
+ {25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100},
+ {26, 814000, 849000, 859000, 894000, 20, 171800, 100},
+ {28, 703000, 758000, 758000, 813000, 20, 151600, 100},
+ {29, 000, 000, 717000, 728000, 20, 143400, 100},
+ {30, 2305000, 2315000, 2350000, 2360000, 20, 470000, 100},
+ {34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100},
+ {38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100},
+ {39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100},
+ {40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100},
+ {41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
+ {41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
+ {47, 5855000, 5925000, 5855000, 5925000, 1, 790334, 15},
+ //{48, 3550000, 3700000, 3550000, 3700000, 1, 636667, 15},
+ //{48, 3550000, 3700000, 3550000, 3700000, 2, 636668, 30},
+ {50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100},
+ {51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100},
+ {53, 2483500, 2495000, 2483500, 2495000, 20, 496700, 100},
+ {65, 1920000, 2010000, 2110000, 2200000, 20, 422000, 100},
+ {66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100},
+ {70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100},
+ {71, 663000, 698000, 617000, 652000, 20, 123400, 100},
+ {74, 1427000, 1470000, 1475000, 1518000, 20, 295000, 100},
+ {75, 000, 000, 1432000, 1517000, 20, 286400, 100},
+ {76, 000, 000, 1427000, 1432000, 20, 285400, 100},
+ {77, 3300000, 4200000, 3300000, 4200000, 1, 620000, 15},
+ {77, 3300000, 4200000, 3300000, 4200000, 2, 620000, 30},
+ {78, 3300000, 3800000, 3300000, 3800000, 1, 620000, 15},
+ {78, 3300000, 3800000, 3300000, 3800000, 2, 620000, 30},
+ {79, 4400010, 5000000, 4400010, 5000000, 1, 693334, 15},
+ {79, 4400010, 5000000, 4400010, 5000000, 2, 693334, 30},
+ {80, 1710000, 1785000, 000, 000, 20, 342000, 100},
+ {81, 880000, 915000, 000, 000, 20, 176000, 100},
+ {82, 832000, 862000, 000, 000, 20, 166400, 100},
+ {83, 703000, 748000, 000, 000, 20, 140600, 100},
+ {84, 1920000, 1980000, 000, 000, 20, 384000, 100},
+ {86, 1710000, 1785000, 000, 000, 20, 342000, 100},
+ {89, 824000, 849000, 000, 000, 20, 342000, 100},
+ {90, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
+ {90, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
+ {90, 2496000, 2690000, 2496000, 2690000, 20, 499200, 100},
+ {91, 832000, 862000, 1427000, 1432000, 20, 285400, 100},
+ {92, 832000, 862000, 1432000, 1517000, 20, 286400, 100},
+ {93, 880000, 915000, 1427000, 1432000, 20, 285400, 100},
+ {94, 880000, 915000, 1432000, 1517000, 20, 286400, 100},
+ {95, 2010000, 2025000, 000, 000, 20, 402000, 100},
+ {257,26500020,29500000,26500020,29500000, 1,2054166, 60},
+ {257,26500080,29500000,26500080,29500000, 2,2054167, 120},
+ {258,24250080,27500000,24250080,27500000, 1,2016667, 60},
+ {258,24250080,27500000,24250080,27500000, 2,2016667, 120},
+ {260,37000020,40000000,37000020,40000000, 1,2229166, 60},
+ {260,37000080,40000000,37000080,40000000, 2,2229167, 120},
+ {261,27500040,28350000,27500040,28350000, 1,2070833, 60},
+ {261,27500040,28350000,27500040,28350000, 2,2070833, 120}
+};
+
+const size_t nr_bandtable_size = sizeof(nr_bandtable) / sizeof(nr_bandentry_t);
int NRRIV2BW(int locationAndBandwidth,int N_RB) {
int tmp = locationAndBandwidth/N_RB;
int tmp2 = locationAndBandwidth%N_RB;
-
-
if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)>1)+1) && (tmp+tmp2)
#include "assertions.h"
+typedef struct nr_bandentry_s {
+ int16_t band;
+ uint64_t ul_min;
+ uint64_t ul_max;
+ uint64_t dl_min;
+ uint64_t dl_max;
+ uint64_t step_size;
+ uint64_t N_OFFs_DL;
+ uint8_t deltaf_raster;
+} nr_bandentry_t;
+
+extern const size_t nr_bandtable_size;
+extern nr_bandentry_t nr_bandtable[];
+
int NRRIV2BW(int locationAndBandwidth,int N_RB);
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize);
diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp
index 318e4e9369..4239d1f42e 100644
--- a/common/utils/ocp_itti/intertask_interface.cpp
+++ b/common/utils/ocp_itti/intertask_interface.cpp
@@ -136,7 +136,7 @@ extern "C" {
LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s );
if ( s > 50 )
- LOG_I(TMR,"Queue for %s task size: %ld\n",itti_get_task_name(destination_task_id), s+1);
+ LOG_I(TMR,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message));
t->message_queue.insert(t->message_queue.begin(), message);
eventfd_t sem_counter = 1;
@@ -339,7 +339,9 @@ extern "C" {
int itti_create_queue(const task_info_t *taskInfo) {
pthread_mutex_lock (&lock_nb_queues);
int newQueue=nb_queues++;
- AssertFatal(tasks=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)),"");
+ task_list_t **new_tasks = (task_list_t **)realloc(tasks, nb_queues * sizeof(*tasks));
+ AssertFatal(new_tasks != NULL, "could not realloc() tasks list");
+ tasks = new_tasks;
tasks[newQueue]= new task_list_t;
pthread_mutex_unlock (&lock_nb_queues);
LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue);
diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h
index cab545bb82..3188e5889f 100644
--- a/common/utils/ocp_itti/intertask_interface.h
+++ b/common/utils/ocp_itti/intertask_interface.h
@@ -340,6 +340,7 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
+ TASK_DEF(OCP_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\
TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
@@ -347,6 +348,7 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_RRC_GNB_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_NSA_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_NSA_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
+ TASK_DEF(TASK_NAS_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL)
#define TASK_DEF(TaskID, pRIO, qUEUEsIZE, FuNc, ThreadFunc) { pRIO, qUEUEsIZE, #TaskID, FuNc, ThreadFunc },
@@ -475,6 +477,9 @@ void itti_subscribe_event_fd(task_id_t task_id, int fd);
void itti_unsubscribe_event_fd(task_id_t task_id, int fd);
/** \brief Return the list of events excluding the fd associated with itti
+ \the fd associated with itti can return, but it is marked events[i].events &= ~EPOLLIN
+ \as it is not EPOLLIN, the reader should ignore this fd
+ \or it can manage the list of fd's in his interest, so ignore the other ones
\param task_id Task ID of the task
\param events events list
@returns number of events to handle
diff --git a/common/utils/system.c b/common/utils/system.c
index 1bd5c7d39b..d8b66c51d3 100644
--- a/common/utils/system.c
+++ b/common/utils/system.c
@@ -96,6 +96,54 @@ static void read_pipe(int p, char *b, int size) {
}
}
+static int baseRunTimeCommand(char* cmd, size_t cmdSize) {
+ FILE *fp;
+ size_t retSize = 0;
+
+ fp = popen(cmd, "r");
+ if(fp) {
+ memset(cmd, 0, cmdSize);
+ retSize = fread(cmd, 1, cmdSize, fp);
+ fclose(fp);
+ } else {
+ LOG_D(HW,"%s:%d:%s: Cannot open %s\n", __FILE__, __LINE__, __FUNCTION__, cmd);
+ }
+
+ if (retSize == 0) {
+ return 0;
+ }
+ return atoi(cmd);
+}
+
+int checkIfFedoraDistribution(void) {
+ char cmd[200];
+
+ memset(cmd, 0, 200);
+ sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora || true");
+ return baseRunTimeCommand(cmd, 200);
+}
+
+int checkIfGenericKernelOnFedora(void) {
+ char cmd[200];
+
+ memset(cmd, 0, 200);
+ sprintf(cmd, "uname -a | grep -c rt || true");
+ return (1 - baseRunTimeCommand(cmd, 200));
+}
+
+int checkIfInsideContainer(void) {
+ char cmd[200];
+ int res = 0;
+
+ memset(cmd, 0, 200);
+ sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods' || true");
+ res = baseRunTimeCommand(cmd, 200);
+ if (res > 0)
+ return 1;
+ else
+ return 0;
+}
+
/********************************************************************/
/* background process */
/********************************************************************/
@@ -199,15 +247,41 @@ void start_background_system(void) {
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){
pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
- pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
- struct sched_param sparam={0};
- sparam.sched_priority = priority;
- pthread_attr_setschedparam(&attr, &sparam);
+ int ret;
+ int settingPriority = 1;
+ ret=pthread_attr_init(&attr);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ if (checkIfFedoraDistribution())
+ if (checkIfGenericKernelOnFedora())
+ if (checkIfInsideContainer())
+ settingPriority = 0;
- pthread_create(t, &attr, func, param);
+ if (settingPriority) {
+ ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ if(prioritysched_get_priority_max(SCHED_FIFO)) {
+ LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n",
+ priority,
+ sched_get_priority_min(SCHED_OAI),
+ sched_get_priority_max(SCHED_OAI));
+ if(prioritysched_get_priority_max(SCHED_OAI))
+ priority=sched_get_priority_max(SCHED_OAI);
+ }
+ AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),"");
+ struct sched_param sparam={0};
+ sparam.sched_priority = priority;
+ ret=pthread_attr_setschedparam(&attr, &sparam);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
+ }
+
+ ret=pthread_create(t, &attr, func, param);
+ AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
pthread_setname_np(*t, name);
if (affinity != -1 ) {
@@ -216,7 +290,6 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
CPU_SET(affinity, &cpuset);
AssertFatal( pthread_setaffinity_np(*t, sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity");
}
-
pthread_attr_destroy(&attr);
}
diff --git a/common/utils/system.h b/common/utils/system.h
index a89a6c5b17..c76fef9144 100644
--- a/common/utils/system.h
+++ b/common/utils/system.h
@@ -46,9 +46,11 @@ void set_latency_target(void);
void configure_linux(void);
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority);
-#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_FIFO)
-#define OAI_PRIORITY_RT sched_get_priority_max(SCHED_FIFO)-10
-#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_FIFO)
+
+#define SCHED_OAI SCHED_RR
+#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI)
+#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_max(SCHED_OAI))/2)
+#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_OAI)-2
void thread_top_init(char *thread_name,
int affinity,
@@ -56,6 +58,14 @@ void thread_top_init(char *thread_name,
uint64_t deadline,
uint64_t period);
+/****************************************************
+ * Functions to check system at runtime.
+ ****************************************************/
+
+int checkIfFedoraDistribution(void);
+int checkIfGenericKernelOnFedora(void);
+int checkIfInsideContainer(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c
index 03f7af99bc..734126721a 100644
--- a/common/utils/telnetsrv/telnetsrv.c
+++ b/common/utils/telnetsrv/telnetsrv.c
@@ -461,12 +461,12 @@ int process_command(char *buf) {
int i,j,k;
char modulename[TELNET_CMD_MAXSIZE];
char cmd[TELNET_CMD_MAXSIZE];
- char cmdb[TELNET_MAX_MSGLENGTH];
+ char *cmdb=NULL;
char *bufbck;
int rt;
memset(modulename,0,sizeof(modulename));
memset(cmd,0,sizeof(cmd));
- memset(cmdb,0,sizeof(cmdb));
+
if (strncasecmp(buf,"ex",2) == 0)
return CMDSTATUS_EXIT;
@@ -490,12 +490,10 @@ int process_command(char *buf) {
return CMDSTATUS_FOUND;
}
- memset(modulename,0,sizeof(modulename));
- memset(cmd,0,sizeof(cmd));
- memset(cmdb,0,sizeof(cmdb));
+
bufbck=strdup(buf);
rt=CMDSTATUS_NOTFOUND;
- j = sscanf(buf,"%19s %19s %19[^\t\n]",modulename,cmd,cmdb);
+ j = sscanf(buf,"%19s %19s %m[^\t\n]",modulename,cmd,&cmdb);
if (telnetparams.telnetdbg > 0)
printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb);
@@ -562,7 +560,7 @@ int process_command(char *buf) {
rt= CMDSTATUS_FOUND;
} /* loop */
} /* for i */
-
+ free(cmdb);
free(bufbck);
return rt;
}
@@ -702,7 +700,7 @@ void poll_telnetcmdq(void *qid, void *arg) {
*/
void exec_moduleinit(char *modname) {
void (*fptr)(void);
- char initfunc[TELNET_CMD_MAXSIZE+9];
+ char initfunc[TELNET_CMD_MAXSIZE+10];
if (strlen(modname) > TELNET_CMD_MAXSIZE) {
fprintf(stderr,"[TELNETSRV] module %s not loaded, name exceeds the %i size limit\n",
diff --git a/common/utils/telnetsrv/telnetsrv.h b/common/utils/telnetsrv/telnetsrv.h
index b66641d5c8..59655501d3 100644
--- a/common/utils/telnetsrv/telnetsrv.h
+++ b/common/utils/telnetsrv/telnetsrv.h
@@ -31,6 +31,7 @@
#ifndef TELNETSRV_H
#define TELNETSRV_H
+#include
#define TELNETSRV_MODNAME "telnetsrv"
#define TELNET_PORT 9090
diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h
index 5db1a5e34e..a32b7c3859 100644
--- a/common/utils/threadPool/thread-pool.h
+++ b/common/utils/threadPool/thread-pool.h
@@ -37,14 +37,21 @@
#else
#define THREADINIT PTHREAD_MUTEX_INITIALIZER
#endif
-#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,"");
-#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,"");
-#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,"");
+#define mutexinit(mutex) {int ret=pthread_mutex_init(&mutex,NULL); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define condinit(signal) {int ret=pthread_cond_init(&signal,NULL); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define mutexlock(mutex) {int ret=pthread_mutex_lock(&mutex); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
#define mutextrylock(mutex) pthread_mutex_trylock(&mutex)
-#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,"");
-#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,"");
-#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
-#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
+#define mutexunlock(mutex) {int ret=pthread_mutex_unlock(&mutex); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define condwait(condition, mutex) {int ret=pthread_cond_wait(&condition, &mutex); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define condbroadcast(signal) {int ret=pthread_cond_broadcast(&signal); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
+#define condsignal(signal) {int ret=pthread_cond_broadcast(&signal); \
+ AssertFatal(ret==0,"ret=%d\n",ret);}
#define tpool_nbthreads(tpool) (tpool.nbThreads)
typedef struct notifiedFIFO_elt_s {
struct notifiedFIFO_elt_s *next;
@@ -78,7 +85,7 @@ static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size,
ret->reponseFifo=reponseFifo;
ret->processingFunc=processingFunc;
// We set user data piece aligend 32 bytes to be able to process it with SIMD
- ret->msgData=(void *)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32;
+ ret->msgData=(void *)((uint8_t*)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32);
ret->malloced=true;
return ret;
}
diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md
index a087b989fa..f2422d9822 100644
--- a/common/utils/threadPool/thread-pool.md
+++ b/common/utils/threadPool/thread-pool.md
@@ -210,8 +210,8 @@ time the worker finished the job
time the client reads the result
if you set the environement variable:
-thread-pool-measurements to a valid file name
+threadPoolMeasurements to a valid file name
These measurements will be wrote to this Linux pipe.
-A tool to read the linux fifo and display it in ascii is provided:
-see the local directory Makefile for this tool and to compile the thread pool unitary tests.
+A tool to read the linux fifo and display it in ascii is provided; compute the binay:
+in cmake building directory: make/ninja measurement_display
diff --git a/common/utils/utils.h b/common/utils/utils.h
index 2b7995a9f9..9295ab7b54 100644
--- a/common/utils/utils.h
+++ b/common/utils/utils.h
@@ -7,6 +7,7 @@
extern "C" {
#endif
+#define sizeofArray(a) (sizeof(a)/sizeof(*(a)))
void *calloc_or_fail(size_t size);
void *malloc_or_fail(size_t size);
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len);
diff --git a/configuration/bladeRF/enb-band7-5mhz.conf b/configuration/bladeRF/enb-band7-5mhz.conf
index 9156a74fb0..9d19207522 100644
--- a/configuration/bladeRF/enb-band7-5mhz.conf
+++ b/configuration/bladeRF/enb-band7-5mhz.conf
@@ -238,7 +238,7 @@ MACRLCs = (
THREAD_STRUCT = (
{
parallel_config = "PARALLEL_RU_L1_TRX_SPLITaaaaaa";
- worker_config = "ENABLE";
+ worker_config = "WORKER_ENABLE";
}
);
diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md
index 2171fc2f1f..c2f3833203 100644
--- a/doc/FEATURE_SET.md
+++ b/doc/FEATURE_SET.md
@@ -257,7 +257,7 @@ The following features are valid for the gNB and the 5G-NR UE.
* FDD
* Normal CP
* 30 kHz subcarrier spacing
-* Bandwidths up to 80MHz (217 Physical Resource Blocks)
+* Bandwidths: 10, 20, 40, 80, 100MHz (273 Physical Resource Blocks)
* Intermediate downlink and uplink frequencies to interface with IF equipment
* Single antenna port (single beam)
* Slot format: 14 OFDM symbols in UL or DL
@@ -277,10 +277,20 @@ The following features are valid for the gNB and the 5G-NR UE.
- user-specific search space configured by RRC
- DCI formats: 00, 10 (01 and 11 **under integration**)
* Generation of NR-PDSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc).
- - Single symbol DMRS, DMRS-TypeA-Position Pos2, DMRS configuration type 1
- - PDSCH mapping type A
-* NR-CSI Generation of sequence at PHY (**under integration**)
+ - PDSCH mapping type A and B
+ - DMRS configuration type 1 and 2
+ - Single and multiple DMRS symbols
+ - PTRS support
+ - Support for 1, 2 and 4 TX antennas
+ - Support for up to 2 layers (currently limited to DMRS configuration type 2)
+* NR-CSIRS Generation of sequence at PHY
* NR-PUSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc).
+ - PUSCH mapping type A and B
+ - DMRS configuration type 1 and 2
+ - Single and multiple DMRS symbols
+ - PTRS support
+ - Support for 1 RX antenna
+ - Support for 1 layer
* NR-PUCCH
- Format 0 (2 bits, mainly for ACK/NACK)
- Format 2 (up to 64 bits, mainly for CSI feedback)
@@ -309,6 +319,7 @@ The following features are valid for the gNB and the 5G-NR UE.
- MAC <-> PHY data interface using FAPI P7 interface for BCH PDU, DCI PDU, PDSCH PDU
- Scheduler procedures for SIB1
- Scheduler procedures for RA
+- Scheduler procedures for CSI-RS
- MAC downlink scheduler (fixed allocations)
- MAC header generation (including timing advance)
- ACK / NACK handling and HARQ procedures for downlink
@@ -320,27 +331,32 @@ The following features are valid for the gNB and the 5G-NR UE.
- Creates TUN interface to PDCP to inject and receive user-place traffic
- Will only work with OAI gNB configured in the same mode
-## UE PHY Layer ##
+## NR UE PHY Layer ##
* Initial synchronization
* Time tracking based on PBCH DMRS
-* Time tracking based on PBCH DMRS
* Frequency offset estimation
-* PBCH RX
-* PDCCH RX
-* PDSCH RX, including a first version of dual stream receiver for PDSCH
* 30KHz SCS for FR1 and 120 KHz SCS for FR2
-* Generation of NR-PSS/NR-SSS
+* Reception of NR-PSS/NR-SSS
* NR-PBCH supports multiple SSBs and flexible periodicity
-* Generation of NR-PDCCH for SIB1 (including generation of DCI, polar encoding, scrambling, modulation, RB mapping, etc)
+* Reception of NR-PDCCH for SIB1 (including reception of DCI, polar decoding, de-scrambling, de-modulation, RB de-mapping, etc)
- common search space configured by MIB
- user-specific search space configured by RRC
- DCI formats: 00, 10 (01 and 11 **under integration**)
-* Generation of NR-PDSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc).
- - Single symbol DMRS, DMRS-TypeA-Position Pos2, DMRS configuration type 1
- - PDSCH mapping type A
-* NR-CSI Generation of sequence at PHY (**under integration**)
+* Reception of NR-PDSCH (including Segmentation, LDPC decoding, rate de-matching, de-scrambling, de-modulation, RB de-mapping, etc).
+ - PDSCH mapping type A and B
+ - DMRS configuration type 1 and 2
+ - Single and multiple DMRS symbols
+ - PTRS support
+ - Support for 1, 2 and 4 RX antennas
+ - Support for up to 2 layers (currently limited to DMRS configuration type 2)
* NR-PUSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc).
+ - PUSCH mapping type A and B
+ - DMRS configuration type 1 and 2
+ - Single and multiple DMRS symbols
+ - PTRS support
+ - Support for 1 TX antenna
+ - Support for 1 layer
* NR-PUCCH
- Format 0 (2 bits, mainly for ACK/NACK)
- Format 2 (up to 64 bits, mainly for CSI feedback)
@@ -351,7 +367,7 @@ The following features are valid for the gNB and the 5G-NR UE.
* Encoder and decoder for short block
-## UE Higher Layers ##
+## NR UE Higher Layers ##
**UE MAC**
* Minimum system information (MSI)
diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md
index d13b193ff9..dc7a982310 100644
--- a/doc/RUNMODEM.md
+++ b/doc/RUNMODEM.md
@@ -132,23 +132,26 @@ With the RF simulator (on the same machine):
`sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --do-ra --rfsim --parallel-config PARALLEL_SINGLE_THREAD`
-## sa setup with OAI
+## SA setup with OAI
-The sa flag is used to run gNB in standalone mode. Currently OAI in NR standalone mode transmits and receives SIB1.
+The sa flag is used to run gNB in standalone mode.
-In order to run gNB in standalone mode, the following flag is needed at gNB:
+In order to run gNB and UE in standalone mode, the following flag is needed:
`--sa`
-### Run OAI in sa mode
+At the gNB the --sa flag does the following:
+- The RRC encodes SIB1 according to the configuration file and transmits it through NR-BCCH-DL-SCH.
-At the gNB the --sa flag does the following
-- it reads the RRC configuration from the configuration file
-- it encodes the RRCConfiguration and the RBconfig message and stores them in the binary files rbconfig.raw and reconfig.raw
-- the RRC encodes SIB1 according the configuration file and transmits it through PDSCH
+At the UE the --sa flag will:
+- Decode SIB1 and starts the 5G NR Initial Access Procedure for SA:
+ 1) 5G-NR RRC Connection Setup
+ 2) NAS Authentication and Security
+ 3) 5G-NR AS Security Procedure
+ 4) 5G-NR RRC Reconfiguration
+ 5) Start Downlink and Uplink Data Transfer
-At the UE the --sa flag will
-- read the binary files rbconfig.raw and reconfig.raw from the current directory (a different directory can be specified with the flag --rrc_config_path) and process them.
+### Run OAI in SA mode
From the `cmake_targets/ran_build/build` folder:
@@ -158,17 +161,17 @@ gNB on machine 1:
UE on machine 2:
-`sudo ./nr-uesoftmodem --rrc_config_path . --sa`
+`sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --sa`
With the RF simulator (on the same machine):
`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --sa`
-`sudo ./nr-uesoftmodem --rrc_config_path . --rfsim --sa`
+`sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa`
## IF setup with OAI
-The -C and -CO flags can be used together at UE side to set custom downlink and uplink FR1 intermediate frequencies for the IF equipment.
+The -C and --CO flags can be used together at UE side to set custom downlink and uplink FR1 arbitrary frequencies for the IF equipment.
In order to run this setup, the following flags are needed at the UE side:
@@ -182,9 +185,11 @@ and the following parameters must be configured in the RUs section of the gNB co
`if_offset`
-### Run OAI with custom DL/UL intermediate frequencies
+The values must be given in Hz.
-The following example uses DL frequency 2169.080 MHz and UL frequency offset -400 MHz, with a configuration file for band 66 at gNB side.
+### Run OAI with custom DL/UL arbitrary frequencies
+
+The following example uses DL frequency 2169.080 MHz and UL frequency offset -400 MHz, with a configuration file for band 66 (FDD) at gNB side.
From the `cmake_targets/ran_build/build` folder:
diff --git a/doc/SW_archi.md b/doc/SW_archi.md
index d92f802148..e5856d63bc 100644
--- a/doc/SW_archi.md
+++ b/doc/SW_archi.md
@@ -171,24 +171,31 @@ NR_sched_pusch_t (for values changing every TTI, e.g., frequency domain
allocation) and NR_sched_pusch_save_t (for values changing less frequently, at
least in FR1 [to my understanding], e.g., DMRS fields when the time domain
allocation stays between TTIs) structures. Furthermore, the preprocessor is an
-exchangeable module that might schedule differently, e.g., one user for
-phytest, multiple users in FR1, or maybe FR2: phytest is in
-nr_ul_preprocessor_phytest(), for FR1 is nr_simple_ulsch_preprocessor() [under
-development], for FR2 does not exist yet.
+exchangeable module that schedules differently based on a particular
+use-case/deployment type, e.g., one user for phytest [in
+nr_ul_preprocessor_phytest()], multiple users in FR1
+[nr_fr1_ulsch_preprocessor()], or maybe FR2 [does not exist yet]:
* calls preprocessor via pre_processor_ul(): the preprocessor is responsible
- for allocating CCEs (using allocate_nr_CCEs()). Note that we do not yet have
- scheduling requests or buffer status reports, and only one UE. E.g.,
- nr_simple_ulsch_preprocessor():
+ for allocating CCEs (using allocate_nr_CCEs()) and deciding on resource
+ allocation for the UEs including TB size. Note that we do not yet have
+ scheduling requests. What it typically does:
1) check whether the current frame/slot plus K2 is an UL slot, and return if
not.
2) Find first free start RB in vrb_map_UL, and as many free consecutive RBs
as possible.
- 3) allocate a CCE for the UE (and return if it is not possible)
- 4) Calculate DMRS stuff (nr_save_pusch_fields()) and the TBS.
- 5) Mark used resources in vrb_map_UL.
-* loop through all users: get a free HARQ PID and
- update statistics. Fill nFAPI structures directly for PUSCH, and call
- config_uldci() and fill_dci_pdu_rel15() for DCI filling and PDCCH messages.
+ 3) Either set up resource allocation directly (e.g., for a single UE,
+ phytest), or call into a function to perform actual resource allocation.
+ Currently, this is done using pf_ul() which implements a basic
+ proportional fair scheduler:
+ * for every UE, check for retransmission and allocate as necessary
+ * Calculate DMRS stuff (nr_set_pusch_semi_static())
+ * Calculate the PF coefficient and put eligible UEs into a list
+ * Allocate resources to the UE(s) with the highest coefficient
+ 4) Mark used resources in vrb_map_UL.
+* loop through all users: get a HARQ process as indicated through the
+ preprocessor, update statistics, fill nFAPI structures directly for PUSCH,
+ and call config_uldci() and fill_dci_pdu_rel15() for DCI filling and PDCCH
+ messages.
Calls nr_schedule_ue_spec(). It is divided into the "preprocessor" and the
"postprocessor": the first makes the scheduling decisions, the second fills
@@ -196,29 +203,28 @@ nFAPI structures to indicate to the PHY what it is supposed to do. To signal
which users have how many resources, the preprocessor populates the
NR_UE_sched_ctrl_t structure of affected users. In particular, the field rbSize
decides whether a user is to be allocated. Furthermore, the preprocessor is an
-exchangeable module that might schedule differently, e.g., one user for
-phytest, multiple users in FR1, or maybe FR2: phytest is in
-nr_preprocessor_phytest(), for FR1 is nr_simple_dlsch_preprocessor() [under
-development], for FR2 does not exist yet.
+exchangeable module that schedules differently based on a particular
+use-case/deployment type, e.g., one user for phytest [in
+nr_preprocessor_phytest()], multiple users in FR1
+[nr_fr1_dlsch_preprocessor()], or maybe FR2 [does not exist yet].
* calls preprocessor via pre_processor_dl(): the preprocessor is responsible
for allocating CCEs and PUCCH (using allocate_nr_CCEs() and
nr_acknack_scheduling()) and deciding on the frequency/time domain
- allocation. E.g., nr_simple_dlsch_preprocessor():
- 1) mac_rlc_status_ind() locks and checks directly inside rlc data the
- quantity of waiting data.
- 2) return from the preprocessor if there is no data and no timing advance to
- send,
- 3) otherwise, allocate a CCE for the UE (and return if it is not possible)
- 4) find a PUCCH occasion for HARQ
- 5a) check if there is a retransmission: if yes, find free resources to
- transmit using the same resources, else
- 5b) calculate the necessary RBs needed to get a TBS large enough to hold all
- data, or until no more resources are available
- 6) Mark taken resources in the vrb_map
+ allocation including the TB size. What it typically does:
+ 1) Check available resources in the vrb_map
+ 2) Checks the quantity of waiting data in RLC
+ 3) Either set up resource allocation directly (e.g., for a single UE,
+ phytest), or call into a function to perform actual resource allocation.
+ Currently, this is done using pf_dl() which implements a basic
+ proportional fair scheduler:
+ * for every UE, check for retransmission and allocate as necessary
+ * Calculate the PF coefficient and put eligible UEs into a list
+ * Allocate resources to the UE(s) with the highest coefficient
+ 4) Mark taken resources in the vrb_map
* loop through all users: check if a new TA is necessary. Then, if a user has
- allocated resources, compute its TBS, and fill nFAPI structures
- (nr_fill_nfapi_dl_pdu() to populate what should be done by the lower layers
- to make the Tx subframe). Update statistics (round, sent bytes).
+ allocated resources, update statistics (round, sent bytes), update HARQ
+ process information, and fill nFAPI structures (allocate a DCI and PDCCH
+ messages, TX_req, ...)
# RRC
RRC is a regular thread with itti loop on queue: TASK_RRC_GNB
@@ -296,6 +302,28 @@ gtp thread calls directly pdcp_data_req(), so it runs inside it's context intern
## inside other threads
gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the other threads, without mutex.
+# New GTP
+## initialization
+Coexistance until full merge with legacy GTP
+cmake new option: NEW_GTPU to use the new implementation (it changes for the entire executable)
+It is possible to use both old and new GTP in same executable because the itti task and all functions names are different
+Current status of new implementation: not tested, X2 not developped, 5G new GTP option not developped, remain issues on data coming from void: muid, enb_flag, ...
+
+ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything
+gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address
+
+newGtpuCreateTunnel() this function will replace the xxx_create_tunnel_xxx() for various cases
+This creates a outgoing context for a teid (in input), it computes and return the incoming teid that will be used for incoming packets
+These teids and in a "instance", so in a Linux socket: same teid can co-exist for different sockets
+ Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback
+stuff like enb_flag, but also mui and more important data are not given explicitly by any legacy function (gtpv1u_create_s1u_tunnel), but the legacy and the new interface to lower layer (like pdcp) require this data.
+The datamodel is still not fully understood, so this data source remain unknown
+A new parameter is the callback function: will be pdpcp_data_req() and gtpv_data_req() (x2 case) for existing implementation and later other call backs like the F1-U implementation.
+
+incoming packets
+the gtp layer retrieves the data, the teid, find out the related data: rnti, bearer and quite a lot of other parameters (not clear why, because it looks like all is statefull, so the lower layer should have the context)
+if lower layers can be stateless, it is a good idea to keep the context in the gtp layer and pass it to the callback, but the design remain obfuscated.
+
# NGAP
NGAP would be a itti thread as is S1AP (+twin thread SCTP that is almost void processing)?
About all messages are exchanged with RRC thread
diff --git a/doc/TESTING_5GSA_setup.md b/doc/TESTING_5GSA_setup.md
new file mode 100644
index 0000000000..786af5e27c
--- /dev/null
+++ b/doc/TESTING_5GSA_setup.md
@@ -0,0 +1,162 @@
+
+# OAI 5G SA tutorial [Under construction]
+
+In the following tutorial we describe how to deploy configure and test the two SA OAI setups:
+
+ - SA setup with OAI gNB and COTS UE
+ - SA setup with OAI gNB and OAI UE
+
+The operating system and hardware requirements to support OAI 5G NR are described [here](https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/5g-nr-development-and-setup).
+
+# 1. SA setup with COTS UE
+At the moment of writing this document interoperability with the following COTS UE devices is being tested:
+
+ - [Quectel RM500Q-GL](https://www.quectel.com/product/5g-rm500q-gl/)
+ - [Simcom SIMCOM8200EA](https://www.simcom.com/product/SIM8200G.html)
+ - Huawei Mate 30 Pro
+
+ End-to-end control plane signaling to achieve a 5G SA connection, UE registration and PDU session establishment with the CN, as well as some basic user-plane traffic tests have been validated so far using the Quectel module and Huawei Mate 30 pro and partially validated with SIMCOM module. In terms of interoperability with different 5G Core Networks, so far this setup has been tested with:
+
+
+ - [OAI CN](https://openairinterface.org/oai-5g-core-network-project/)
+ - Nokia SA Box
+ - [Free CN](https://www.free5gc.org/)
+
+
+ ## 1.1 gNB build and configuration
+At the moment of writing this document, most of the code to support the SA setup is not merged into develop branch yet, but it is accessible through the following branches:
+
+ - NR_SA_F1AP_5GRECORDS
+ - develop-NR_SA_F1AP_5GRECORDS (up-to-date with latest develop branch)
+
+To build the gNB executable:
+```bash
+ cd cmake_targets
+ ./build_oai -I -w USRP #For OAI first time installation only to install software dependencies
+ ./build_oai --gNB -w USRP
+```
+
+A reference configuration file for the gNB is provided [here](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop-NR_SA_F1AP_5GRECORDS/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf).
+
+
+In the following, we highlight the fields of the file that have to be configured according to the configuration and interfaces of the Core Network. First, the PLMN section has to be filled with the proper values that match the configuration of the AMF and the UE USIM.
+```bash
+ // Tracking area code, 0x0000 and 0xfffe are reserved values
+ tracking_area_code = 1;
+ plmn_list = ({
+ mcc = 208;
+ mnc = 99;
+ mnc_length = 2;
+ snssaiList = (
+ {
+ sst = 1;
+ sd = 0x1; // 0 false, else true
+ },
+ {
+ sst = 1;
+ sd = 0x112233; // 0 false, else true
+ }
+ );
+ });
+```
+Then, the source and destination IP interfaces for the communication with
+the Core Network also need to be set as shown below.
+
+```bash
+ ////////// MME parameters:
+ amf_ip_address = ( { ipv4 = "192.168.70.132";
+ ipv6 = "192:168:30::17";
+ active = "yes";
+ preference = "ipv4";
+ }
+ );
+ NETWORK_INTERFACES :
+ {
+ GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai";
+ GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24";
+ GNB_INTERFACE_NAME_FOR_NGU = "demo-oai";
+ GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24";
+ GNB_PORT_FOR_S1U = 2152; # Spec 2152
+ };
+```
+In the first part (*amf_ip_address*) we specify the IP of the AMF and in the second part (*NETWORK_INTERFACES*) we specify the gNB local interface with AMF (N2 interface) and the UPF (N3 interface).
+
+### **gNB configuration in CU/DU split mode**
+For the configuration of the gNB in CU and DU blocks the following sample configuration files are provided for the CU and DU entities respectively.
+......
+At the point of writing this document the control-plane exchanges between the CU and the DU over *F1-C* interface have been validated. The integration of *F1-U* over gtp-u for the support of data plane traffic is ongoing.
+
+## 1.2 OAI 5G Core Network installation and configuration
+The instructions for the installation of OAI CN components (AMF, SMF, NRF, UPF) using docker compose can be found [here](https://gitlab.eurecom.fr/oai/cn5g). Below are some complementary instructions which can be useful for the deployment.
+
+ ## 1.3 Execution of SA scenario
+
+After having configured the gNB, we can start the individual components in the following sequence:
+
+ - Launch Core Network
+ - Launch gNB
+ - Launch COTS UE (disable airplane mode)
+
+The execution command to start the gNB (in monolithic mode) is the following:
+```bash
+cd cmake_targets/ran_build/build
+sudo ./nr-softmodem -E --sa -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf
+```
+
+# 2. SA Setup with OAI UE
+The SA setup with OAI UE has been validated with RFSIMULATOR for the moment. The control plane for the successful UE registration and PDU Session establishment has been verified with OAI and Nokia SA Box CNs. User-plane traffic validation after the establishment of the 5G connection is still pending for this setup.
+
+In the following, we provide the instructions on how to build, configure and execute this SA setup.
+
+## 2.1 Build and configuration
+To build the gNB and OAI UE executables:
+
+```bash
+ cd cmake_targets
+ ./build_oai -I #For OAI first time installation only to install software dependencies
+ ./build_oai --gNB --nrUE -w SIMU
+```
+The gNB configuration can be performed according to what is described in section 1.1, using the same reference configuration file as with the RF scenario.
+
+### NAS configuration for the OAI UE
+At the moment, the NAS configuration parameters of the OAI UE are hardcoded in ***openair3/NAS/NR_UE/nr_nas_msg_sim.c***. More specifically:
+
+ - The SUCI (*Subscription Concealed Identifier*) corresponding to default IMSI 2089900007487 is hardcoded in functions *generateRegistrationRequest()* and *generateIdentityResponse()* through the following lines:
+```bash
+ mm_msg->registration_request.fgsmobileidentity.suci.typeofidentity = FGS_MOBILE_IDENTITY_SUCI;
+ mm_msg->registration_request.fgsmobileidentity.suci.mncdigit1 = 9;
+ mm_msg->registration_request.fgsmobileidentity.suci.mncdigit2 = 9;
+ mm_msg->registration_request.fgsmobileidentity.suci.mncdigit3 = 0xf;
+ mm_msg->registration_request.fgsmobileidentity.suci.mccdigit1 = 2;
+ mm_msg->registration_request.fgsmobileidentity.suci.mccdigit2 = 0;
+ mm_msg->registration_request.fgsmobileidentity.suci.mccdigit3 = 8;
+ mm_msg->registration_request.fgsmobileidentity.suci.schemeoutput = 0x4778;
+```
+ - USIM_API_K and OPc keys are hardcoded at the beginning of the file:
+```bash
+// USIM_API_K: fe c8 6b a6 eb 70 7e d0 89 05 75 7b 1b b4 4b 8f
+uint8_t k[16] = {0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0, 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f};
+// OPC: c4 24 49 36 3b ba d0 2b 66 d1 6b c9 75 d7 7c c1
+const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0xd1, 0x6b, 0xc9, 0x75, 0xd7, 0x7c, 0xc1};
+```
+- The NSSAI (*Network Slice Assistance Information*) and DNN (*Data Network Name*) are hardcoded in function *generatePduSessionEstablishRequest()*
+```bash
+ uint8_t nssai[]={1,0,0,1}; //Corresponding to SST:1, SD:1
+ uint8_t dnn[4]={0x4,0x6f,0x61,0x69}; //Corresponding to dnn:"oai"
+```
+For interoperability with OAI or other CNs, it should be ensured that the configuration of the aforementioned parameters match the configuration of the corresponding subscribed user at the core network.
+Hardcoding of the USIM information will soon be substituted with parsing those parameters from a configuration file.
+
+## 2.2 Execution of SA scenario
+
+The order of starting the different components should be the same as the one described in section 1.3.
+
+ - To launch the gNB:
+ ```bash
+ sudo RFSIMULATOR=server ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --sa
+ ```
+- To launch the OAI UE:
+ ```bash
+sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --nokrnmod
+```
+The IP address at the execution command of the OAI UE corresponds to the target IP of the gNB host that the RFSIMULATOR at the UE will connect to. In the above example, we assume that the gNB and UE are running on the same host so the specified address (127.0.0.1) is the one of the loopback interface.
diff --git a/doc/TESTING_GNB_W_COTS_UE.md b/doc/TESTING_GNB_W_COTS_UE.md
index 73ae18351f..84f43bfc27 100644
--- a/doc/TESTING_GNB_W_COTS_UE.md
+++ b/doc/TESTING_GNB_W_COTS_UE.md
@@ -44,10 +44,12 @@ Our code might not work with all 5G phones yet, but we are constantly improving
* Oppo Reno 5G
* Samsung A90 5G
-* Google Pixel 5G
+* Samsung A42 5G
+* Google Pixel 5G (note1)
* Simcom SIMCOM8200EA
* Quectel RM500Q-GL
+Note1: In the version we have at Eurecom, you need to set the PLMN to 50501, and you also need to change the firmware to "11.0.0 (RD1A.201105.003.B1, Nov 2020, EU carriers)" (see https://developers.google.com/android/images)
## Repository
diff --git a/doc/testing_gnb_w_cots_ue_resources/enb.conf b/doc/testing_gnb_w_cots_ue_resources/enb.conf
index 35249aac25..a6bbd98bda 100755
--- a/doc/testing_gnb_w_cots_ue_resources/enb.conf
+++ b/doc/testing_gnb_w_cots_ue_resources/enb.conf
@@ -238,7 +238,7 @@ MACRLCs = (
THREAD_STRUCT = (
{
parallel_config = "PARALLEL_RU_L1_TRX_SPLITaaaaaa";
- worker_config = "ENABLE";
+ worker_config = "WORKER_ENABLE";
}
);
diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2
index 5fcd5a7b9f..cf012502e0 100644
--- a/docker/Dockerfile.eNB.rhel8.2
+++ b/docker/Dockerfile.eNB.rhel8.2
@@ -25,21 +25,21 @@
#
#---------------------------------------------------------------------
-FROM localhost/ran-build:latest AS enb-build
+FROM ran-build:latest AS enb-build
+RUN rm -Rf /oai-ran
WORKDIR /oai-ran
+COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
- rm -Rf log && \
mkdir -p log && \
- ./build_oai --eNB --ninja -w USRP
+ ./build_oai --eNB --ninja -w USRP --verbose-ci
-# debug
-#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15
-#RUN ls -ls /oai-ran/targets/bin
-#RUN ls -ls /oai-ran/cmake_targets/ran_build/build/*.so
+RUN yum install -y python3-pip && \
+ pip3 install --ignore-installed pyyaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml
#start from scratch for target executable
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-enb
@@ -58,6 +58,7 @@ RUN yum update -y && \
WORKDIR /opt/oai-enb/bin
COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 .
+COPY --from=enb-build /oai-ran/docker/scripts/enb_entrypoint.sh entrypoint.sh
WORKDIR /usr/local/lib/
COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
@@ -92,34 +93,16 @@ COPY --from=enb-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64
RUN ldconfig
-#debug
-#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15
-#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15
-#RUN ldd /usr/local/lib/librfsimulator.so.Rel15
-#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15
-#RUN ldd /usr/local/lib/libcoding.so
-#RUN ldd /usr/local/lib/libparams_libconfig.so
-#RUN ldd /usr/local/lib/libdfts.so
-#RUN ldd /usr/local/lib/liboai_iqplayer.so
-#RUN ldd /opt/oai-enb/bin/lte-softmodem.Rel15
-
# Copy the relevant configuration files for eNB
WORKDIR /opt/oai-enb/etc
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/enb.* .
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rcc.* .
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/cu.* .
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/du.* .
-COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rru.* .
+COPY --from=enb-build /oai-ran/docker/etc .
WORKDIR /opt/oai-enb
-#EXPOSE 2152/udp # S1U, GTP/UDP
-#EXPOSE 22100/tcp # ?
-#EXPOSE 36412/udp # S1C, SCTP/UDP
-#EXPOSE 36422/udp # X2C, SCTP/UDP
-#EXPOSE 50000/udp # IF5 / ORI (control)
-#EXPOSE 50001/udp # IF5 / ECPRI (data)
+# 2152 --> S1U, GTP/UDP
+# 36412 --> S1C, SCTP/UDP
+# 36422 --> X2C, SCTP/UDP
+EXPOSE 2152/udp 36412/udp 36422/udp
-#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"]
-#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
-CMD ["sleep", "infinity"]
+ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
+CMD ["/opt/oai-enb/bin/lte-softmodem.Rel15", "-O", "/opt/oai-enb/etc/enb.conf"]
diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18
index cdfb37ebfc..2954d3fb18 100644
--- a/docker/Dockerfile.eNB.ubuntu18
+++ b/docker/Dockerfile.eNB.ubuntu18
@@ -27,24 +27,20 @@
FROM ran-build:latest AS enb-build
+RUN rm -Rf /oai-ran
WORKDIR /oai-ran
+COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
- rm -Rf log && \
mkdir -p log && \
- ./build_oai --eNB --ninja -w USRP
+ ./build_oai --eNB --ninja -w USRP --verbose-ci
RUN apt-get install -y python3-pip && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml
-# debug
-#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15
-#RUN ls -ls /oai-ran/targets/bin
-#RUN ls -ls /oai-ran/cmake_targets/ran_build/build/*.so
-
#start from scratch for target executable
FROM ubuntu:bionic as oai-enb
ENV DEBIAN_FRONTEND=noninteractive
@@ -64,6 +60,7 @@ RUN apt-get update && \
net-tools \
iputils-ping \
iproute2 \
+ iperf \
libyaml-0-2 && \
# Install UHD driver from ettus ppa
# At time of writing, it is 3.14
@@ -97,17 +94,6 @@ COPY --from=enb-build /usr/local/lib/libprotobuf-c.so.1 .
RUN ldconfig
-#debug
-#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15
-#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15
-#RUN ldd /usr/local/lib/librfsimulator.so.Rel15
-#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15
-#RUN ldd /usr/local/lib/libcoding.so
-#RUN ldd /usr/local/lib/libparams_libconfig.so
-#RUN ldd /usr/local/lib/libdfts.so
-#RUN ldd /usr/local/lib/liboai_iqplayer.so
-#RUN ldd /opt/oai-enb/bin/lte-softmodem.Rel15
-
# Copy the relevant configuration files for eNB
WORKDIR /opt/oai-enb/etc
COPY --from=enb-build /oai-ran/docker/etc .
diff --git a/docker/Dockerfile.gNB.rhel8.2 b/docker/Dockerfile.gNB.rhel8.2
index fb9ade927f..6969c691fd 100644
--- a/docker/Dockerfile.gNB.rhel8.2
+++ b/docker/Dockerfile.gNB.rhel8.2
@@ -27,14 +27,15 @@
FROM localhost/ran-build:latest AS gnb-build
+RUN rm -Rf /oai-ran
WORKDIR /oai-ran
+COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
- rm -Rf log && \
mkdir -p log && \
- ./build_oai --gNB --ninja -w USRP
+ ./build_oai --gNB --ninja -w USRP --verbose-ci
#debug
#RUN ldconfig -v
diff --git a/docker/Dockerfile.gNB.ubuntu18 b/docker/Dockerfile.gNB.ubuntu18
index d43ad4709d..276d6989c4 100644
--- a/docker/Dockerfile.gNB.ubuntu18
+++ b/docker/Dockerfile.gNB.ubuntu18
@@ -27,14 +27,15 @@
FROM ran-build:latest AS gnb-build
+RUN rm -Rf /oai-ran
WORKDIR /oai-ran
+COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
- rm -Rf log && \
mkdir -p log && \
- ./build_oai --gNB --ninja -w USRP
+ ./build_oai --gNB --ninja -w USRP --verbose-ci
#debug
RUN ldconfig -v
diff --git a/docker/Dockerfile.lteRU.rhel8.2 b/docker/Dockerfile.lteRU.rhel8.2
new file mode 100644
index 0000000000..35078de007
--- /dev/null
+++ b/docker/Dockerfile.lteRU.rhel8.2
@@ -0,0 +1,99 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+#
+# Dockerfile for the Open-Air-Interface BUILD service
+# Valid for RHEL8
+#
+#---------------------------------------------------------------------
+
+FROM ran-build:latest AS ru-build
+
+RUN rm -Rf /oai-ran
+WORKDIR /oai-ran
+COPY . .
+
+#run build_oai to build the target image
+RUN /bin/sh oaienv && \
+ cd cmake_targets && \
+ mkdir -p log && \
+ ./build_oai --RU --ninja -w USRP --verbose-ci
+
+RUN yum install -y python3-pip && \
+ pip3 install --ignore-installed pyyaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml
+
+#start from scratch for target executable
+FROM registry.access.redhat.com/ubi8/ubi:latest as oai-lte-ru
+ENV TZ=Europe/Paris
+
+RUN yum update -y && \
+ yum install -y --enablerepo="ubi-8-codeready-builder" \
+ tzdata \
+ atlas \
+ net-tools \
+ iputils \
+ iproute && \
+ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
+ echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
+
+WORKDIR /opt/oai-lte-ru/bin
+COPY --from=ru-build /oai-ran/targets/bin/oairu.Rel15 .
+COPY --from=ru-build /oai-ran/docker/scripts/lte_ru_entrypoint.sh entrypoint.sh
+
+WORKDIR /usr/local/lib/
+COPY --from=ru-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
+COPY --from=ru-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 .
+COPY --from=ru-build /oai-ran/targets/bin/librfsimulator.so.Rel15 .
+COPY --from=ru-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 .
+COPY --from=ru-build /oai-ran/targets/bin/libparams_libconfig.so .
+COPY --from=ru-build /oai-ran/cmake_targets/ran_build/build/libdfts.so .
+
+# Copying from the ran-build image the USRP needed packages
+COPY --from=ru-build /lib64/libconfig.so.9 /lib64
+COPY --from=ru-build /lib64/libblas.so.3 /lib64
+COPY --from=ru-build /lib64/liblapack.so.3 /lib64
+COPY --from=ru-build /lib64/liblapacke.so.3 /lib64
+COPY --from=ru-build /lib64/libboost_chrono.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_date_time.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_filesystem.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_program_options.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_serialization.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_thread.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_system.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_atomic.so.1.66.0 /lib64
+COPY --from=ru-build /lib64/libboost_timer.so.1.66.0 /lib64
+COPY --from=ru-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64
+
+RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" && \
+ /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" && \
+ /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" && \
+ ldconfig
+
+# Copy the relevant configuration files for RRU
+WORKDIR /opt/oai-lte-ru/etc
+COPY --from=ru-build /oai-ran/docker/etc/rru* ./
+
+WORKDIR /opt/oai-lte-ru
+
+ENTRYPOINT ["/opt/oai-lte-ru/bin/entrypoint.sh"]
+CMD ["/opt/oai-lte-ru/bin/oairu.Rel15", "-O", "/opt/oai-lte-ru/etc/rru.conf"]
diff --git a/docker/Dockerfile.lteRU.ubuntu18 b/docker/Dockerfile.lteRU.ubuntu18
new file mode 100644
index 0000000000..381d63d9f3
--- /dev/null
+++ b/docker/Dockerfile.lteRU.ubuntu18
@@ -0,0 +1,94 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+#
+# Dockerfile for the Open-Air-Interface BUILD service
+# Valid for Ubuntu 18.04
+#
+#---------------------------------------------------------------------
+
+FROM ran-build:latest AS ru-build
+
+RUN rm -Rf /oai-ran
+WORKDIR /oai-ran
+COPY . .
+
+#run build_oai to build the target image
+RUN /bin/sh oaienv && \
+ cd cmake_targets && \
+ mkdir -p log && \
+ ./build_oai --RU --ninja -w USRP --verbose-ci
+
+RUN apt-get install -y python3-pip && \
+ pip3 install --ignore-installed pyyaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml
+
+#start from scratch for target executable
+FROM ubuntu:bionic as oai-lte-ru
+ENV DEBIAN_FRONTEND=noninteractive
+ENV TZ=Europe/Paris
+
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
+ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
+ tzdata \
+ software-properties-common \
+ libblas3 \
+ libatlas3-base \
+ libconfig9 \
+ net-tools \
+ iputils-ping \
+ iproute2 && \
+ # Install UHD driver from ettus ppa
+ # At time of writing, it is 3.14
+ add-apt-repository ppa:ettusresearch/uhd --yes && \
+ apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install --yes \
+ python \
+ libusb-1.0-0 \
+ libuhd003 \
+ uhd-host && \
+ rm -rf /var/lib/apt/lists/*
+
+WORKDIR /opt/oai-lte-ru/bin
+COPY --from=ru-build /oai-ran/targets/bin/oairu.Rel15 .
+COPY --from=ru-build /oai-ran/docker/scripts/lte_ru_entrypoint.sh entrypoint.sh
+
+WORKDIR /usr/local/lib/
+COPY --from=ru-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
+COPY --from=ru-build /oai-ran/targets/bin/libtcp_bridge_oai.so.Rel15 .
+COPY --from=ru-build /oai-ran/targets/bin/librfsimulator.so.Rel15 .
+COPY --from=ru-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 .
+COPY --from=ru-build /oai-ran/targets/bin/libparams_libconfig.so .
+COPY --from=ru-build /oai-ran/cmake_targets/ran_build/build/libdfts.so .
+RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" && \
+ /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" && \
+ /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" && \
+ ldconfig
+
+# Copy the relevant configuration files for RRU
+WORKDIR /opt/oai-lte-ru/etc
+COPY --from=ru-build /oai-ran/docker/etc/rru* ./
+
+WORKDIR /opt/oai-lte-ru
+
+ENTRYPOINT ["/opt/oai-lte-ru/bin/entrypoint.sh"]
+CMD ["/opt/oai-lte-ru/bin/oairu.Rel15", "-O", "/opt/oai-lte-ru/etc/rru.conf"]
diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2
index 0a853dcd6b..731abed1a8 100644
--- a/docker/Dockerfile.lteUE.rhel8.2
+++ b/docker/Dockerfile.lteUE.rhel8.2
@@ -25,22 +25,22 @@
#
#---------------------------------------------------------------------
-FROM localhost/ran-build:latest AS lte-ue-build
-
+FROM ran-build:latest AS lte-ue-build
+RUN rm -Rf /oai-ran
WORKDIR /oai-ran
+COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
- rm -Rf log && \
mkdir -p log && \
- ./build_oai --UE --ninja -w USRP
+ ./build_oai --UE --ninja -w USRP --verbose-ci
-# debug
-#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15
-#RUN ls -lst /oai-ran/targets/bin
-#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so
+RUN yum install -y python3-pip && \
+ pip3 install --ignore-installed pyyaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml
#start from scratch for target executable
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-lte-ue
@@ -59,12 +59,10 @@ RUN yum update -y && \
WORKDIR /opt/oai-lte-ue/bin
COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 .
+COPY --from=lte-ue-build /oai-ran/docker/scripts/lte_ue_entrypoint.sh entrypoint.sh
COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata .
COPY --from=lte-ue-build /oai-ran/targets/bin/nvram .
COPY --from=lte-ue-build /oai-ran/targets/bin/usim .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.ue_emm.nvram0 .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.ue.nvram0 .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 .
WORKDIR /usr/local/lib/
COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
@@ -99,26 +97,10 @@ COPY --from=lte-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64
RUN ldconfig
-#debug
-#RUN ldd /opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15
-#RUN ldd /opt/oai-lte-ue/bin/conf2uedata
-#RUN ldd /opt/oai-lte-ue/bin/nvram
-#RUN ldd /opt/oai-lte-ue/bin/usim
-#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15
-#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15
-#RUN ldd /usr/local/lib/librfsimulator.so.Rel15
-#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15
-#RUN ldd /usr/local/lib/libcoding.so
-#RUN ldd /usr/local/lib/libparams_libconfig.so
-#RUN ldd /usr/local/lib/libSIMU.so
-#RUN ldd /usr/local/lib/libdfts.so
-
-# Copy the relevant configuration files for eNB
+# Copy the relevant configuration files for UE
WORKDIR /opt/oai-lte-ue/etc
-COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* .
-COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
+COPY --from=lte-ue-build /oai-ran/docker/etc .
WORKDIR /opt/oai-lte-ue
-#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"]
-#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
-CMD ["sleep", "infinity"]
+CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15"]
+ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18
index 8793cc54f7..fcd16f0c15 100644
--- a/docker/Dockerfile.lteUE.ubuntu18
+++ b/docker/Dockerfile.lteUE.ubuntu18
@@ -27,20 +27,20 @@
FROM ran-build:latest AS lte-ue-build
+RUN rm -Rf /oai-ran
WORKDIR /oai-ran
+COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
- rm -Rf log && \
mkdir -p log && \
- ./build_oai --UE --ninja -w USRP
+ ./build_oai --UE --ninja -w USRP --verbose-ci
-# debug
-#RUN ldconfig -v
-#RUN ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15
-#RUN ls -lst /oai-ran/targets/bin
-#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so
+RUN apt-get install -y python3-pip && \
+ pip3 install --ignore-installed pyyaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \
+ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml
#start from scratch for target executable
FROM ubuntu:bionic as oai-lte-ue
@@ -61,6 +61,7 @@ RUN apt-get update && \
net-tools \
iputils-ping \
iproute2 \
+ iperf \
libyaml-0-2 && \
# Install UHD driver from ettus ppa
# At time of writing, it is 3.14
@@ -75,12 +76,10 @@ RUN apt-get update && \
WORKDIR /opt/oai-lte-ue/bin
COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 .
+COPY --from=lte-ue-build /oai-ran/docker/scripts/lte_ue_entrypoint.sh entrypoint.sh
COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata .
COPY --from=lte-ue-build /oai-ran/targets/bin/nvram .
COPY --from=lte-ue-build /oai-ran/targets/bin/usim .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.ue_emm.nvram0 .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.ue.nvram0 .
-COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 .
WORKDIR /usr/local/lib/
COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
@@ -99,26 +98,10 @@ COPY --from=lte-ue-build /usr/local/lib/libprotobuf-c.so.1 .
RUN ldconfig
-#debug
-#RUN ldd /opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15
-#RUN ldd /opt/oai-lte-ue/bin/conf2uedata
-#RUN ldd /opt/oai-lte-ue/bin/nvram
-#RUN ldd /opt/oai-lte-ue/bin/usim
-#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15
-#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15
-#RUN ldd /usr/local/lib/librfsimulator.so.Rel15
-#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15
-#RUN ldd /usr/local/lib/libcoding.so
-#RUN ldd /usr/local/lib/libparams_libconfig.so
-#RUN ldd /usr/local/lib/libSIMU.so
-#RUN ldd /usr/local/lib/libdfts.so
-
-# Copy the relevant configuration files for eNB
+# Copy the relevant configuration files for UE
WORKDIR /opt/oai-lte-ue/etc
-COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* ./
-COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
+COPY --from=lte-ue-build /oai-ran/docker/etc .
WORKDIR /opt/oai-lte-ue
-#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"]
-#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
-CMD ["sleep", "infinity"]
+CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15"]
+ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
diff --git a/docker/Dockerfile.nrUE.rhel8.2 b/docker/Dockerfile.nrUE.rhel8.2
index f9f3f8e4bf..01988fd6ff 100644
--- a/docker/Dockerfile.nrUE.rhel8.2
+++ b/docker/Dockerfile.nrUE.rhel8.2
@@ -27,14 +27,15 @@
FROM localhost/ran-build:latest AS nr-ue-build
+RUN rm -Rf /oai-ran
WORKDIR /oai-ran
+COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
- rm -Rf log && \
mkdir -p log && \
- ./build_oai --nrUE --ninja -w USRP
+ ./build_oai --nrUE --ninja -w USRP --verbose-ci
# debug
#RUN ldconfig -v
diff --git a/docker/Dockerfile.nrUE.ubuntu18 b/docker/Dockerfile.nrUE.ubuntu18
index 5450194f35..c96bcf80ef 100644
--- a/docker/Dockerfile.nrUE.ubuntu18
+++ b/docker/Dockerfile.nrUE.ubuntu18
@@ -27,14 +27,15 @@
FROM ran-build:latest AS nr-ue-build
+RUN rm -Rf /oai-ran
WORKDIR /oai-ran
+COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
- rm -Rf log && \
mkdir -p log && \
- ./build_oai --nrUE --ninja -w USRP
+ ./build_oai --nrUE --ninja -w USRP --verbose-ci
# debug
#RUN ldconfig -v
diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2
new file mode 100644
index 0000000000..4472ece363
--- /dev/null
+++ b/docker/Dockerfile.phySim.rhel8.2
@@ -0,0 +1,123 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+#---------------------------------------------------------------------
+#
+# Dockerfile for the Open-Air-Interface BUILD service
+# Valid for RHEL8
+#
+#---------------------------------------------------------------------
+
+FROM localhost/ran-build:develop AS phy-sim-build
+
+RUN rm -Rf /oai-ran
+WORKDIR /oai-ran
+COPY . .
+
+#run build_oai to build the target image
+RUN /bin/sh oaienv && \
+ cd cmake_targets && \
+ mkdir -p log && \
+ ./build_oai --phy_simulators --ninja --verbose-ci
+
+
+#start from scratch for target executable
+FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim
+
+RUN yum update -y && \
+ yum install -y --enablerepo="ubi-8-codeready-builder" \
+ lksctp-tools \
+ nettle \
+ atlas \
+ hostname \
+ sudo \
+ procps-ng \
+ net-tools \
+ iputils \
+ bc \
+ iproute \
+ libyaml && \
+ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
+ echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
+
+WORKDIR /opt/oai-physim/targets/bin
+COPY --from=phy-sim-build /oai-ran/targets/bin/dlsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_dlsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_prachsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_ulschsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/polartest.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/ulsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/ldpctest.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_dlschsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_pbchsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_pucchsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/nr_ulsim.Rel15 .
+COPY --from=phy-sim-build /oai-ran/targets/bin/smallblocktest.Rel15 .
+
+WORKDIR /usr/local/lib/
+COPY --from=phy-sim-build /oai-ran/targets/bin/libcoding.so .
+COPY --from=phy-sim-build /lib64/liblapacke.so.3 .
+COPY --from=phy-sim-build /lib64/libX11.so.6 .
+COPY --from=phy-sim-build /lib64/libXpm.so.4 .
+COPY --from=phy-sim-build /lib64/libxcb.so.1 .
+COPY --from=phy-sim-build /lib64/libXau.so.6 .
+COPY --from=phy-sim-build /lib64/libforms.so.2 .
+COPY --from=phy-sim-build /lib64/libblas.so.3 .
+COPY --from=phy-sim-build /lib64/liblapack.so.3 .
+COPY --from=phy-sim-build /lib64/libexslt.so.0 .
+COPY --from=phy-sim-build /lib64/libxslt.so.1 .
+COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libdfts.so .
+COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libSIMU.so .
+COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libldpc.so .
+COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libldpc_orig.so .
+
+RUN ldconfig
+
+#debug
+#RUN ldd /opt/oai-physim/targets/bin/dlsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_dlsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_prachsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_ulschsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/polartest.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/ulsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/ldpctest.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_dlschsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_pbchsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_pucchsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/nr_ulsim.Rel15
+#RUN ldd /opt/oai-physim/targets/bin/smallblocktest.Rel15
+
+# Copy some executables
+WORKDIR /usr/bin/
+
+COPY --from=phy-sim-build /usr/bin/killall .
+COPY --from=phy-sim-build /usr/bin/xmlstarlet .
+COPY --from=phy-sim-build /usr/bin/svn .
+
+# Copy the relevant configuration files for phySim
+WORKDIR /opt/oai-physim/
+
+COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/run_exec_autotests.bash /opt/oai-physim/cmake_targets/autotests/
+COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/test_case_list.xml /opt/oai-physim/cmake_targets/autotests/
+COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/tools/free_mem.bash /opt/oai-physim/cmake_targets/autotests/tools/
+COPY --from=phy-sim-build /oai-ran/cmake_targets/tools/build_helper /opt/oai-physim/cmake_targets/tools/
+COPY --from=phy-sim-build /oai-ran/cmake_targets/tools/test_helper /opt/oai-physim/cmake_targets/tools/
+
+#CMD ["sleep", "infinity"]
diff --git a/docker/scripts/enb_entrypoint.sh b/docker/scripts/enb_entrypoint.sh
index 31d99b2a67..6810a86416 100755
--- a/docker/scripts/enb_entrypoint.sh
+++ b/docker/scripts/enb_entrypoint.sh
@@ -2,17 +2,22 @@
set -euo pipefail
+PREFIX=/opt/oai-enb
+RRC_INACTIVITY_THRESHOLD=${RRC_INACTIVITY_THRESHOLD:-0}
+
# Based another env var, pick one template to use
-if [[ -v USE_FDD_CU ]]; then ln -s /opt/oai-enb/etc/cu.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_FDD_DU ]]; then ln -s /opt/oai-enb/etc/du.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_FDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_TDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.tdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_FDD_RCC ]]; then ln -s /opt/oai-enb/etc/rcc.if4p5.enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_FDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.fdd.conf /opt/oai-enb/etc/enb.conf; fi
-if [[ -v USE_TDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.tdd.conf /opt/oai-enb/etc/enb.conf; fi
+if [[ -v USE_FDD_CU ]]; then ln -s $PREFIX/etc/cu.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_DU ]]; then ln -s $PREFIX/etc/du.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_MONO ]]; then ln -s $PREFIX/etc/enb.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_TDD_MONO ]]; then ln -s $PREFIX/etc/enb.tdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_FAPI_RCC ]]; then ln -s $PREFIX/etc/rcc.nfapi.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_IF4P5_RCC ]]; then ln -s $PREFIX/etc/rcc.if4p5.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_TDD_IF4P5_RCC ]]; then ln -s $PREFIX/etc/rcc.if4p5.tdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_FDD_RRU ]]; then ln -s $PREFIX/etc/rru.fdd.conf $PREFIX/etc/enb.conf; fi
+if [[ -v USE_TDD_RRU ]]; then ln -s $PREFIX/etc/rru.tdd.conf $PREFIX/etc/enb.conf; fi
# Only this template will be manipulated
-CONFIG_FILES=`ls /opt/oai-enb/etc/enb.conf`
+CONFIG_FILES=`ls $PREFIX/etc/enb.conf || true`
for c in ${CONFIG_FILES}; do
# grep variable names (format: ${VAR}) from template to be rendered
diff --git a/docker/scripts/enb_parameters.yaml b/docker/scripts/enb_parameters.yaml
index a60fc20e29..749600f47d 100644
--- a/docker/scripts/enb_parameters.yaml
+++ b/docker/scripts/enb_parameters.yaml
@@ -25,7 +25,7 @@
dest_dir: docker/etc
- configurations:
- - filePrefix: cu
+ - filePrefix: cu.band7.tm1.25PRB
outputfilename: "cu.fdd.conf"
config:
- key: Active_eNBs
@@ -68,7 +68,7 @@
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
- - filePrefix: du
+ - filePrefix: du.band7.tm1.25PRB
outputfilename: "du.fdd.conf"
config:
- key: Active_eNBs
@@ -159,6 +159,8 @@
env: "@ENB_S1U_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@ENB_X2_IP_ADDRESS@"
+ - key: rrc_inactivity_threshold
+ env: "@RRC_INACTIVITY_THRESHOLD@"
- key: FLEXRAN_ENABLED
env: "@FLEXRAN_ENABLED@"
- key: FLEXRAN_INTERFACE_NAME
@@ -204,7 +206,7 @@
env: "@F1_CU_IP_ADDRESS@"
- filePrefix: "rcc.band7.tm1.nfapi"
- outputfilename: "rcc.if4p5.enb.fdd.conf"
+ outputfilename: "rcc.nfapi.fdd.conf"
config:
- key: Active_eNBs
env: "@ENB_NAME@"
@@ -246,3 +248,89 @@
- key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@"
+ - filePrefix: "rcc.band7.tm1.if4p5.lo.25PRB"
+ outputfilename: "rcc.if4p5.fdd.conf"
+ config:
+ - key: Active_eNBs
+ env: "@ENB_NAME@"
+ - key: eNB_name
+ env: "@ENB_NAME@"
+ - key: plmn_list
+ env:
+ mcc: "@MCC@"
+ mnc: "@MNC@"
+ mnc_length: "@MNC_LENGTH@"
+ - key: tracking_area_code
+ env: "@TAC@"
+ - key: eutra_band
+ env: "@UTRA_BAND_ID@"
+ - key: downlink_frequency
+ env: "@DL_FREQUENCY_IN_MHZ@000000"
+ - key: uplink_frequency_offset
+ env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
+ - key: Nid_cell
+ env: "@NID_CELL@"
+ - key: N_RB_DL
+ env: "@NB_PRB@"
+ - key: ipv4
+ env: "@MME_S1C_IP_ADDRESS@"
+ - key: ENB_INTERFACE_NAME_FOR_S1_MME
+ env: "@RCC_IF_NAME@"
+ - key: ENB_IPV4_ADDRESS_FOR_S1_MME
+ env: "@RCC_S1C_IP_ADDRESS@"
+ - key: ENB_INTERFACE_NAME_FOR_S1U
+ env: "@RCC_IF_NAME@"
+ - key: ENB_IPV4_ADDRESS_FOR_S1U
+ env: "@RCC_IP_ADDRESS@"
+ - key: ENB_IPV4_ADDRESS_FOR_X2C
+ env: "@RCC_IP_ADDRESS@"
+ - key: local_if_name
+ env: "@IF4P5_IF_NAME@"
+ - key: remote_address
+ env: "@IF4P5_RRU_IP_ADDRESS@"
+ - key: local_address
+ env: "@IF4P5_RCC_IP_ADDRESS@"
+
+ - filePrefix: "rcc.band40.tm1.25PRB"
+ outputfilename: "rcc.if4p5.tdd.conf"
+ config:
+ - key: Active_eNBs
+ env: "@ENB_NAME@"
+ - key: eNB_name
+ env: "@ENB_NAME@"
+ - key: plmn_list
+ env:
+ mcc: "@MCC@"
+ mnc: "@MNC@"
+ mnc_length: "@MNC_LENGTH@"
+ - key: tracking_area_code
+ env: "@TAC@"
+ - key: eutra_band
+ env: "@UTRA_BAND_ID@"
+ - key: downlink_frequency
+ env: "@DL_FREQUENCY_IN_MHZ@000000"
+ - key: uplink_frequency_offset
+ env: "@UL_FREQUENCY_OFFSET_IN_MHZ@000000"
+ - key: Nid_cell
+ env: "@NID_CELL@"
+ - key: N_RB_DL
+ env: "@NB_PRB@"
+ - key: ipv4
+ env: "@MME_S1C_IP_ADDRESS@"
+ - key: ENB_INTERFACE_NAME_FOR_S1_MME
+ env: "@RCC_IF_NAME@"
+ - key: ENB_IPV4_ADDRESS_FOR_S1_MME
+ env: "@RCC_S1C_IP_ADDRESS@"
+ - key: ENB_INTERFACE_NAME_FOR_S1U
+ env: "@RCC_IF_NAME@"
+ - key: ENB_IPV4_ADDRESS_FOR_S1U
+ env: "@RCC_IP_ADDRESS@"
+ - key: ENB_IPV4_ADDRESS_FOR_X2C
+ env: "@RCC_IP_ADDRESS@"
+ - key: local_if_name
+ env: "@IF4P5_IF_NAME@"
+ - key: remote_address
+ env: "@IF4P5_RRU_IP_ADDRESS@"
+ - key: local_address
+ env: "@IF4P5_RCC_IP_ADDRESS@"
+
diff --git a/docker/scripts/generateTemplate.py b/docker/scripts/generateTemplate.py
index 4949e9cf21..5ce0d146e5 100644
--- a/docker/scripts/generateTemplate.py
+++ b/docker/scripts/generateTemplate.py
@@ -35,21 +35,28 @@ def main():
data = yaml.full_load(f)
dir = os.listdir(f'{data[0]["paths"]["source_dir"]}')
-
#identify configs, read and replace corresponding values
for config in data[1]["configurations"]:
filePrefix = config["filePrefix"]
outputfilename = config["outputfilename"]
+ print('================================================')
+ print('filePrefix = ' + filePrefix)
+ print('outputfilename = ' + outputfilename)
for inputfile in dir:
if inputfile.find(filePrefix) >=0:
- prefix_outputfile = {"cu": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
- "du": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
+ prefix_outputfile = {"cu.band7.tm1.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
+ "du.band7.tm1.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rru.fdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"rru.tdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band7.tm1.25PRB.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
"enb.band40.tm1.25PRB.FairScheduler.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
- "rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}'
+ "rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
+ "rcc.band7.tm1.if4p5.lo.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
+ "rcc.band40.tm1.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
+ "ue.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}',
+ "ue_sim_ci": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}'
}
+ print('inputfile = ' + inputfile)
if filePrefix in prefix_outputfile:
outputfile1 = prefix_outputfile[filePrefix]
@@ -61,6 +68,9 @@ def main():
open(outputfile1, mode='w') as outputfile:
for line in inputfile:
count = 0
+ if re.search(r'EHPLMN_LIST', line):
+ outputfile.write(line)
+ continue
for key in config["config"]:
if line.find(key["key"]) >= 0:
count += 1
diff --git a/docker/scripts/lte_ru_entrypoint.sh b/docker/scripts/lte_ru_entrypoint.sh
new file mode 100755
index 0000000000..f466e25ec2
--- /dev/null
+++ b/docker/scripts/lte_ru_entrypoint.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+set -euo pipefail
+
+PREFIX=/opt/oai-lte-ru
+
+# Based another env var, pick one template to use
+if [[ -v USE_FDD_RRU ]]; then ln -s $PREFIX/etc/rru.fdd.conf $PREFIX/etc/rru.conf; fi
+if [[ -v USE_TDD_RRU ]]; then ln -s $PREFIX/etc/rru.tdd.conf $PREFIX/etc/rru.conf; fi
+
+# Only this template will be manipulated
+CONFIG_FILES=`ls $PREFIX/etc/rru.conf || true`
+
+for c in ${CONFIG_FILES}; do
+ # grep variable names (format: ${VAR}) from template to be rendered
+ VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
+
+ # create sed expressions for substituting each occurrence of ${VAR}
+ # with the value of the environment variable "VAR"
+ EXPRESSIONS=""
+ for v in ${VARS}; do
+ NEW_VAR=`echo $v | sed -e "s#@##g"`
+ if [[ "${!NEW_VAR}x" == "x" ]]; then
+ echo "Error: Environment variable '${NEW_VAR}' is not set." \
+ "Config file '$(basename $c)' requires all of $VARS."
+ exit 1
+ fi
+ EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
+ done
+ EXPRESSIONS="${EXPRESSIONS#';'}"
+
+ # render template and inline replace config file
+ sed -i "${EXPRESSIONS}" ${c}
+done
+
+# Load the USRP binaries
+if [[ -v USE_B2XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t b2xx
+elif [[ -v USE_X3XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t x3xx
+elif [[ -v USE_N3XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t n3xx
+fi
+
+echo "=================================="
+echo "== Starting eNB soft modem"
+if [[ -v USE_ADDITIONAL_OPTIONS ]]; then
+ echo "Additional option(s): ${USE_ADDITIONAL_OPTIONS}"
+ new_args=()
+ while [[ $# -gt 0 ]]; do
+ new_args+=("$1")
+ shift
+ done
+ for word in ${USE_ADDITIONAL_OPTIONS}; do
+ new_args+=("$word")
+ done
+ echo "${new_args[@]}"
+ exec "${new_args[@]}"
+else
+ echo "$@"
+ exec "$@"
+fi
diff --git a/docker/scripts/lte_ue_entrypoint.sh b/docker/scripts/lte_ue_entrypoint.sh
new file mode 100755
index 0000000000..235128f738
--- /dev/null
+++ b/docker/scripts/lte_ue_entrypoint.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+set -euo pipefail
+
+PREFIX=/opt/oai-lte-ue
+
+# Based another env var, pick one template to use
+if [[ -v USE_NFAPI ]]; then ln -s $PREFIX/etc/ue.nfapi.conf $PREFIX/etc/ue.conf; fi
+
+# Only this template will be manipulated and the USIM one!
+CONFIG_FILES=`ls $PREFIX/etc/ue.conf $PREFIX/etc/ue_usim.conf || true`
+
+for c in ${CONFIG_FILES}; do
+ # grep variable names (format: ${VAR}) from template to be rendered
+ VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
+
+ # create sed expressions for substituting each occurrence of ${VAR}
+ # with the value of the environment variable "VAR"
+ EXPRESSIONS=""
+ for v in ${VARS}; do
+ NEW_VAR=`echo $v | sed -e "s#@##g"`
+ if [[ "${!NEW_VAR}x" == "x" ]]; then
+ echo "Error: Environment variable '${NEW_VAR}' is not set." \
+ "Config file '$(basename $c)' requires all of $VARS."
+ exit 1
+ fi
+ EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
+ done
+ EXPRESSIONS="${EXPRESSIONS#';'}"
+
+ # render template and inline replace config file
+ sed -i "${EXPRESSIONS}" ${c}
+done
+
+#now generate USIM files
+# At this point all operations will be run from $PREFIX!
+cd $PREFIX
+$PREFIX/bin/conf2uedata -c $PREFIX/etc/ue_usim.conf -o $PREFIX
+
+# Load the USRP binaries
+if [[ -v USE_B2XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t b2xx
+elif [[ -v USE_X3XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t x3xx
+elif [[ -v USE_N3XX ]]; then
+ /usr/lib/uhd/utils/uhd_images_downloader.py -t n3xx
+fi
+
+# in case we have conf file, append
+new_args=()
+while [[ $# -gt 0 ]]; do
+ new_args+=("$1")
+ shift
+done
+if [[ -v USE_NFAPI ]]; then
+ new_args+=("-O")
+ new_args+=("$PREFIX/etc/ue.conf")
+fi
+
+echo "=================================="
+echo "== Starting LTE UE soft modem"
+if [[ -v USE_ADDITIONAL_OPTIONS ]]; then
+ echo "Additional option(s): ${USE_ADDITIONAL_OPTIONS}"
+ for word in ${USE_ADDITIONAL_OPTIONS}; do
+ new_args+=("$word")
+ done
+ echo "${new_args[@]}"
+ exec "${new_args[@]}"
+else
+ echo "${new_args[@]}"
+ exec "${new_args[@]}"
+fi
diff --git a/docker/scripts/lte_ue_parameters.yaml b/docker/scripts/lte_ue_parameters.yaml
new file mode 100644
index 0000000000..977659bb54
--- /dev/null
+++ b/docker/scripts/lte_ue_parameters.yaml
@@ -0,0 +1,37 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+
+---
+- paths:
+ source_dir: "ci-scripts/conf_files/"
+ dest_dir: docker/etc
+
+- configurations:
+ - filePrefix: ue.nfapi
+ outputfilename: "ue.nfapi.conf"
+ config:
+ - key: remote_n_address
+ env: "@ENB_IP_ADDRESS@"
+ - key: local_n_address
+ env: "@LTE_UE_IP_ADDRESS@"
+ - key: local_n_if_name
+ env: "@UE_NFAPI_IF_NAME@"
+
diff --git a/docker/scripts/lte_ue_sim_parameters.yaml b/docker/scripts/lte_ue_sim_parameters.yaml
new file mode 100644
index 0000000000..a339ed7504
--- /dev/null
+++ b/docker/scripts/lte_ue_sim_parameters.yaml
@@ -0,0 +1,47 @@
+#/*
+# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+# * contributor license agreements. See the NOTICE file distributed with
+# * this work for additional information regarding copyright ownership.
+# * The OpenAirInterface Software Alliance licenses this file to You under
+# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+# * except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.openairinterface.org/?page_id=698
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# *-------------------------------------------------------------------------------
+# * For more information about the OpenAirInterface (OAI) Software Alliance:
+# * contact@openairinterface.org
+# */
+
+---
+- paths:
+ source_dir: "openair3/NAS/TOOLS/"
+ dest_dir: docker/etc
+
+- configurations:
+ - filePrefix: ue_sim_ci
+ outputfilename: "ue_usim.conf"
+ config:
+ - key: MNC
+ env: "@MNC@"
+ - key: MCC
+ env: "@MCC@"
+ - key: MSIN
+ env: "@SHORT_IMSI@"
+ - key: USIM_API_K
+ env: "@LTE_KEY@"
+ - key: OPC
+ env: "@OPC@"
+ - key: MSISDN
+ env: "@MSISDN@"
+ - key: HPLMN
+ env: "@HPLMN@"
+ - key: OPLMN_LIST
+ env: "@HPLMN@"
+
diff --git a/executables/main-fs6.c b/executables/main-fs6.c
index 5283ce5eaa..438edb4044 100644
--- a/executables/main-fs6.c
+++ b/executables/main-fs6.c
@@ -750,7 +750,7 @@ void phy_procedures_eNB_uespec_RX_fromsplit(uint8_t *bufferZone, int nbBlocks,PH
recvFs6Ul(bufferZone, nbBlocks, eNB, ul_propa);
// dirty memory allocation in OAI...
- for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++)
+ for (int i = 0; i < NUMBER_OF_UCI_MAX; i++)
if ( eNB->uci_vars[i].frame == proc->frame_rx &&
eNB->uci_vars[i].subframe == proc->subframe_rx )
eNB->uci_vars[i].active=0;
@@ -1145,7 +1145,7 @@ void appendFs6DLUEcch(uint8_t *bufferZone, PHY_VARS_eNB *eNB, int frame, int sub
commonUDP_t *newUDPheader=(commonUDP_t *) firstFreeByte;
bool first_UE=true;
- for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) {
+ for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) {
LTE_eNB_UCI *uci = &(eNB->uci_vars[i]);
if ((uci->active == 1) && (uci->frame == frame) && (uci->subframe == subframe)) {
diff --git a/executables/main-ocp.c b/executables/main-ocp.c
index f3a41ab23b..832be88aaa 100644
--- a/executables/main-ocp.c
+++ b/executables/main-ocp.c
@@ -73,17 +73,19 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex.
int config_sync_var=-1;
volatile int oai_exit = 0;
double cpuf;
+THREAD_STRUCT thread_struct;
+
uint16_t sf_ahead=4;
//uint16_t slot_ahead=6;
int otg_enabled;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int split73;
-int usrp_tx_thread = 0;
char * split73_config;
int split73;
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0};
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]= {0};
+uint8_t proto_agent_flag = 0;
void flexran_agent_slice_update(mid_t module_idP) {
}
int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p){
@@ -202,7 +204,6 @@ void init_eNB_afterRU(void) {
for (int inst=0; instframe_parms.nb_antennas_rx = 0;
eNB->frame_parms.nb_antennas_tx = 0;
eNB->prach_vars.rxsigF[0] = (int16_t **)malloc16(64*sizeof(int16_t *));
@@ -228,12 +229,26 @@ void init_eNB_afterRU(void) {
for (int ce_level=0; ce_level<4; ce_level++)
eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i];
- eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i];
}
}
- AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 4, "");
- AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 4, "");
+
+ AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 5, "");
+ AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 5, "");
+
+ phy_init_lte_eNB(eNB,0,0);
+
+ // need to copy rxdataF after L1 variables are allocated
+ for (int inst=0; instnum_RU; ru_id++) {
+ for (int i=0; iRU_list[ru_id]->nb_rx; aa++,i++)
+ eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i];
+ }
+ }
+ }
+
LOG_I(PHY,"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx);
init_transport(eNB);
//init_precoding_weights(RC.eNB[inst][CC_id]);
@@ -800,7 +815,7 @@ int init_rf(RU_t *ru) {
pthread_setname_np(pthread_self(),name);
return ret;
}
-
+
void ocp_init_RU(RU_t *ru, char *rf_config_file, int send_dmrssync) {
PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
int i;
@@ -1318,7 +1333,7 @@ int main ( int argc, char **argv ) {
// end of CI modifications
//getchar();
- if(IS_SOFTMODEM_DOFORMS)
+ if(IS_SOFTMODEM_DOSCOPE)
load_softscope("enb", NULL);
itti_wait_tasks_end();
@@ -1327,7 +1342,7 @@ int main ( int argc, char **argv ) {
// stop threads
if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) {
- if(IS_SOFTMODEM_DOFORMS)
+ if(IS_SOFTMODEM_DOSCOPE)
end_forms();
LOG_I(ENB_APP,"stopping MODEM threads\n");
diff --git a/executables/main_ru.c b/executables/main_ru.c
new file mode 100644
index 0000000000..93a580560e
--- /dev/null
+++ b/executables/main_ru.c
@@ -0,0 +1,382 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ * contact@openairinterface.org
+ */
+
+/*! \file oairu.c
+ * \brief Top-level threads for radio-unit
+ * \author R. Knopp
+ * \date 2020
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+
+#define _GNU_SOURCE /* See feature_test_macros(7) */
+#include
+
+
+
+
+#include "assertions.h"
+#include "PHY/types.h"
+
+#include "PHY/defs_RU.h"
+#include "common/config/config_userapi.h"
+#include "common/utils/load_module_shlib.h"
+
+
+#include "../../ARCH/COMMON/common_lib.h"
+#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
+
+
+#include "PHY/phy_vars.h"
+#include "SCHED/sched_common_vars.h"
+#include "PHY/TOOLS/phy_scope_interface.h"
+#include "common/utils/LOG/log.h"
+#include "common/utils/LOG/vcd_signal_dumper.h"
+#include "PHY/INIT/phy_init.h"
+#include "openair2/ENB_APP/enb_paramdef.h"
+#include "system.h"
+
+#include
+#include
+#include
+
+static int DEFBANDS[] = {7};
+static int DEFENBS[] = {0};
+static int DEFBFW[] = {0x00007fff};
+
+THREAD_STRUCT thread_struct;
+
+pthread_cond_t sync_cond;
+pthread_mutex_t sync_mutex;
+int sync_var=-1; //!< protected by mutex \ref sync_mutex.
+int config_sync_var=-1;
+
+volatile int oai_exit = 0;
+uint16_t sf_ahead = 4;
+RU_t ru_m;
+
+
+extern void init_RU0(RU_t *ru,int ru_id,char *rf_config_file, int send_dmrssync);
+extern void init_RU_proc(RU_t *ru);
+extern void kill_RU_proc(RU_t *ru);
+extern void set_function_spec_param(RU_t *ru);
+
+int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
+
+
+void nfapi_setmode(nfapi_mode_t nfapi_mode) { return; }
+void exit_function(const char *file, const char *function, const int line, const char *s) {
+
+ if (s != NULL) {
+ printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
+ }
+ close_log_mem();
+ oai_exit = 1;
+
+ if (ru_m.rfdevice.trx_end_func) {
+ ru_m.rfdevice.trx_end_func(&ru_m.rfdevice);
+ ru_m.rfdevice.trx_end_func = NULL;
+ }
+
+ if (ru_m.ifdevice.trx_end_func) {
+ ru_m.ifdevice.trx_end_func(&ru_m.ifdevice);
+ ru_m.ifdevice.trx_end_func = NULL;
+ }
+
+ pthread_mutex_destroy(ru_m.ru_mutex);
+ pthread_cond_destroy(ru_m.ru_cond);
+ sleep(1); //allow lte-softmodem threads to exit first
+ exit(1);
+}
+
+
+static void get_options(void) {
+ CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
+ get_common_options(SOFTMODEM_ENB_BIT );
+ CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
+
+ //RCConfig();
+
+}
+
+
+
+
+
+extern void phy_free_RU(RU_t *);
+
+nfapi_mode_t nfapi_getmode(void) {
+ return(NFAPI_MODE_PNF);
+}
+
+void oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
+
+ AssertFatal(1==0,"This is bad ... please check why we get here\n");
+}
+
+void wait_eNBs(void){ return; }
+
+uint64_t downlink_frequency[MAX_NUM_CCs][4];
+
+
+int main ( int argc, char **argv )
+{
+
+ if ( load_configmodule(argc,argv,0) == NULL) {
+ exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
+ }
+
+ logInit();
+ printf("Reading in command-line options\n");
+ get_options ();
+
+ if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
+ fprintf(stderr,"Getting configuration failed\n");
+ exit(-1);
+ }
+
+#if T_TRACER
+ T_Config_Init();
+#endif
+ printf("configuring for RRU\n");
+
+#ifndef PACKAGE_VERSION
+# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
+#endif
+ LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
+
+ /* Read configuration */
+
+ printf("About to Init RU threads\n");
+
+
+ RU_t *ru=&ru_m;
+
+ paramdef_t RUParams[] = RUPARAMS_DESC;
+ paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
+ config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
+
+ int j=0;
+ uint64_t ru_mask=1;
+ pthread_mutex_t ru_mutex; pthread_mutex_init(&ru_mutex,NULL);
+ pthread_cond_t ru_cond; pthread_cond_init(&ru_cond,NULL);
+
+ ru->ru_mask= &ru_mask;
+ ru->ru_mutex = &ru_mutex;
+ ru->ru_cond = &ru_cond;
+
+ ru->if_timing = synch_to_ext_device;
+ ru->num_eNB = 0;
+ ru->has_ctrl_prt = 1;
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_ADDRS)) {
+ ru->openair0_cfg.sdr_addrs = strdup(*(RUParamList.paramarray[j][RU_SDR_ADDRS].strptr));
+ }
+
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) {
+ if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) {
+ ru->openair0_cfg.clock_source = internal;
+ LOG_D(PHY, "RU clock source set as internal\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) {
+ ru->openair0_cfg.clock_source = external;
+ LOG_D(PHY, "RU clock source set as external\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) {
+ ru->openair0_cfg.clock_source = gpsdo;
+ LOG_D(PHY, "RU clock source set as gpsdo\n");
+ } else {
+ LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
+ }
+ }
+ else {
+ ru->openair0_cfg.clock_source = unset;
+ }
+
+ if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) {
+ if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) {
+ ru->openair0_cfg.time_source = internal;
+ LOG_D(PHY, "RU time source set as internal\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) {
+ ru->openair0_cfg.time_source = external;
+ LOG_D(PHY, "RU time source set as external\n");
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) {
+ ru->openair0_cfg.time_source = gpsdo;
+ LOG_D(PHY, "RU time source set as gpsdo\n");
+ } else {
+ LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
+ }
+ }
+ else {
+ ru->openair0_cfg.time_source = unset;
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
+ if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
+ AssertFatal(1==0,"IF_NAME is required\n");
+ } else {
+ ru->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
+ ru->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
+ ru->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
+ ru->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
+ ru->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
+
+ // Check if control port set
+ if (!(config_isparamset(RUParamList.paramarray[j],RU_REMOTE_PORTC_IDX)) ) {
+ printf("Removing control port for RU %d\n",j);
+ ru->has_ctrl_prt = 0;
+ } else {
+ ru->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
+ ru->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
+ printf(" Control port %u \n",ru->eth_params.my_portc);
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF5;
+ ru->eth_params.transp_preference = ETH_UDP_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF5;
+ ru->eth_params.transp_preference = ETH_RAW_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF4p5;
+ ru->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j);
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
+ ru->if_south = LOCAL_RF;
+ ru->function = NGFI_RRU_IF4p5;
+ ru->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
+ printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j);
+ }
+
+ printf("RU %d is_slave=%s\n",j,*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr));
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru->is_slave=1;
+ else ru->is_slave=0;
+
+ printf("RU %d ota_sync_enabled=%s\n",j,*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr));
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr), "yes") == 0) ru->ota_sync_enable=1;
+ else ru->ota_sync_enable=0;
+ }
+
+ ru->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
+ ru->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
+ ru->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
+ /* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */
+ ru->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr);
+
+ for (int i=0; inum_bands; i++) ru->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
+ } //strcmp(local_rf, "yes") == 0
+ else {
+ printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr));
+ ru->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
+ ru->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
+ ru->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
+ ru->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
+ ru->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
+ ru->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
+ ru->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
+ ru->if_south = REMOTE_IF5;
+ ru->function = NGFI_RAU_IF5;
+ ru->eth_params.transp_preference = ETH_UDP_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
+ ru->if_south = REMOTE_IF5;
+ ru->function = NGFI_RAU_IF5;
+ ru->eth_params.transp_preference = ETH_RAW_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
+ ru->if_south = REMOTE_IF4p5;
+ ru->function = NGFI_RAU_IF4p5;
+ ru->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
+ } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
+ ru->if_south = REMOTE_IF4p5;
+ ru->function = NGFI_RAU_IF4p5;
+ ru->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
+ }
+
+ if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru->is_slave=1;
+ else ru->is_slave=0;
+ } /* strcmp(local_rf, "yes") != 0 */
+
+ ru->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
+ ru->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
+ ru->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
+ ru->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
+
+
+ set_worker_conf("WORKER_ENABLE");
+
+ mlockall(MCL_CURRENT | MCL_FUTURE);
+ pthread_cond_init(&sync_cond,NULL);
+ pthread_mutex_init(&sync_mutex, NULL);
+
+ init_RU0(ru,0,get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync);
+ ru->rf_map.card=0;
+ ru->rf_map.chain=(get_softmodem_params()->chain_offset);
+
+ LOG_I(PHY, "Initializing RRU descriptor : (%s,%s,%d)\n", ru_if_types[ru->if_south], NB_timing[ru->if_timing], ru->function);
+ set_function_spec_param(ru);
+ LOG_I(PHY, "Starting ru_thread , is_slave %d, send_dmrs %d\n", ru->is_slave, ru->generate_dmrs_sync);
+ init_RU_proc(ru);
+
+ pthread_mutex_lock(&ru_mutex);
+ while (ru_mask>0)
+ pthread_cond_wait(&ru_cond,&ru_mutex);
+ pthread_mutex_unlock(&ru_mutex);
+ LOG_I(PHY,"RU configured, unlocking threads\n");
+ config_sync_var=0;
+ pthread_mutex_lock(&sync_mutex);
+ sync_var=0;
+ pthread_cond_broadcast(&sync_cond);
+ pthread_mutex_unlock(&sync_mutex);
+
+ while (oai_exit==0) sleep(1);
+ // stop threads
+
+ kill_RU_proc(ru);
+ phy_free_RU(ru);
+
+ free_lte_top();
+ end_configmodule();
+
+ if (ru->rfdevice.trx_end_func) {
+ ru->rfdevice.trx_end_func(&ru->rfdevice);
+ ru->rfdevice.trx_end_func = NULL;
+ }
+
+ if (ru->ifdevice.trx_end_func) {
+ ru->ifdevice.trx_end_func(&ru->ifdevice);
+ ru->ifdevice.trx_end_func = NULL;
+ }
+
+
+
+ logClean();
+ printf("Bye.\n");
+ return 0;
+}
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index 597d7563c0..e82659f198 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -81,10 +81,13 @@
#include "s1ap_eNB.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
-
+#include
#include "T.h"
#include "nfapi/oai_integration/vendor_ext.h"
+#include
+#include
+#include
//#define DEBUG_THREADS 1
//#define USRP_DEBUG 1
@@ -92,17 +95,6 @@
// extern openair0_device openair0;
-extern volatile int start_gNB;
-extern volatile int start_UE;
-extern volatile int oai_exit;
-
-extern openair0_config_t openair0_cfg[MAX_CARDS];
-
-extern int transmission_mode;
-
-extern uint16_t sf_ahead;
-extern uint16_t sl_ahead;
-
//pthread_t main_gNB_thread;
time_stats_t softmodem_stats_mt; // main thread
@@ -111,40 +103,43 @@ time_stats_t softmodem_stats_rxtx_sf; // total tx time
time_stats_t nfapi_meas; // total tx time
time_stats_t softmodem_stats_rx_sf; // total rx time
-/* mutex, cond and variable to serialize phy proc TX calls
- * (this mechanism may be relaxed in the future for better
- * performances)
- */
-static struct {
- pthread_mutex_t mutex_phy_proc_tx;
- pthread_cond_t cond_phy_proc_tx;
- volatile uint8_t phy_proc_CC_id;
-} sync_phy_proc;
-extern double cpuf;
-
-void init_gNB(int,int);
-void stop_gNB(int nb_inst);
-
-int wakeup_txfh(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, int frame_tx, int slot_tx, uint64_t timestamp_tx);
-int wakeup_tx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, uint64_t timestamp_tx);
#include "executables/thread-common.h"
-//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
-//extern WORKER_CONF_t get_thread_worker_conf(void);
-void wakeup_prach_gNB(PHY_VARS_gNB *gNB, RU_t *ru, int frame, int subframe);
-
-extern uint8_t nfapi_mode;
-extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
-extern void oai_slot_ind(uint16_t sfn, uint16_t slot);
-extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
-
//#define TICK_TO_US(ts) (ts.diff)
#define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials)
-static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, char *thread_name) {
+void tx_func(void *param) {
+
+ processingData_L1_t *info = (processingData_L1_t *) param;
+ PHY_VARS_gNB *gNB = info->gNB;
+ int frame_tx = info->frame_tx;
+ int slot_tx = info->slot_tx;
+
+ phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1);
+
+ // start FH TX processing
+ notifiedFIFO_elt_t *res;
+ res = pullTpool(gNB->resp_RU_tx, gNB->threadPool);
+ processingData_RU_t *syncMsg = (processingData_RU_t *)NotifiedFifoData(res);
+ syncMsg->frame_tx = frame_tx;
+ syncMsg->slot_tx = slot_tx;
+ syncMsg->timestamp_tx = info->timestamp_tx;
+ syncMsg->ru = gNB->RU_list[0];
+ res->key = slot_tx;
+ pushTpool(gNB->threadPool, res);
+}
+
+void rx_func(void *param) {
+
+ processingData_L1_t *info = (processingData_L1_t *) param;
+ PHY_VARS_gNB *gNB = info->gNB;
+ int frame_rx = info->frame_rx;
+ int slot_rx = info->slot_rx;
+ int frame_tx = info->frame_tx;
+ int slot_tx = info->slot_tx;
sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
@@ -235,22 +230,6 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
rnti_to_remove_count = 0;
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
- /*
- // if this is IF5 or 3GPP_gNB
- if (gNB && gNB->RU_list && gNB->RU_list[0] && gNB->RU_list[0]->function < NGFI_RAU_IF4p5) {
- wakeup_prach_gNB(gNB,NULL,proc->frame_rx,proc->slot_rx);
- }
- */
- // Call the scheduler
-
- pthread_mutex_lock(&gNB->UL_INFO_mutex);
- gNB->UL_INFO.frame = frame_rx;
- gNB->UL_INFO.slot = slot_rx;
- gNB->UL_INFO.module_id = gNB->Mod_id;
- gNB->UL_INFO.CC_id = gNB->CC_id;
- gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
- pthread_mutex_unlock(&gNB->UL_INFO_mutex);
-
// RX processing
int tx_slot_type; int rx_slot_type;
if(NFAPI_MODE != NFAPI_MONOLITHIC) { //slot selection routines not working properly in nfapi, so temporarily hardcoding
@@ -288,33 +267,47 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
L1_nr_prach_procedures(gNB,frame_rx,slot_rx);
//apply the rx signal rotation here
- apply_nr_rotation_ul(&gNB->frame_parms,
- gNB->common_vars.rxdataF[0],
- slot_rx,
- 0,
- gNB->frame_parms.Ncp==EXTENDED?12:14,
- gNB->frame_parms.ofdm_symbol_size);
-
- phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
- }
-
- if (oai_exit) return(-1);
-
- // *****************************************
- // TX processing for subframe n+sf_ahead
- // run PHY TX procedures the one after the other for all CCs to avoid race conditions
- // (may be relaxed in the future for performance reasons)
- // *****************************************
-
- if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) {
-
- if(get_thread_parallel_conf() != PARALLEL_RU_L1_TRX_SPLIT) {
- phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1);
+ for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
+ apply_nr_rotation_ul(&gNB->frame_parms,
+ gNB->common_vars.rxdataF[aa],
+ slot_rx,
+ 0,
+ gNB->frame_parms.Ncp==EXTENDED?12:14,
+ gNB->frame_parms.ofdm_symbol_size);
}
+ phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
}
stop_meas( &softmodem_stats_rxtx_sf );
LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx);
+
+ // Call the scheduler
+
+ start_meas(&gNB->ul_indication_stats);
+ pthread_mutex_lock(&gNB->UL_INFO_mutex);
+ gNB->UL_INFO.frame = frame_rx;
+ gNB->UL_INFO.slot = slot_rx;
+ gNB->UL_INFO.module_id = gNB->Mod_id;
+ gNB->UL_INFO.CC_id = gNB->CC_id;
+ gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
+ pthread_mutex_unlock(&gNB->UL_INFO_mutex);
+ stop_meas(&gNB->ul_indication_stats);
+
+ notifiedFIFO_elt_t *res;
+
+ if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) {
+ res = pullTpool(gNB->resp_L1_tx, gNB->threadPool);
+ processingData_L1_t *syncMsg = (processingData_L1_t *)NotifiedFifoData(res);
+ syncMsg->gNB = gNB;
+ syncMsg->frame_rx = frame_rx;
+ syncMsg->slot_rx = slot_rx;
+ syncMsg->frame_tx = frame_tx;
+ syncMsg->slot_tx = slot_tx;
+ syncMsg->timestamp_tx = info->timestamp_tx;
+ res->key = slot_tx;
+ pushTpool(gNB->threadPool, res);
+ }
+
#if 0
LOG_D(PHY, "rxtx:%lld nfapi:%lld phy:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ",
softmodem_stats_rxtx_sf.diff_now, nfapi_meas.diff_now,
@@ -354,568 +347,60 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
TICK_TO_US(gNB->ulsch_tc_intl2_stats)
);
#endif
- return(0);
}
-
-static void *gNB_L1_thread_tx(void *param) {
- PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
- gNB_L1_proc_t *gNB_proc = &gNB->proc;
- gNB_L1_rxtx_proc_t *L1_proc_tx = &gNB_proc->L1_proc_tx;
- //PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id];
- char thread_name[100];
-
- sprintf(thread_name,"gNB_L1_thread_tx\n");
-
- while (!oai_exit) {
- if (wait_on_condition(&L1_proc_tx->mutex,&L1_proc_tx->cond,&L1_proc_tx->instance_cnt,thread_name)<0) break;
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX1, 1 );
-
- if (oai_exit) break;
-
- // *****************************************
- // TX processing for subframe n+4
- // run PHY TX procedures the one after the other for all CCs to avoid race conditions
- // (may be relaxed in the future for performance reasons)
- // *****************************************
- int frame_tx = L1_proc_tx->frame_tx;
- int slot_tx = L1_proc_tx->slot_tx;
- uint64_t timestamp_tx = L1_proc_tx->timestamp_tx;
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX1_GNB,slot_tx);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_GNB,frame_tx);
- phy_procedures_gNB_TX(gNB, frame_tx,slot_tx, 1);
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_WAKEUP_TXFH, 1 );
- pthread_mutex_lock( &L1_proc_tx->mutex );
- L1_proc_tx->instance_cnt = -1;
-
- // the thread can now be woken up
- if (pthread_cond_signal(&L1_proc_tx->cond) != 0) {
- LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB TXnp4 thread\n");
- exit_fun( "ERROR pthread_cond_signal" );
- }
- pthread_mutex_unlock(&L1_proc_tx->mutex);
-
- wakeup_txfh(gNB,L1_proc_tx,frame_tx,slot_tx,timestamp_tx);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_WAKEUP_TXFH, 0 );
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX1, 0 );
- }
-
- return 0;
-}
-
-/*!
- * \brief The RX UE-specific and TX thread of gNB.
- * \param param is a \ref gNB_L1_proc_t structure which contains the info what to process.
- * \returns a pointer to an int. The storage is not on the heap and must not be freed.
- */
-
-static void *gNB_L1_thread( void *param ) {
- static int gNB_thread_rxtx_status;
- PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
- gNB_L1_proc_t *gNB_proc = &gNB->proc;
- gNB_L1_rxtx_proc_t *L1_proc = &gNB_proc->L1_proc;
- //PHY_VARS_gNB *gNB = RC.gNB[0][proc->CC_id];
- char thread_name[100];
- // set default return value
- // set default return value
- gNB_thread_rxtx_status = 0;
-
- sprintf(thread_name,"gNB_L1_thread");
-
-
- while (!oai_exit) {
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 );
- if (wait_on_condition(&L1_proc->mutex,&L1_proc->cond,&L1_proc->instance_cnt,thread_name)<0) break;
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 1 );
-
- int frame_rx = L1_proc->frame_rx;
- int slot_rx;
- if (NFAPI_MODE == NFAPI_MODE_PNF)
- slot_rx = (L1_proc->slot_rx) + 1;
- else
- slot_rx = L1_proc->slot_rx;
- int frame_tx = L1_proc->frame_tx;
- int slot_tx = L1_proc->slot_tx;
- uint64_t timestamp_tx = L1_proc->timestamp_tx;
- if(NFAPI_MODE==NFAPI_MODE_VNF)
- if (gNB->CC_id==0) {
- int next_slot;
- next_slot = (slot_rx + 1) % 20;
- int next_frame_rx = (frame_rx + ((slot_rx + 1) % 20 == 0)) % 1024;
- int next_frame_tx = (frame_tx + ((slot_rx + 1) % 20 == 0)) % 1024;
- if (rxtx(gNB, next_frame_rx, next_slot, next_frame_tx, next_slot, thread_name) < 0) break;
- }
- if (wait_on_condition(&L1_proc->mutex,&L1_proc->cond,&L1_proc->instance_cnt,thread_name)<0) break;
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 1 );
-
-
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX0_GNB,slot_tx);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_RX0_GNB,slot_rx);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_GNB,frame_tx);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_GNB,frame_rx);
-
- if (oai_exit) break;
-
- if (gNB->CC_id==0) {
- if (rxtx(gNB,frame_rx,slot_rx,frame_tx,slot_tx,thread_name) < 0) break;
- }
-
- if (release_thread(&L1_proc->mutex,&L1_proc->instance_cnt,thread_name)<0) break;
-
- if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(gNB,frame_rx,slot_rx,frame_tx,slot_tx,timestamp_tx);
- else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) wakeup_txfh(gNB,L1_proc,frame_tx,slot_tx,timestamp_tx);
- } // while !oai_exit
-
- LOG_D(PHY, " *** Exiting gNB thread RXn_TXnp4\n");
- gNB_thread_rxtx_status = 0;
- return &gNB_thread_rxtx_status;
-}
-
-
-#if 0
-// Wait for gNB application initialization to be complete (gNB registration to MME)
-static void wait_system_ready (char *message, volatile int *start_flag) {
- static char *indicator[] = {". ", ".. ", "... ", ".... ", ".....",
- " ....", " ...", " ..", " .", " "
- };
- int i = 0;
-
- while ((!oai_exit) && (*start_flag == 0)) {
- LOG_N(EMU, message, indicator[i]);
- fflush(stdout);
- i = (i + 1) % (sizeof(indicator) / sizeof(indicator[0]));
- usleep(200000);
- }
-
- LOG_D(EMU,"\n");
-}
-#endif
-
-
-
-
-
-void gNB_top(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, char *string, struct RU_t_s *ru) {
- gNB_L1_proc_t *proc = &gNB->proc;
- gNB_L1_rxtx_proc_t *L1_proc = &proc->L1_proc;
- NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
- RU_proc_t *ru_proc=&ru->proc;
- proc->frame_rx = frame_rx;
- proc->slot_rx = slot_rx;
- sl_ahead = sf_ahead*fp->slots_per_subframe;
-
- if (!oai_exit) {
- T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->slot_rx));
- L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe);
- L1_proc->frame_rx = ru_proc->frame_rx;
- L1_proc->slot_rx = ru_proc->tti_rx;
- L1_proc->frame_tx = (L1_proc->slot_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
- L1_proc->slot_tx = (L1_proc->slot_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame;
-
- if (rxtx(gNB,L1_proc->frame_rx,L1_proc->slot_rx,L1_proc->frame_tx,L1_proc->slot_tx,string) < 0) LOG_E(PHY,"gNB %d CC_id %d failed during execution\n",gNB->Mod_id,gNB->CC_id);
-
- ru_proc->timestamp_tx = L1_proc->timestamp_tx;
- ru_proc->tti_tx = L1_proc->slot_tx;
- ru_proc->frame_tx = L1_proc->frame_tx;
- }
-}
-
-int wakeup_txfh(PHY_VARS_gNB *gNB,gNB_L1_rxtx_proc_t *proc,int frame_tx,int slot_tx,uint64_t timestamp_tx) {
-
- RU_t *ru;
- RU_proc_t *ru_proc;
-
- int waitret = 0, ret = 0, time_ns = 1000*1000;
- struct timespec now, abstime;
- // note this should depend on the numerology used by the TX L1 thread, set here for 500us slot time
- // note this should depend on the numerology used by the TX L1 thread, set here for 500us slot time
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,1);
- time_ns = time_ns/gNB->frame_parms.slots_per_subframe;
- AssertFatal((ret = pthread_mutex_lock(&proc->mutex_RUs_tx))==0,"mutex_lock returns %d\n",ret);
- while (proc->instance_cnt_RUs < 0) {
- clock_gettime(CLOCK_REALTIME, &now);
- abstime.tv_sec = now.tv_sec;
- abstime.tv_nsec = now.tv_nsec + time_ns;
-
- if (abstime.tv_nsec >= 1000*1000*1000) {
- abstime.tv_nsec -= 1000*1000*1000;
- abstime.tv_sec += 1;
- }
- if((waitret = pthread_cond_timedwait(&proc->cond_RUs,&proc->mutex_RUs_tx,&abstime)) == 0) break; // this unlocks mutex_rxtx while waiting and then locks it again
- }
- proc->instance_cnt_RUs = -1;
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs);
- AssertFatal((ret = pthread_mutex_unlock(&proc->mutex_RUs_tx))==0,"mutex_unlock returns %d\n",ret);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GAIN_CONTROL,0);
-
- if (waitret == ETIMEDOUT) {
- LOG_W(PHY,"Dropping TX slot (%d.%d) because FH is blocked more than 1 slot times (500us)\n",frame_tx,slot_tx);
-
- AssertFatal((ret=pthread_mutex_lock(&gNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret);
- gNB->proc.RU_mask_tx = 0;
- AssertFatal((ret=pthread_mutex_unlock(&gNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
- AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RUs_tx))==0,"mutex_lock returns %d\n",ret);
- proc->instance_cnt_RUs = 0;
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,proc->instance_cnt_RUs);
- AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RUs_tx))==0,"mutex_unlock returns %d\n",ret);
-
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,1);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE,0);
-
- return(-1);
- }
-
- for(int i=0; inum_RU; i++)
- {
- ru = gNB->RU_list[i];
- ru_proc = &ru->proc;
-
-
- if (ru_proc->instance_cnt_gNBs == 0) {
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE, 1);
- LOG_E(PHY,"Frame %d, subframe %d: TX FH thread busy, dropping Frame %d, subframe %d\n", ru_proc->frame_tx, ru_proc->tti_tx, proc->frame_rx, proc->slot_rx);
- AssertFatal((ret=pthread_mutex_lock(&gNB->proc.mutex_RU_tx))==0,"mutex_lock returns %d\n",ret);
- gNB->proc.RU_mask_tx = 0;
- AssertFatal((ret=pthread_mutex_unlock(&gNB->proc.mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret);
-
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST_UE, 0);
- return(-1);
- }
- AssertFatal((ret = pthread_mutex_lock(&ru_proc->mutex_gNBs))==0,"ERROR pthread_mutex_lock failed on mutex_gNBs L1_thread_tx with ret=%d\n",ret);
-
- ru_proc->instance_cnt_gNBs = 0;
- ru_proc->timestamp_tx = timestamp_tx;
- ru_proc->tti_tx = slot_tx;
- ru_proc->frame_tx = frame_tx;
-
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_UE, ru_proc->instance_cnt_gNBs);
-
- LOG_D(PHY,"Signaling tx_thread_fh for %d.%d\n",frame_tx,slot_tx);
- // the thread can now be woken up
- AssertFatal(pthread_cond_signal(&ru_proc->cond_gNBs) == 0,
- "[gNB] ERROR pthread_cond_signal for gNB TXnp4 thread\n");
- AssertFatal((ret=pthread_mutex_unlock(&ru_proc->mutex_gNBs))==0,"mutex_unlock returned %d\n",ret);
-
- }
- return(0);
-}
-
-int wakeup_tx(PHY_VARS_gNB *gNB,int frame_rx,int slot_rx,int frame_tx,int slot_tx,uint64_t timestamp_tx) {
-
-
- gNB_L1_rxtx_proc_t *L1_proc_tx = &gNB->proc.L1_proc_tx;
-
- int ret;
-
-
- AssertFatal((ret = pthread_mutex_lock(&L1_proc_tx->mutex))==0,"mutex_lock returns %d\n",ret);
-
-
- while(L1_proc_tx->instance_cnt == 0) {
- pthread_cond_wait(&L1_proc_tx->cond,&L1_proc_tx->mutex);
- }
-
- L1_proc_tx->instance_cnt = 0;
-
-
- L1_proc_tx->slot_rx = slot_rx;
- L1_proc_tx->frame_rx = frame_rx;
- L1_proc_tx->slot_tx = slot_tx;
- L1_proc_tx->frame_tx = frame_tx;
- L1_proc_tx->timestamp_tx = timestamp_tx;
-
-
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_UE,1);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_UE,0);
- // the thread can now be woken up
- // the thread can now be woken up
- AssertFatal(pthread_cond_signal(&L1_proc_tx->cond) == 0, "ERROR pthread_cond_signal for gNB L1 thread\n");
-
- AssertFatal((ret=pthread_mutex_unlock(&L1_proc_tx->mutex))==0,"mutex_unlock returns %d\n",ret);
-
- return(0);
-}
-
-int wakeup_rxtx(PHY_VARS_gNB *gNB,RU_t *ru) {
- gNB_L1_proc_t *proc=&gNB->proc;
- gNB_L1_rxtx_proc_t *L1_proc=&proc->L1_proc;
- NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
- RU_proc_t *ru_proc=&ru->proc;
- int ret;
- int i;
- struct timespec abstime;
- int time_ns = 50000;
- int wait_timer = 0;
- bool do_last_check = 1;
-
- AssertFatal((ret=pthread_mutex_lock(&proc->mutex_RU))==0,"mutex_lock returns %d\n",ret);
- for (i=0; inum_RU; i++) {
- if (ru == gNB->RU_list[i]) {
- if ((proc->RU_mask&(1< 0)
- LOG_E(PHY,"gNB %d frame %d, subframe %d : previous information from RU %d (num_RU %d,mask %x) has not been served yet!\n",
- gNB->Mod_id,proc->frame_rx,proc->slot_rx,ru->idx,gNB->num_RU,proc->RU_mask);
- proc->RU_mask |= (1<RU_mask != (1<num_RU)-1) { // not all RUs have provided their information so return
- LOG_E(PHY,"Not all RUs have provided their info\n");
- AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RU))==0,"mutex_unlock returns %d\n",ret);
- return(0);
- }
- else { // all RUs have provided their information so continue on and wakeup gNB processing
- proc->RU_mask = 0;
- AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_RU))==0,"muex_unlock returns %d\n",ret);
- }
-
- // wake up TX for subframe n+sf_ahead
- // lock the TX mutex and make sure the thread is ready
- while (wait_timer < 200) {
- clock_gettime(CLOCK_REALTIME, &abstime);
- abstime.tv_nsec = abstime.tv_nsec + time_ns;
-
- if (abstime.tv_nsec >= 1000*1000*1000) {
- abstime.tv_nsec -= 1000*1000*1000;
- abstime.tv_sec += 1;
- }
-
- AssertFatal((ret=pthread_mutex_timedlock(&L1_proc->mutex, &abstime)) == 0,"mutex_lock returns %d\n", ret);
-
- if (L1_proc->instance_cnt == 0) { // L1_thread is busy so wait for a bit
- AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"muex_unlock return %d\n",ret);
- wait_timer += 50;
- usleep(50);
- }
- else {
- do_last_check = 0;
- break;
- }
- }
- if (do_last_check) {
- AssertFatal((ret=pthread_mutex_timedlock(&L1_proc->mutex, &abstime)) == 0,"mutex_lock returns %d\n", ret);
- if (L1_proc->instance_cnt == 0) { // L1_thread is busy so abort the subframe
- AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"muex_unlock return %d\n",ret);
- LOG_W(PHY,"L1_thread isn't ready in %d.%d, aborting RX processing\n",ru_proc->frame_rx,ru_proc->tti_rx);
- return (-1);
- }
- }
-
- ++L1_proc->instance_cnt;
- // We have just received and processed the common part of a subframe, say n.
- // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
- // transmitted timestamp of the next TX slot (first).
-
- // The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
- // we want to generate subframe (n+sf_ahead), so TS_tx = TX_rx+sf_ahead*samples_per_tti,
- // and proc->slot_tx = proc->slot_rx+sf_ahead
- L1_proc->timestamp_tx = ru_proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe);
- L1_proc->frame_rx = ru_proc->frame_rx;
- L1_proc->slot_rx = ru_proc->tti_rx;
- L1_proc->frame_tx = (L1_proc->slot_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
- L1_proc->slot_tx = (L1_proc->slot_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame;
-
- LOG_D(PHY,"wakeupL1: passing parameter IC = %d, RX: %d.%d, TX: %d.%d to L1 sf_ahead = %d\n", L1_proc->instance_cnt, L1_proc->frame_rx, L1_proc->slot_rx, L1_proc->frame_tx, L1_proc->slot_tx, sf_ahead);
-
- pthread_mutex_unlock( &L1_proc->mutex );
-
- // the thread can now be woken up
- if (pthread_cond_signal(&L1_proc->cond) != 0) {
- LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB RXn-TXnp4 thread\n");
- exit_fun( "ERROR pthread_cond_signal" );
- return(-1);
- }
-
- return(0);
-}
-/*
-void wakeup_prach_gNB(PHY_VARS_gNB *gNB,RU_t *ru,int frame,int subframe) {
-
- gNB_L1_proc_t *proc = &gNB->proc;
- LTE_DL_FRAME_PARMS *fp=&gNB->frame_parms;
- int i;
-
- if (ru!=NULL) {
- pthread_mutex_lock(&proc->mutex_RU_PRACH);
- for (i=0;inum_RU;i++) {
- if (ru == gNB->RU_list[i]) {
- LOG_D(PHY,"frame %d, subframe %d: RU %d for gNB %d signals PRACH (mask %x, num_RU %d)\n",frame,subframe,i,gNB->Mod_id,proc->RU_mask_prach,gNB->num_RU);
- if ((proc->RU_mask_prach&(1< 0)
- LOG_E(PHY,"gNB %d frame %d, subframe %d : previous information (PRACH) from RU %d (num_RU %d, mask %x) has not been served yet!\n",
- gNB->Mod_id,frame,subframe,ru->idx,gNB->num_RU,proc->RU_mask_prach);
- proc->RU_mask_prach |= (1<RU_mask_prach != (1<num_RU)-1) { // not all RUs have provided their information so return
- pthread_mutex_unlock(&proc->mutex_RU_PRACH);
- return;
- }
- else { // all RUs have provided their information so continue on and wakeup gNB processing
- proc->RU_mask_prach = 0;
- pthread_mutex_unlock(&proc->mutex_RU_PRACH);
- }
- }
-
- // check if we have to detect PRACH first
- if (is_prach_subframe(fp,frame,subframe)>0) {
- LOG_D(PHY,"Triggering prach processing, frame %d, subframe %d\n",frame,subframe);
- if (proc->instance_cnt_prach == 0) {
- LOG_W(PHY,"[gNB] Frame %d Subframe %d, dropping PRACH\n", frame,subframe);
- return;
- }
-
- // wake up thread for PRACH RX
- if (pthread_mutex_lock(&proc->mutex_prach) != 0) {
- LOG_E( PHY, "[gNB] ERROR pthread_mutex_lock for gNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach);
- exit_fun( "error locking mutex_prach" );
- return;
- }
-
- ++proc->instance_cnt_prach;
- // set timing for prach thread
- proc->frame_prach = frame;
- proc->subframe_prach = subframe;
-
- // the thread can now be woken up
- if (pthread_cond_signal(&proc->cond_prach) != 0) {
- LOG_E( PHY, "[gNB] ERROR pthread_cond_signal for gNB PRACH thread %d\n", proc->thread_index);
- exit_fun( "ERROR pthread_cond_signal" );
- return;
- }
-
- pthread_mutex_unlock( &proc->mutex_prach );
- }
-
-}*/
-
-/*!
- * \brief The prach receive thread of gNB.
- * \param param is a \ref gNB_L1_proc_t structure which contains the info what to process.
- * \returns a pointer to an int. The storage is not on the heap and must not be freed.
- */
-/*
-static void* gNB_thread_prach( void* param ) {
- static int gNB_thread_prach_status;
-
-
- PHY_VARS_gNB *gNB= (PHY_VARS_gNB *)param;
- gNB_L1_proc_t *proc = &gNB->proc;
-
- // set default return value
- gNB_thread_prach_status = 0;
-
-
-
- while (!oai_exit) {
-
- if (oai_exit) break;
-
-
- if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"gNB_prach_thread") < 0) break;
-
- LOG_D(PHY,"Running gNB prach procedures\n");
- prach_procedures(gNB ,0);
-
- if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"gNB_prach_thread") < 0) break;
- }
-
- LOG_I(PHY, "Exiting gNB thread PRACH\n");
-
- gNB_thread_prach_status = 0;
- return &gNB_thread_prach_status;
-}
-*/
-
-extern void init_td_thread(PHY_VARS_gNB *);
-extern void init_te_thread(PHY_VARS_gNB *);
-
static void *process_stats_thread(void *param) {
PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
+ reset_meas(&gNB->phy_proc_tx);
reset_meas(&gNB->dlsch_encoding_stats);
- reset_meas(&gNB->dlsch_scrambling_stats);
- reset_meas(&gNB->dlsch_modulation_stats);
+ reset_meas(&gNB->phy_proc_rx);
+ reset_meas(&gNB->ul_indication_stats);
+ reset_meas(&gNB->rx_pusch_stats);
+ reset_meas(&gNB->ulsch_decoding_stats);
wait_sync("process_stats_thread");
while(!oai_exit)
{
sleep(1);
- print_meas(&gNB->dlsch_encoding_stats, "pdsch_encoding", NULL, NULL);
- print_meas(&gNB->dlsch_scrambling_stats, "pdsch_scrambling", NULL, NULL);
- print_meas(&gNB->dlsch_modulation_stats, "pdsch_modulation", NULL, NULL);
+ print_meas(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL);
+ print_meas(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL);
+ print_meas(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL);
+ print_meas(&gNB->ul_indication_stats, "UL Indication", NULL, NULL);
+ print_meas(&gNB->rx_pusch_stats, "PUSCH inner-receiver", NULL, NULL);
+ print_meas(&gNB->ulsch_decoding_stats, "PUSCH decoding", NULL, NULL);
}
return(NULL);
}
+void *nrL1_stats_thread(void *param) {
+ PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
+ wait_sync("L1_stats_thread");
+ FILE *fd;
+ while (!oai_exit) {
+ sleep(1);
+ fd=fopen("nrL1_stats.log","w");
+ AssertFatal(fd!=NULL,"Cannot open nrL1_stats.log\n");
+ dump_nr_I0_stats(fd,gNB);
+ dump_pusch_stats(fd,gNB);
+ // nr_dump_uci_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx);
+ fclose(fd);
+ }
+ return(NULL);
+}
-void init_gNB_proc(int inst) {
- int i=0;
- int CC_id = 0;
+void init_gNB_Tpool(int inst) {
PHY_VARS_gNB *gNB;
- gNB_L1_proc_t *proc;
- gNB_L1_rxtx_proc_t *L1_proc,*L1_proc_tx;
-// LOG_I(PHY,"%s(inst:%d) RC.nb_nr_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_nr_CC[inst]);
gNB = RC.gNB[inst];
- LOG_I(PHY,"Initializing gNB processes instance:%d CC_id %d \n",inst,CC_id);
-
- proc = &gNB->proc;
- L1_proc = &proc->L1_proc;
- L1_proc_tx = &proc->L1_proc_tx;
- L1_proc->instance_cnt = -1;
- L1_proc_tx->instance_cnt = -1;
- L1_proc->instance_cnt_RUs = 0;
- L1_proc_tx->instance_cnt_RUs = 0;
- proc->instance_cnt_prach = -1;
- proc->instance_cnt_asynch_rxtx = -1;
- proc->CC_id = CC_id;
- proc->first_rx =1;
- proc->first_tx =1;
- proc->RU_mask =0;
- proc->RU_mask_tx = (1<num_RU)-1;
- proc->RU_mask_prach =0;
- pthread_mutex_init( &gNB->UL_INFO_mutex, NULL);
- pthread_mutex_init( &L1_proc->mutex, NULL);
- pthread_mutex_init( &L1_proc_tx->mutex, NULL);
- pthread_cond_init( &L1_proc->cond, NULL);
- pthread_cond_init( &L1_proc_tx->cond, NULL);
- pthread_mutex_init( &proc->mutex_prach, NULL);
- pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL);
- pthread_mutex_init( &proc->mutex_RU,NULL);
- pthread_mutex_init( &proc->mutex_RU_tx,NULL);
- pthread_mutex_init( &proc->mutex_RU_PRACH,NULL);
- pthread_cond_init( &proc->cond_prach, NULL);
- pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
- LOG_I(PHY,"gNB->single_thread_flag:%d\n", gNB->single_thread_flag);
-
- if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) {
- threadCreate( &L1_proc->pthread, gNB_L1_thread, gNB, "L1_proc", -1, OAI_PRIORITY_RT );
- threadCreate( &L1_proc_tx->pthread, gNB_L1_thread_tx, gNB,"L1_proc_tx", -1, OAI_PRIORITY_RT);
- }
-
- if(opp_enabled == 1) threadCreate(&proc->L1_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW);
- //pthread_create( &proc->pthread_prach, attr_prach, gNB_thread_prach, gNB );
- char name[16];
-
- if (gNB->single_thread_flag==0) {
- snprintf( name, sizeof(name), "L1 %d", i );
- pthread_setname_np( L1_proc->pthread, name );
- snprintf( name, sizeof(name), "L1TX %d", i );
- pthread_setname_np( L1_proc_tx->pthread, name );
- }
-
- AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach);
-
- /* setup PHY proc TX sync mechanism */
- pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL);
- pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL);
- sync_phy_proc.phy_proc_CC_id = 0;
+ gNB_L1_proc_t *proc = &gNB->proc;
+ // ULSCH decoding threadpool
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
- gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
int numCPU = sysconf(_SC_NPROCESSORS_ONLN);
+ LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->pusch_proc_threads,numCPU);
int threadCnt = min(numCPU, gNB->pusch_proc_threads);
+ if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt);
char ul_pool[80];
sprintf(ul_pool,"-1");
int s_offset = 0;
@@ -923,71 +408,44 @@ void init_gNB_proc(int inst) {
sprintf(ul_pool+2+s_offset,",-1");
s_offset += 3;
}
+ if (getenv("noThreads")) strcpy(ul_pool, "n");
initTpool(ul_pool, gNB->threadPool, false);
+ // ULSCH decoder result FIFO
+ gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(gNB->respDecode);
-}
+ // L1 RX result FIFO
+ gNB->resp_L1 = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
+ initNotifiedFIFO(gNB->resp_L1);
+
+ // L1 TX result FIFO
+ gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
+ initNotifiedFIFO(gNB->resp_L1_tx);
+
+ // RU TX result FIFO
+ gNB->resp_RU_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
+ initNotifiedFIFO(gNB->resp_RU_tx);
+
+ // Stats measurement thread
+ if(opp_enabled == 1) threadCreate(&proc->process_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -1, OAI_PRIORITY_RT_LOW);
+ threadCreate(&proc->L1_stats_thread,nrL1_stats_thread,(void*)gNB,"L1_stats",-1,OAI_PRIORITY_RT_LOW);
+
+}
/*!
* \brief Terminate gNB TX and RX threads.
*/
void kill_gNB_proc(int inst) {
- int *status;
PHY_VARS_gNB *gNB;
- gNB_L1_proc_t *proc;
- gNB_L1_rxtx_proc_t *L1_proc, *L1_proc_tx;
gNB=RC.gNB[inst];
- proc = &gNB->proc;
- L1_proc = &proc->L1_proc;
- L1_proc_tx = &proc->L1_proc_tx;
- LOG_I(PHY, "Killing TX inst %d\n",inst );
- if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) {
- pthread_mutex_lock(&L1_proc->mutex);
- L1_proc->instance_cnt = 0;
- pthread_cond_signal(&L1_proc->cond);
- pthread_mutex_unlock(&L1_proc->mutex);
- pthread_mutex_lock(&L1_proc_tx->mutex);
- L1_proc_tx->instance_cnt = 0;
- pthread_cond_signal(&L1_proc_tx->cond);
- pthread_mutex_unlock(&L1_proc_tx->mutex);
- }
-
- proc->instance_cnt_prach = 0;
- pthread_cond_signal( &proc->cond_prach );
- pthread_cond_signal( &proc->cond_asynch_rxtx );
- pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx);
- // LOG_D(PHY, "joining pthread_prach\n");
- // pthread_join( proc->pthread_prach, (void**)&status );
- LOG_I(PHY, "Destroying prach mutex/cond\n");
- pthread_mutex_destroy( &proc->mutex_prach );
- pthread_cond_destroy( &proc->cond_prach );
LOG_I(PHY, "Destroying UL_INFO mutex\n");
pthread_mutex_destroy(&gNB->UL_INFO_mutex);
- if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) {
- LOG_I(PHY, "Joining L1_proc mutex/cond\n");
- pthread_join( L1_proc->pthread, (void **)&status );
- LOG_I(PHY, "Joining L1_proc_tx mutex/cond\n");
- pthread_join( L1_proc_tx->pthread, (void **)&status );
- }
-
- LOG_I(PHY, "Destroying L1_proc mutex/cond\n");
- pthread_mutex_destroy( &L1_proc->mutex );
- pthread_cond_destroy( &L1_proc->cond );
- LOG_I(PHY, "Destroying L1_proc_tx mutex/cond\n");
- pthread_mutex_destroy( &L1_proc_tx->mutex );
- pthread_cond_destroy( &L1_proc_tx->cond );
- pthread_mutex_destroy( &proc->mutex_RU );
- pthread_mutex_destroy( &proc->mutex_RU_tx );
-
}
-
-
-
void reset_opp_meas(void) {
int sfn;
reset_meas(&softmodem_stats_mt);
@@ -1055,15 +513,9 @@ printf("after %p\n", gNB->common_vars.rxdataF[aa]);
* (not tested in other modes).
*/
//init_precoding_weights(RC.gNB[inst]);
- init_gNB_proc(inst);
+ init_gNB_Tpool(inst);
}
- for (ru_id=0; ru_idnr_wakeup_rxtx = wakeup_rxtx;
- // RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_gNB;
- RC.ru[ru_id]->gNB_top = gNB_top;
- }
}
void init_gNB(int single_thread_flag,int wait_for_sync) {
@@ -1072,18 +524,16 @@ void init_gNB(int single_thread_flag,int wait_for_sync) {
PHY_VARS_gNB *gNB;
if (RC.gNB == NULL) {
- RC.gNB = (PHY_VARS_gNB **) malloc((1+RC.nb_nr_L1_inst)*sizeof(PHY_VARS_gNB *));
- for (inst=0; instabstraction_flag = 0;
gNB->single_thread_flag = single_thread_flag;
@@ -1113,7 +563,7 @@ void init_gNB(int single_thread_flag,int wait_for_sync) {
}
- LOG_I(PHY,"[nr-softmodem.c] gNB structure allocated\n");
+ LOG_I(PHY,"[nr-gnb.c] gNB structure allocated\n");
}
diff --git a/executables/nr-ru.c b/executables/nr-ru.c
index c083032ee4..c4f9f9510c 100644
--- a/executables/nr-ru.c
+++ b/executables/nr-ru.c
@@ -24,14 +24,8 @@
#include
#include
#include
-#include
-#include
-#include
#include
#include
-#include
-#include
-#include
#include
#include
@@ -39,7 +33,6 @@
#include "common/utils/assertions.h"
#include "common/utils/system.h"
-#include "msc.h"
#include "../../ARCH/COMMON/common_lib.h"
#include "../../ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
@@ -50,20 +43,15 @@
#include "PHY/types.h"
#include "PHY/defs_nr_common.h"
#include "PHY/phy_extern.h"
-#include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/INIT/phy_init.h"
-#include "SCHED/sched_eNB.h"
#include "SCHED_NR/sched_nr.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
-#include "RRC/LTE/rrc_extern.h"
-#include "PHY_INTERFACE/phy_interface.h"
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
-#include "enb_config.h"
#include
#ifdef SMBV
@@ -89,7 +77,7 @@ static int DEFBFW[] = {0x00007fff};
#include "s1ap_eNB.h"
#include "SIMULATION/ETH_TRANSPORT/proto.h"
-
+#include
#include "T.h"
@@ -113,6 +101,7 @@ void configure_ru(int idx, void *arg);
void configure_rru(int idx, void *arg);
int attach_rru(RU_t *ru);
int connect_rau(RU_t *ru);
+static void NRRCconfig_RU(void);
uint16_t sf_ahead;
uint16_t slot_ahead;
@@ -120,7 +109,6 @@ uint16_t sl_ahead;
extern int emulate_rf;
extern int numerology;
-extern int usrp_tx_thread;
/*************************************************************/
/* Functions to attach and configure RRU */
@@ -756,17 +744,25 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
if (fp->freq_range==nr_FR2) {
// the beam index is written in bits 8-10 of the flags
// bit 11 enables the gpio programming
+ // currently we switch beams every 10 slots (should = 1 TDD period in FR2) and we take the beam index of the first symbol of the first slot of this period
int beam=0;
- //if (slot==0) beam = 11; //3 for boresight & 8 to enable
+ if (slot%10==0) {
+ if ( ru->common.beam_id && (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8)) {
+ beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8;
+ }
+ }
/*
- if (slot==0 || slot==40) beam=0&8;
- if (slot==10 || slot==50) beam=1&8;
- if (slot==20 || slot==60) beam=2&8;
- if (slot==30 || slot==70) beam=3&8;
+ if (slot==0 || slot==40) beam=0|8;
+ if (slot==10 || slot==50) beam=1|8;
+ if (slot==20 || slot==60) beam=2|8;
+ if (slot==30 || slot==70) beam=3|8;
*/
flags |= beam<<8;
- }
+ LOG_D(HW,"slot %d, beam %d\n",slot,ru->common.beam_id[0][slot*fp->symbols_per_slot]);
+
+ }
+
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS, flags );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, slot );
@@ -789,259 +785,6 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
}
}
-
-
-/*!
- * \brief The Asynchronous RX/TX FH thread of RAU/RCC/gNB/RRU.
- * This handles the RX FH for an asynchronous RRU/UE
- * \param param is a \ref gNB_L1_proc_t structure which contains the info what to process.
- * \returns a pointer to an int. The storage is not on the heap and must not be freed.
- */
-void *ru_thread_asynch_rxtx( void *param ) {
- static int ru_thread_asynch_rxtx_status;
- RU_t *ru = (RU_t *)param;
- RU_proc_t *proc = &ru->proc;
- nfapi_nr_config_request_scf_t *cfg = &ru->config;
- int slot=0, frame=0;
- // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
- wait_sync("ru_thread_asynch_rxtx");
- // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
- printf( "waiting for devices (ru_thread_asynch_rx)\n");
- wait_on_condition(&proc->mutex_asynch_rxtx,&proc->cond_asynch_rxtx,&proc->instance_cnt_asynch_rxtx,"thread_asynch");
- printf( "devices ok (ru_thread_asynch_rx)\n");
-
- while (!oai_exit) {
-
- if (slot==ru->nr_frame_parms->slots_per_frame) {
- slot=0;
- frame++;
- frame&=1023;
- } else {
- slot++;
- }
-
- LOG_D(PHY,"ru_thread_asynch_rxtx: Waiting on incoming fronthaul\n");
-
- // asynchronous receive from north (RRU IF4/IF5)
- if (ru->fh_north_asynch_in) {
- if ((nr_slot_select(cfg,frame,slot) & NR_DOWNLINK_SLOT)>0)
- ru->fh_north_asynch_in(ru,&frame,&slot);
- } else AssertFatal(1==0,"Unknown function in ru_thread_asynch_rxtx\n");
- }
-
- ru_thread_asynch_rxtx_status=0;
- return(&ru_thread_asynch_rxtx_status);
-}
-
-
-
-
-/*!
- * \brief The prach receive thread of RU.
- * \param param is a \ref RU_proc_t structure which contains the info what to process.
- * \returns a pointer to an int. The storage is not on the heap and must not be freed.
- */
-void *ru_thread_prach( void *param ) {
- static int ru_thread_prach_status;
- RU_t *ru = (RU_t *)param;
- RU_proc_t *proc = (RU_proc_t *)&ru->proc;
- // set default return value
- ru_thread_prach_status = 0;
-
- while (RC.ru_mask>0) {
- usleep(1e6);
- LOG_I(PHY,"%s() RACH waiting for RU to be configured\n", __FUNCTION__);
- }
-
- LOG_I(PHY,"%s() RU configured - RACH processing thread running\n", __FUNCTION__);
-
- while (!oai_exit) {
-
-
- if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
-
- /*VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );
-
- if (ru->gNB_list[0]){
- prach_procedures(
- ru->gNB_list[0],0
- );
- }
- else {
- rx_prach(NULL,
- ru,
- NULL,
- NULL,
- NULL,
- proc->frame_prach,
- 0,0
- );
- }
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 );*/
- if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
- }
-
- LOG_I(PHY, "Exiting RU thread PRACH\n");
- ru_thread_prach_status = 0;
- return &ru_thread_prach_status;
-}
-
-
-int wakeup_synch(RU_t *ru) {
- struct timespec wait;
- wait.tv_sec=0;
- wait.tv_nsec=5000000L;
-
- // wake up synch thread
- // lock the synch mutex and make sure the thread is ready
- if (pthread_mutex_timedlock(&ru->proc.mutex_synch,&wait) != 0) {
- LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for RU synch thread (IC %d)\n", ru->proc.instance_cnt_synch );
- exit_fun( "error locking mutex_synch" );
- return(-1);
- }
-
- ++ru->proc.instance_cnt_synch;
-
- // the thread can now be woken up
- if (pthread_cond_signal(&ru->proc.cond_synch) != 0) {
- LOG_E( PHY, "[RU] ERROR pthread_cond_signal for RU synch thread\n");
- exit_fun( "ERROR pthread_cond_signal" );
- return(-1);
- }
-
- pthread_mutex_unlock( &ru->proc.mutex_synch );
- return(0);
-}
-
-void do_ru_synch(RU_t *ru) {
- NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
- RU_proc_t *proc = &ru->proc;
- int i;
- void *rxp[2],*rxp2[2];
- int32_t dummy_rx[ru->nb_rx][fp->samples_per_subframe] __attribute__((aligned(32)));
- int rxs;
- int ic;
-
- // initialize the synchronization buffer to the common_vars.rxdata
- for (int i=0; inb_rx; i++)
- rxp[i] = &ru->common.rxdata[i][0];
-
- double temp_freq1 = ru->rfdevice.openair0_cfg->rx_freq[0];
- double temp_freq2 = ru->rfdevice.openair0_cfg->tx_freq[0];
-
- for (i=0; i<4; i++) {
- ru->rfdevice.openair0_cfg->rx_freq[i] = ru->rfdevice.openair0_cfg->tx_freq[i];
- ru->rfdevice.openair0_cfg->tx_freq[i] = temp_freq1;
- }
-
- ru->rfdevice.trx_set_freq_func(&ru->rfdevice,ru->rfdevice.openair0_cfg,0);
-
- while ((ru->in_synch ==0)&&(!oai_exit)) {
- // read in frame
- rxs = ru->rfdevice.trx_read_func(&ru->rfdevice,
- &(proc->timestamp_rx),
- rxp,
- fp->samples_per_subframe*10,
- ru->nb_rx);
-
- if (rxs != fp->samples_per_subframe*10) LOG_E(PHY,"requested %d samples, got %d\n",fp->samples_per_subframe*10,rxs);
-
- // wakeup synchronization processing thread
- wakeup_synch(ru);
- ic=0;
-
- while ((ic>=0)&&(!oai_exit)) {
- // continuously read in frames, 1ms at a time,
- // until we are done with the synchronization procedure
- for (i=0; inb_rx; i++)
- rxp2[i] = (void *)&dummy_rx[i][0];
-
- for (i=0; i<10; i++)
- rxs = ru->rfdevice.trx_read_func(&ru->rfdevice,
- &(proc->timestamp_rx),
- rxp2,
- fp->samples_per_subframe,
- ru->nb_rx);
-
- pthread_mutex_lock(&ru->proc.mutex_synch);
- ic = ru->proc.instance_cnt_synch;
- pthread_mutex_unlock(&ru->proc.mutex_synch);
- } // ic>=0
- } // in_synch==0
-
- // read in rx_offset samples
- LOG_I(PHY,"Resynchronizing by %d samples\n",ru->rx_offset);
- rxs = ru->rfdevice.trx_read_func(&ru->rfdevice,
- &(proc->timestamp_rx),
- rxp,
- ru->rx_offset,
- ru->nb_rx);
-
- for (i=0; i<4; i++) {
- ru->rfdevice.openair0_cfg->rx_freq[i] = temp_freq1;
- ru->rfdevice.openair0_cfg->tx_freq[i] = temp_freq2;
- }
-
- ru->rfdevice.trx_set_freq_func(&ru->rfdevice,ru->rfdevice.openair0_cfg,0);
-}
-
-
-
-void wakeup_gNB_L1s(RU_t *ru) {
- int i;
- PHY_VARS_gNB **gNB_list = ru->gNB_list;
- LOG_D(PHY,"wakeup_gNB_L1s (num %d) for RU %d ru->gNB_top:%p\n",ru->num_gNB,ru->idx, ru->gNB_top);
-
- if (ru->num_gNB==1 && ru->gNB_top!=0 && get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) {
- // call gNB function directly
- char string[20];
- sprintf(string,"Incoming RU %u",ru->idx);
- LOG_D(PHY,"RU %d Call gNB_top\n",ru->idx);
- ru->gNB_top(gNB_list[0],ru->proc.frame_rx,ru->proc.tti_rx,string,ru);
- } else {
- LOG_D(PHY,"ru->num_gNB:%d\n", ru->num_gNB);
-
- for (i=0; inum_gNB; i++) {
- LOG_D(PHY,"ru->wakeup_rxtx:%p\n", ru->nr_wakeup_rxtx);
-
- if (ru->nr_wakeup_rxtx!=0 && ru->nr_wakeup_rxtx(gNB_list[i],ru) < 0) {
- LOG_E(PHY,"could not wakeup gNB rxtx process for subframe %d\n", ru->proc.tti_rx);
- }
- }
- }
-}
-
-int wakeup_prach_ru(RU_t *ru) {
- struct timespec wait;
- wait.tv_sec=0;
- wait.tv_nsec=5000000L;
-
- if (pthread_mutex_timedlock(&ru->proc.mutex_prach,&wait) !=0) {
- LOG_E( PHY, "[RU] ERROR pthread_mutex_lock for RU prach thread (IC %d)\n", ru->proc.instance_cnt_prach);
- exit_fun( "error locking mutex_rxtx" );
- return(-1);
- }
-
- if (ru->proc.instance_cnt_prach==-1) {
- ++ru->proc.instance_cnt_prach;
- ru->proc.frame_prach = ru->proc.frame_rx;
- ru->proc.subframe_prach = ru->proc.tti_rx;
-
- // DJP - think prach_procedures() is looking at gNB frame_prach
- if (ru->gNB_list[0]) {
- ru->gNB_list[0]->proc.frame_prach = ru->proc.frame_rx;
- ru->gNB_list[0]->proc.slot_prach = ru->proc.tti_rx;
- }
-
- LOG_I(PHY,"RU %d: waking up PRACH thread\n",ru->idx);
- // the thread can now be woken up
- AssertFatal(pthread_cond_signal(&ru->proc.cond_prach) == 0, "ERROR pthread_cond_signal for RU prach thread\n");
- } else LOG_W(PHY,"RU prach thread busy, skipping\n");
-
- pthread_mutex_unlock( &ru->proc.mutex_prach );
- return(0);
-}
-
// this is for RU with local RF unit
void fill_rf_config(RU_t *ru, char *rf_config_file) {
int i;
@@ -1051,58 +794,21 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
int mu = config->ssb_config.scs_common.value;
int N_RB = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value;
- if (mu == NR_MU_0) { //or if LTE
- if(N_RB == 100) {
- if (fp->threequarter_fs) {
- cfg->sample_rate=23.04e6;
- cfg->samples_per_frame = 230400;
- cfg->tx_bw = 10e6;
- cfg->rx_bw = 10e6;
- } else {
- cfg->sample_rate=30.72e6;
- cfg->samples_per_frame = 307200;
- cfg->tx_bw = 10e6;
- cfg->rx_bw = 10e6;
- }
- } else if(N_RB == 50) {
- cfg->sample_rate=15.36e6;
- cfg->samples_per_frame = 153600;
- cfg->tx_bw = 5e6;
- cfg->rx_bw = 5e6;
- } else if (N_RB == 25) {
- cfg->sample_rate=7.68e6;
- cfg->samples_per_frame = 76800;
- cfg->tx_bw = 2.5e6;
- cfg->rx_bw = 2.5e6;
- } else if (N_RB == 6) {
- cfg->sample_rate=1.92e6;
- cfg->samples_per_frame = 19200;
- cfg->tx_bw = 1.5e6;
- cfg->rx_bw = 1.5e6;
- } else AssertFatal(1==0,"Unknown N_RB %d\n",N_RB);
- } else if (mu == NR_MU_1) {
- if(N_RB == 273) {
- if (fp->threequarter_fs) {
- AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n");
- } else {
- cfg->sample_rate=122.88e6;
- cfg->samples_per_frame = 1228800;
- cfg->tx_bw = 100e6;
- cfg->rx_bw = 100e6;
- }
- } else if(N_RB == 217) {
+ if (mu == NR_MU_0) {
+ switch(N_RB) {
+ case 270:
if (fp->threequarter_fs) {
cfg->sample_rate=92.16e6;
cfg->samples_per_frame = 921600;
- cfg->tx_bw = 80e6;
- cfg->rx_bw = 80e6;
+ cfg->tx_bw = 50e6;
+ cfg->rx_bw = 50e6;
} else {
- cfg->sample_rate=122.88e6;
- cfg->samples_per_frame = 1228800;
- cfg->tx_bw = 80e6;
- cfg->rx_bw = 80e6;
+ cfg->sample_rate=61.44e6;
+ cfg->samples_per_frame = 614400;
+ cfg->tx_bw = 50e6;
+ cfg->rx_bw = 50e6;
}
- } else if(N_RB == 106) {
+ case 216:
if (fp->threequarter_fs) {
cfg->sample_rate=46.08e6;
cfg->samples_per_frame = 460800;
@@ -1115,20 +821,166 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
cfg->tx_bw = 40e6;
cfg->rx_bw = 40e6;
}
- } else {
+ break;
+ case 106:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=23.04e6;
+ cfg->samples_per_frame = 230400;
+ cfg->tx_bw = 20e6;
+ cfg->rx_bw = 20e6;
+ }
+ else {
+ cfg->sample_rate=30.72e6;
+ cfg->samples_per_frame = 307200;
+ cfg->tx_bw = 20e6;
+ cfg->rx_bw = 20e6;
+ }
+ break;
+ case 52:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=11.52e6;
+ cfg->samples_per_frame = 115200;
+ cfg->tx_bw = 10e6;
+ cfg->rx_bw = 10e6;
+ }
+ else {
+ cfg->sample_rate=15.36e6;
+ cfg->samples_per_frame = 153600;
+ cfg->tx_bw = 10e6;
+ cfg->rx_bw = 10e6;
+ }
+ case 25:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=5.76e6;
+ cfg->samples_per_frame = 57600;
+ cfg->tx_bw = 5e6;
+ cfg->rx_bw = 5e6;
+ }
+ else {
+ cfg->sample_rate=7.68e6;
+ cfg->samples_per_frame = 76800;
+ cfg->tx_bw = 5e6;
+ cfg->rx_bw = 5e6;
+ }
+ break;
+ default:
+ AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu);
+ }
+ } else if (mu == NR_MU_1) {
+ switch(N_RB) {
+ case 273:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=184.32e6;
+ cfg->samples_per_frame = 1843200;
+ cfg->tx_bw = 100e6;
+ cfg->rx_bw = 100e6;
+ } else {
+ cfg->sample_rate=122.88e6;
+ cfg->samples_per_frame = 1228800;
+ cfg->tx_bw = 100e6;
+ cfg->rx_bw = 100e6;
+ }
+ break;
+ case 217:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=92.16e6;
+ cfg->samples_per_frame = 921600;
+ cfg->tx_bw = 80e6;
+ cfg->rx_bw = 80e6;
+ } else {
+ cfg->sample_rate=122.88e6;
+ cfg->samples_per_frame = 1228800;
+ cfg->tx_bw = 80e6;
+ cfg->rx_bw = 80e6;
+ }
+ break;
+ case 133 :
+ if (fp->threequarter_fs) {
+ AssertFatal(1==0,"N_RB %d cannot use 3/4 sampling\n",N_RB);
+ }
+ else {
+ cfg->sample_rate=61.44e6;
+ cfg->samples_per_frame = 614400;
+ cfg->tx_bw = 50e6;
+ cfg->rx_bw = 50e6;
+ }
+
+ break;
+ case 106:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=46.08e6;
+ cfg->samples_per_frame = 460800;
+ cfg->tx_bw = 40e6;
+ cfg->rx_bw = 40e6;
+ }
+ else {
+ cfg->sample_rate=61.44e6;
+ cfg->samples_per_frame = 614400;
+ cfg->tx_bw = 40e6;
+ cfg->rx_bw = 40e6;
+ }
+ break;
+ case 51:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=23.04e6;
+ cfg->samples_per_frame = 230400;
+ cfg->tx_bw = 20e6;
+ cfg->rx_bw = 20e6;
+ }
+ else {
+ cfg->sample_rate=30.72e6;
+ cfg->samples_per_frame = 307200;
+ cfg->tx_bw = 20e6;
+ cfg->rx_bw = 20e6;
+ }
+ break;
+ case 24:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=11.52e6;
+ cfg->samples_per_frame = 115200;
+ cfg->tx_bw = 10e6;
+ cfg->rx_bw = 10e6;
+ }
+ else {
+ cfg->sample_rate=15.36e6;
+ cfg->samples_per_frame = 153600;
+ cfg->tx_bw = 10e6;
+ cfg->rx_bw = 10e6;
+ }
+ break;
+ default:
AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu);
}
} else if (mu == NR_MU_3) {
- if (N_RB == 66) {
- cfg->sample_rate = 122.88e6;
- cfg->samples_per_frame = 1228800;
- cfg->tx_bw = 100e6;
- cfg->rx_bw = 100e6;
- } else if(N_RB == 32) {
- cfg->sample_rate=61.44e6;
- cfg->samples_per_frame = 614400;
- cfg->tx_bw = 50e6;
- cfg->rx_bw = 50e6;
+ switch(N_RB) {
+ case 66:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=184.32e6;
+ cfg->samples_per_frame = 1843200;
+ cfg->tx_bw = 100e6;
+ cfg->rx_bw = 100e6;
+ } else {
+ cfg->sample_rate = 122.88e6;
+ cfg->samples_per_frame = 1228800;
+ cfg->tx_bw = 100e6;
+ cfg->rx_bw = 100e6;
+ }
+ break;
+ case 32:
+ if (fp->threequarter_fs) {
+ cfg->sample_rate=92.16e6;
+ cfg->samples_per_frame = 921600;
+ cfg->tx_bw = 50e6;
+ cfg->rx_bw = 50e6;
+ } else {
+ cfg->sample_rate=61.44e6;
+ cfg->samples_per_frame = 614400;
+ cfg->tx_bw = 50e6;
+ cfg->rx_bw = 50e6;
+ }
+ break;
+ default:
+ AssertFatal(0==1,"N_RB %d not yet supported for numerology %d\n",N_RB,mu);
}
} else {
AssertFatal(0 == 1,"Numerology %d not supported for the moment\n",mu);
@@ -1175,60 +1027,52 @@ int setup_RU_buffers(RU_t *ru) {
int i,j;
int card,ant;
//uint16_t N_TA_offset = 0;
- NR_DL_FRAME_PARMS *frame_parms;
+ NR_DL_FRAME_PARMS *fp;
nfapi_nr_config_request_scf_t *config = &ru->config;
if (ru) {
- frame_parms = ru->nr_frame_parms;
- printf("setup_RU_buffers: frame_parms = %p\n",frame_parms);
+ fp = ru->nr_frame_parms;
+ printf("setup_RU_buffers: frame_parms = %p\n",fp);
} else {
printf("ru pointer is NULL\n");
return(-1);
}
+
int mu = config->ssb_config.scs_common.value;
int N_RB = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value;
-
if (config->cell_config.frame_duplex_type.value == TDD) {
int N_TA_offset = config->carrier_config.uplink_frequency.value < 6000000 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2
double factor=1;
-
switch (mu) {
- case 0: //15 kHz scs
- AssertFatal(N_TA_offset == 400,"scs_common 15kHz only for FR1\n");
- if (N_RB <= 25) factor = .25; // 7.68 Ms/s
- else if (N_RB <=50) factor = .5; // 15.36 Ms/s
- else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s
- else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s
- else AssertFatal(1==0,"Too many PRBS for mu=0\n");
- break;
- case 1: //30 kHz sc
- AssertFatal(N_TA_offset == 400,"scs_common 30kHz only for FR1\n");
- if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s
- else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s
- break;
- case 2: //60 kHz scs
- AssertFatal(1==0,"scs_common should not be 60 kHz\n");
- break;
- case 3: //120 kHz scs
- AssertFatal(N_TA_offset == 431,"scs_common 120kHz only for FR2\n");
- break;
- case 4: //240 kHz scs
- AssertFatal(1==0,"scs_common should not be 60 kHz\n");
- if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s
- else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s
- else AssertFatal(1==0,"N_RB %d is too big for curretn FR2 implementation\n",N_RB);
- break;
-
- if (N_RB == 100) ru->N_TA_offset = 624;
- else if (N_RB == 50) ru->N_TA_offset = 624/2;
- else if (N_RB == 25) ru->N_TA_offset = 624/4;
+ case 0: //15 kHz scs
+ AssertFatal(N_TA_offset == 400, "scs_common 15kHz only for FR1\n");
+ factor = fp->samples_per_subframe / 30720.0;
+ break;
+ case 1: //30 kHz sc
+ AssertFatal(N_TA_offset == 400, "scs_common 30kHz only for FR1\n");
+ factor = fp->samples_per_subframe / 30720.0;
+ break;
+ case 2: //60 kHz scs
+ AssertFatal(1==0, "scs_common should not be 60 kHz\n");
+ break;
+ case 3: //120 kHz scs
+ AssertFatal(N_TA_offset == 431, "scs_common 120kHz only for FR2\n");
+ factor = fp->samples_per_subframe / 61440.0;
+ break;
+ case 4: //240 kHz scs
+ AssertFatal(N_TA_offset == 431, "scs_common 240kHz only for FR2\n");
+ factor = fp->samples_per_subframe / 61440.0;
+ break;
+ default:
+ AssertFatal(1==0, "Invalid scs_common!\n");
}
- if (frame_parms->threequarter_fs == 1) factor = factor*.75;
+
ru->N_TA_offset = (int)(N_TA_offset * factor);
- LOG_I(PHY,"RU %d Setting N_TA_offset to %d samples (factor %f, UL Freq %d, N_RB %d)\n",ru->idx,ru->N_TA_offset,factor,
- config->carrier_config.uplink_frequency.value, N_RB);
+
+ LOG_I(PHY,"RU %d Setting N_TA_offset to %d samples (factor %f, UL Freq %d, N_RB %d, mu %d)\n",ru->idx,ru->N_TA_offset,factor,
+ config->carrier_config.uplink_frequency.value, N_RB, mu);
}
else ru->N_TA_offset = 0;
@@ -1300,136 +1144,61 @@ void *ru_stats_thread(void *param) {
return(NULL);
}
-void *ru_thread_tx( void *param ) {
- RU_t *ru = (RU_t *)param;
- RU_proc_t *proc = &ru->proc;
- NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
- PHY_VARS_gNB *gNB;
- gNB_L1_proc_t *gNB_proc;
- gNB_L1_rxtx_proc_t *L1_proc;
- char filename[40];
- int print_frame = 8;
- int i = 0;
- int ret;
-
+void ru_tx_func(void *param) {
- wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
- printf( "ru_thread_tx ready\n");
+ processingData_RU_t *info = (processingData_RU_t *) param;
+ RU_t *ru = info->ru;
+ NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
+ int frame_tx = info->frame_tx;
+ int slot_tx = info->slot_tx;
+ int print_frame = 8;
+ char filename[40];
- while (!oai_exit) {
+ // do TX front-end processing if needed (precoding and/or IDFTs)
+ if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,slot_tx);
- LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n");
- // wait until eNBs are finished subframe RX n and TX n+4
+ // do OFDM with/without TX front-end processing if needed
+ if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,slot_tx);
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RU_TX_WAIT, 1 );
- wait_on_condition(&proc->mutex_gNBs,&proc->cond_gNBs,&proc->instance_cnt_gNBs,"ru_thread_tx");
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RU_TX_WAIT, 0 );
+ if(!emulate_rf) {
+ // do outgoing fronthaul (south) if needed
+ if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,slot_tx,info->timestamp_tx);
- ret = pthread_mutex_lock(&proc->mutex_gNBs);
- AssertFatal(ret == 0,"mutex_lock return %d\n",ret);
- int frame_tx=proc->frame_tx;
- int tti_tx =proc->tti_tx;
- uint64_t timestamp_tx = proc->timestamp_tx;
+ if (ru->fh_north_out) ru->fh_north_out(ru);
+ } else {
+ if(frame_tx == print_frame) {
+ for (int i=0; inb_tx; i++) {
- ret = pthread_mutex_unlock(&proc->mutex_gNBs);
- AssertFatal(ret == 0,"mutex_lock returns %d\n",ret);
+ if(slot_tx == 0) {
+ sprintf(filename,"gNBdataF_frame%d_sl%d.m", print_frame, slot_tx);
+ LOG_M(filename,"txdataF_frame",&ru->gNB_list[0]->common_vars.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1);
- if (oai_exit) break;
+ sprintf(filename,"tx%ddataF_frame%d_sl%d.m", i, print_frame, slot_tx);
+ LOG_M(filename,"txdataF_frame",&ru->common.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1);
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame_tx );
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, tti_tx );
-
- // do TX front-end processing if needed (precoding and/or IDFTs)
- if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx);
-
- // do OFDM with/without TX front-end processing if needed
- if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,tti_tx);
-
- if(!emulate_rf) {
- // do outgoing fronthaul (south) if needed
- if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,tti_tx,timestamp_tx);
-
- if (ru->fh_north_out) ru->fh_north_out(ru);
- } else {
- if(proc->frame_tx == print_frame) {
- for (i=0; inb_tx; i++) {
-
- if(proc->tti_tx == 0) {
- sprintf(filename,"gNBdataF_frame%d_sl%d.m", print_frame, proc->tti_tx);
- LOG_M(filename,"txdataF_frame",&ru->gNB_list[0]->common_vars.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1);
-
- sprintf(filename,"tx%ddataF_frame%d_sl%d.m", i, print_frame, proc->tti_tx);
- LOG_M(filename,"txdataF_frame",&ru->common.txdataF[i][0],fp->samples_per_frame_wCP, 1, 1);
-
- sprintf(filename,"tx%ddataF_BF_frame%d_sl%d.m", i, print_frame, proc->tti_tx);
- LOG_M(filename,"txdataF_BF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_subframe_wCP, 1, 1);
- }
-
- if(proc->tti_tx == 9) {
- sprintf(filename,"tx%ddata_frame%d.m", i, print_frame);
- LOG_M(filename,"txdata_frame",&ru->common.txdata[i][0],fp->samples_per_frame, 1, 1);
- sprintf(filename,"tx%ddata_frame%d.dat", i, print_frame);
- FILE *output_fd = fopen(filename,"w");
-
- if (output_fd) {
- fwrite(&ru->common.txdata[i][0],
- sizeof(int32_t),
- fp->samples_per_frame,
- output_fd);
- fclose(output_fd);
- } else {
- LOG_E(PHY,"Cannot write to file %s\n",filename);
- }
- }//if(proc->tti_tx == 9)
- }//for (i=0; inb_tx; i++)
- }//if(proc->frame_tx == print_frame)
- }//else emulate_rf
-
- release_thread(&proc->mutex_gNBs,&proc->instance_cnt_gNBs,"ru_thread_tx");
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_UE, proc->instance_cnt_gNBs);
-
- for(i = 0; inum_gNB; i++) {
- gNB = ru->gNB_list[i];
- gNB_proc = &gNB->proc;
- L1_proc = (get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)? &gNB_proc->L1_proc_tx : &gNB_proc->L1_proc;
- ret = pthread_mutex_lock(&gNB_proc->mutex_RU_tx);
- AssertFatal(ret == 0,"mutex_lock returns %d\n",ret);
-
- for (int j=0; jnum_RU; j++) {
- if (ru == gNB->RU_list[j]) {
- if ((gNB_proc->RU_mask_tx&(1< 0)
- LOG_E(PHY,"gNB %d frame %d, subframe %d : previous information from RU tx %d (num_RU %d,mask %x) has not been served yet!\n",
- gNB->Mod_id,gNB_proc->frame_rx,gNB_proc->slot_rx,ru->idx,gNB->num_RU,gNB_proc->RU_mask_tx);
-
- gNB_proc->RU_mask_tx |= (1<common.txdataF_BF[i][0],fp->samples_per_subframe_wCP, 1, 1);
}
- }
- if (gNB_proc->RU_mask_tx != (1<num_RU)-1) { // not all RUs have provided their information so return
- ret = pthread_mutex_unlock(&gNB_proc->mutex_RU_tx);
- AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret);
- } else { // all RUs TX are finished so send the ready signal to gNB processing
- gNB_proc->RU_mask_tx = 0;
- ret = pthread_mutex_unlock(&gNB_proc->mutex_RU_tx);
- AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret);
+ if(slot_tx == 9) {
+ sprintf(filename,"tx%ddata_frame%d.m", i, print_frame);
+ LOG_M(filename,"txdata_frame",&ru->common.txdata[i][0],fp->samples_per_frame, 1, 1);
+ sprintf(filename,"tx%ddata_frame%d.dat", i, print_frame);
+ FILE *output_fd = fopen(filename,"w");
- ret = pthread_mutex_lock(&L1_proc->mutex_RUs_tx);
- AssertFatal(ret == 0,"mutex_lock returns %d\n",ret);
- // the thread can now be woken up
- if (L1_proc->instance_cnt_RUs == -1) {
- L1_proc->instance_cnt_RUs = 0;
- VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE,L1_proc->instance_cnt_RUs);
- AssertFatal(pthread_cond_signal(&L1_proc->cond_RUs) == 0,
- "ERROR pthread_cond_signal for gNB_L1_thread\n");
- } //else AssertFatal(1==0,"gNB TX thread is not ready\n");
- ret = pthread_mutex_unlock(&L1_proc->mutex_RUs_tx);
- AssertFatal(ret == 0,"mutex_unlock returns %d\n",ret);
- }
- }
- }
-
- release_thread(&proc->mutex_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
- return 0;
+ if (output_fd) {
+ fwrite(&ru->common.txdata[i][0],
+ sizeof(int32_t),
+ fp->samples_per_frame,
+ output_fd);
+ fclose(output_fd);
+ } else {
+ LOG_E(PHY,"Cannot write to file %s\n",filename);
+ }
+ }//if(slot_tx == 9)
+ }//for (i=0; inb_tx; i++)
+ }//if(frame_tx == print_frame)
+ }//else emulate_rf
}
void *ru_thread( void *param ) {
@@ -1437,12 +1206,11 @@ void *ru_thread( void *param ) {
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
+ PHY_VARS_gNB *gNB = RC.gNB[0];
int ret;
int slot = fp->slots_per_frame-1;
int frame = 1023;
- char filename[40], threadname[40];
- int print_frame = 8;
- int i = 0;
+ char threadname[40];
int aa;
// set default return value
@@ -1500,6 +1268,15 @@ void *ru_thread( void *param ) {
pthread_mutex_unlock(&RC.ru_mutex);
wait_sync("ru_thread");
+ notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1,rx_func);
+ notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_L1_tx,tx_func);
+ notifiedFIFO_elt_t *msgRUTx = newNotifiedFIFO_elt(sizeof(processingData_L1_t),0,gNB->resp_RU_tx,ru_tx_func);
+ processingData_L1_t *syncMsg;
+ notifiedFIFO_elt_t *res;
+ pushNotifiedFIFO(gNB->resp_L1,msg); // to unblock the process in the beginning
+ pushNotifiedFIFO(gNB->resp_L1_tx,msgL1Tx); // to unblock the process in the beginning
+ pushNotifiedFIFO(gNB->resp_RU_tx,msgRUTx); // to unblock the process in the beginning
+
if(!emulate_rf) {
// Start RF device if any
if (ru->start_rf) {
@@ -1508,19 +1285,6 @@ void *ru_thread( void *param ) {
else LOG_I(PHY,"RU %d rf device ready\n",ru->idx);
} else LOG_I(PHY,"RU %d no rf device\n",ru->idx);
- // if an asnych_rxtx thread exists
- // wakeup the thread because the devices are ready at this point
-
- if ((ru->fh_south_asynch_in)||(ru->fh_north_asynch_in)) {
- pthread_mutex_lock(&proc->mutex_asynch_rxtx);
- proc->instance_cnt_asynch_rxtx=0;
- pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
- pthread_cond_signal(&proc->cond_asynch_rxtx);
- } else LOG_I(PHY,"RU %d no asynch_south interface\n",ru->idx);
-
- // if this is a slave RRU, try to synchronize on the DL frequency
- if ((ru->is_slave) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru);
-
// start trx write thread
if(usrp_tx_thread == 1){
if (ru->start_write_thread){
@@ -1534,11 +1298,6 @@ void *ru_thread( void *param ) {
}
}
- pthread_mutex_lock(&proc->mutex_FH1);
- proc->instance_cnt_FH1 = 0;
- pthread_mutex_unlock(&proc->mutex_FH1);
- pthread_cond_signal(&proc->cond_FH1);
-
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
struct timespec slot_start;
clock_gettime(CLOCK_MONOTONIC, &slot_start);
@@ -1582,24 +1341,17 @@ void *ru_thread( void *param ) {
if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&slot);
else AssertFatal(1==0, "No fronthaul interface at south port");
+ proc->timestamp_tx = proc->timestamp_rx + (sf_ahead*fp->samples_per_subframe);
+ proc->frame_tx = (proc->tti_rx > (fp->slots_per_frame-1-(fp->slots_per_subframe*sf_ahead))) ? (proc->frame_rx+1)&1023 : proc->frame_rx;
+ proc->tti_tx = (proc->tti_rx + (fp->slots_per_subframe*sf_ahead))%fp->slots_per_frame;
+
LOG_D(PHY,"AFTER fh_south_in - SFN/SL:%d%d RU->proc[RX:%d.%d TX:%d.%d] RC.gNB[0]:[RX:%d%d TX(SFN):%d]\n",
frame,slot,
proc->frame_rx,proc->tti_rx,
proc->frame_tx,proc->tti_tx,
RC.gNB[0]->proc.frame_rx,RC.gNB[0]->proc.slot_rx,
RC.gNB[0]->proc.frame_tx);
- /*
- LOG_D(PHY,"RU thread (do_prach %d, is_prach_subframe %d), received frame %d, subframe %d\n",
- ru->do_prach,
- is_prach_subframe(fp, proc->frame_rx, proc->tti_rx),
- proc->frame_rx,proc->tti_rx);
- if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->tti_rx)==1)) {
- wakeup_prach_ru(ru);
- }*/
-
- // adjust for timing offset between RU
- //printf("~~~~~~~~~~~~~~~~~~~~~~~~~~%d.%d in ru_thread is in process\n", proc->frame_rx, proc->tti_rx);
if (ru->idx!=0) proc->frame_tx = (proc->frame_tx+proc->frame_offset)&1023;
// do RX front-end processing (frequency-shift, dft) if needed
@@ -1612,7 +1364,6 @@ void *ru_thread( void *param ) {
if (slot == 8)
slot_type = NR_UPLINK_SLOT;
if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) {
- //if (proc->tti_rx==8) {
if (ru->feprx) {
ru->feprx(ru,proc->tti_rx);
@@ -1624,12 +1375,17 @@ void *ru_thread( void *param ) {
for (aa=0;aanb_rx;aa++)
memcpy((void*)RC.gNB[0]->common_vars.rxdataF[aa],
(void*)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t));
-
+ if (IS_SOFTMODEM_DOSCOPE && RC.gNB[0]->scopeData)
+ ((scopeData_t*)RC.gNB[0]->scopeData)->slotFunc(ru->common.rxdataF[0],proc->tti_rx, RC.gNB[0]->scopeData);
// Do PRACH RU processing
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
uint8_t prachStartSymbol,N_dur;
if (prach_id>=0) {
+
+ T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0),
+ T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2));
+
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
/*
get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value,
@@ -1662,50 +1418,17 @@ void *ru_thread( void *param ) {
}
// At this point, all information for subframe has been received on FH interface
+ res = pullTpool(gNB->resp_L1, gNB->threadPool);
+ syncMsg = (processingData_L1_t *)NotifiedFifoData(res);
+ syncMsg->gNB = gNB;
+ syncMsg->frame_rx = proc->frame_rx;
+ syncMsg->slot_rx = proc->tti_rx;
+ syncMsg->frame_tx = proc->frame_tx;
+ syncMsg->slot_tx = proc->tti_tx;
+ syncMsg->timestamp_tx = proc->timestamp_tx;
+ res->key = proc->tti_rx;
+ pushTpool(gNB->threadPool, res);
- // wakeup all gNB processes waiting for this RU
- if (ru->num_gNB>0) wakeup_gNB_L1s(ru);
-
- if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD || ru->num_gNB==0) {
- // do TX front-end processing if needed (precoding and/or IDFTs)
- if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx);
-
- // do OFDM with/without TX front-end processing if needed
- if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,proc->frame_tx,proc->tti_tx);
-
- if(!emulate_rf) {
- // do outgoing fronthaul (south) if needed
- if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,proc->frame_tx,proc->tti_tx,proc->timestamp_tx);
-
- if (ru->fh_north_out) ru->fh_north_out(ru);
- } else {
- if(proc->frame_tx == print_frame) {
- for (i=0; inb_tx; i++) {
- sprintf(filename,"tx%ddataF_frame%d_sl%d.m", i, print_frame, proc->tti_tx);
- LOG_M(filename,"txdataF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_slot_wCP, 1, 1);
-
- if(proc->tti_tx == 9) {
- sprintf(filename,"tx%ddata_frame%d.m", i, print_frame);
- LOG_M(filename,"txdata_frame",&ru->common.txdata[i][0],fp->samples_per_frame, 1, 1);
- sprintf(filename,"tx%ddata_frame%d.dat", i, print_frame);
- FILE *output_fd = fopen(filename,"w");
-
- if (output_fd) {
- fwrite(&ru->common.txdata[i][0],
- sizeof(int32_t),
- fp->samples_per_frame,
- output_fd);
- fclose(output_fd);
- } else {
- LOG_E(PHY,"Cannot write to file %s\n",filename);
- }
- }//if(proc->tti_tx == 9)
- }//for (i=0; inb_tx; i++)
- }//if(proc->frame_tx == print_frame)
- }//else emulate_rf
-
- proc->emulate_rf_busy = 0;
- }//if(get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD)
}
printf( "Exiting ru_thread \n");
@@ -1716,85 +1439,13 @@ void *ru_thread( void *param ) {
else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx);
}
+ delNotifiedFIFO_elt(msg);
+ delNotifiedFIFO_elt(msgL1Tx);
+ delNotifiedFIFO_elt(msgRUTx);
+
ru_thread_status = 0;
return &ru_thread_status;
}
-/*
-// This thread run the initial synchronization like a UE
-void *ru_thread_synch(void *arg) {
-
- RU_t *ru = (RU_t*)arg;
- NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
- int32_t sync_pos,sync_pos2;
- uint32_t peak_val;
- uint32_t sync_corr[307200] __attribute__((aligned(32)));
- static int ru_thread_synch_status;
-
-
-
- wait_sync("ru_thread_synch");
-
- // initialize variables for PSS detection
- lte_sync_time_init(ru->nr_frame_parms);
-
- while (!oai_exit) {
-
- // wait to be woken up
- if (wait_on_condition(&ru->proc.mutex_synch,&ru->proc.cond_synch,&ru->proc.instance_cnt_synch,"ru_thread_synch")<0) break;
-
- // if we're not in synch, then run initial synch
- if (ru->in_synch == 0) {
- // run intial synch like UE
- LOG_I(PHY,"Running initial synchronization\n");
-
- sync_pos = lte_sync_time_gNB(ru->common.rxdata,
- fp,
- fp->samples_per_subframe*5,
- &peak_val,
- sync_corr);
- LOG_I(PHY,"RU synch: %d, val %d\n",sync_pos,peak_val);
-
- if (sync_pos >= 0) {
- if (sync_pos >= fp->nb_prefix_samples)
- sync_pos2 = sync_pos - fp->nb_prefix_samples;
- else
- sync_pos2 = sync_pos + (fp->samples_per_subframe*10) - fp->nb_prefix_samples;
-
- if (fp->frame_type == FDD) {
-
- // PSS is hypothesized in last symbol of first slot in Frame
- int sync_pos_slot = (fp->samples_per_subframe>>1) - fp->ofdm_symbol_size - fp->nb_prefix_samples;
-
- if (sync_pos2 >= sync_pos_slot)
- ru->rx_offset = sync_pos2 - sync_pos_slot;
- else
- ru->rx_offset = (fp->samples_per_subframe*10) + sync_pos2 - sync_pos_slot;
- }
- else {
-
- }
-
- LOG_I(PHY,"Estimated sync_pos %d, peak_val %d => timing offset %d\n",sync_pos,peak_val,ru->rx_offset);
-
- if ((peak_val > 300000) && (sync_pos > 0)) {
- // if (sync_pos++ > 3) {
- write_output("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_subframe*5,1,2);
- write_output("ru_rx.m","rxs",(void*)ru->ru_time.rxdata[0][0],fp->samples_per_subframe*10,1,1);
- exit(-1);
- }
-
- ru->in_synch=1;
- }
- }
-
- if (release_thread(&ru->proc.mutex_synch,&ru->proc.instance_cnt_synch,"ru_synch_thread") < 0) break;
- } // oai_exit
-
- ru_thread_synch_status = 0;
- return &ru_thread_synch_status;
-
-}
-*/
int nr_start_if(struct RU_t_s *ru, struct PHY_VARS_gNB_s *gNB) {
return(ru->ifdevice.trx_start_func(&ru->ifdevice));
@@ -1816,17 +1467,10 @@ int start_write_thread(RU_t *ru) {
void init_RU_proc(RU_t *ru) {
int i=0;
RU_proc_t *proc;
- char name[100];
LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
proc = &ru->proc;
memset((void *)proc,0,sizeof(RU_proc_t));
proc->ru = ru;
- proc->instance_cnt_prach = -1;
- proc->instance_cnt_synch = -1;
- proc->instance_cnt_FH = -1;
- proc->instance_cnt_FH1 = -1;
- proc->instance_cnt_gNBs = -1;
- proc->instance_cnt_asynch_rxtx = -1;
proc->instance_cnt_emulateRF = -1;
proc->first_rx = 1;
proc->first_tx = 1;
@@ -1837,44 +1481,13 @@ void init_RU_proc(RU_t *ru) {
for (i=0; i<10; i++) proc->symbol_mask[i]=0;
- pthread_mutex_init( &proc->mutex_prach, NULL);
- pthread_mutex_init( &proc->mutex_asynch_rxtx, NULL);
- pthread_mutex_init( &proc->mutex_synch,NULL);
- pthread_mutex_init( &proc->mutex_FH,NULL);
- pthread_mutex_init( &proc->mutex_FH1,NULL);
pthread_mutex_init( &proc->mutex_emulateRF,NULL);
- pthread_mutex_init( &proc->mutex_gNBs, NULL);
- pthread_cond_init( &proc->cond_prach, NULL);
- pthread_cond_init( &proc->cond_FH, NULL);
- pthread_cond_init( &proc->cond_FH1, NULL);
pthread_cond_init( &proc->cond_emulateRF, NULL);
- pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
- pthread_cond_init( &proc->cond_synch,NULL);
- pthread_cond_init( &proc->cond_gNBs, NULL);
threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "thread_FH", -1, OAI_PRIORITY_RT_MAX );
- if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)
- threadCreate( &proc->pthread_FH1, ru_thread_tx, (void *)ru, "thread_FH1", -1, OAI_PRIORITY_RT );
-
if(emulate_rf)
threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT );
- if (ru->function == NGFI_RRU_IF4p5) {
- threadCreate( &proc->pthread_prach, ru_thread_prach, (void *)ru, "RACH", -1, OAI_PRIORITY_RT );
- ///tmp deactivation of synch thread
- // if (ru->is_slave == 1) pthread_create( &proc->pthread_synch, attr_synch, ru_thread_synch, (void*)ru);
-
- if ((ru->if_timing == synch_to_other) ||
- (ru->function == NGFI_RRU_IF5) ||
- (ru->function == NGFI_RRU_IF4p5)) threadCreate( &proc->pthread_asynch_rxtx, ru_thread_asynch_rxtx, (void *)ru, "asynch_rxtx", -1, OAI_PRIORITY_RT );
-
- snprintf( name, sizeof(name), "ru_thread_FH %d", ru->idx );
- pthread_setname_np( proc->pthread_FH, name );
- } else if (ru->function == gNodeB_3GPP && ru->if_south == LOCAL_RF) { // DJP - need something else to distinguish between monolithic and PNF
- LOG_I(PHY,"%s() DJP - added creation of pthread_prach\n", __FUNCTION__);
- threadCreate( &proc->pthread_prach, ru_thread_prach, (void *)ru,"RACH", -1, OAI_PRIORITY_RT );
- }
-
if (get_thread_worker_conf() == WORKER_ENABLE) {
if (ru->feprx) nr_init_feprx_thread(ru);
@@ -1887,46 +1500,9 @@ void init_RU_proc(RU_t *ru) {
void kill_NR_RU_proc(int inst) {
RU_t *ru = RC.ru[inst];
RU_proc_t *proc = &ru->proc;
- pthread_mutex_lock(&proc->mutex_FH);
- proc->instance_cnt_FH = 0;
- pthread_mutex_unlock(&proc->mutex_FH);
- pthread_cond_signal(&proc->cond_FH);
- pthread_mutex_lock(&proc->mutex_prach);
- proc->instance_cnt_prach = 0;
- pthread_mutex_unlock(&proc->mutex_prach);
- pthread_cond_signal(&proc->cond_prach);
- pthread_mutex_lock(&proc->mutex_synch);
- proc->instance_cnt_synch = 0;
- pthread_mutex_unlock(&proc->mutex_synch);
- pthread_cond_signal(&proc->cond_synch);
- pthread_mutex_lock(&proc->mutex_gNBs);
- proc->instance_cnt_gNBs = 0;
- pthread_mutex_unlock(&proc->mutex_gNBs);
- pthread_cond_signal(&proc->cond_gNBs);
- pthread_mutex_lock(&proc->mutex_asynch_rxtx);
- proc->instance_cnt_asynch_rxtx = 0;
- pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
- pthread_cond_signal(&proc->cond_asynch_rxtx);
LOG_D(PHY, "Joining pthread_FH\n");
pthread_join(proc->pthread_FH, NULL);
- if (ru->function == NGFI_RRU_IF4p5) {
- LOG_D(PHY, "Joining pthread_prach\n");
- pthread_join(proc->pthread_prach, NULL);
-
- if (ru->is_slave) {
- LOG_D(PHY, "Joining pthread_\n");
- pthread_join(proc->pthread_synch, NULL);
- }
-
- if ((ru->if_timing == synch_to_other) ||
- (ru->function == NGFI_RRU_IF5) ||
- (ru->function == NGFI_RRU_IF4p5)) {
- LOG_D(PHY, "Joining pthread_asynch_rxtx\n");
- pthread_join(proc->pthread_asynch_rxtx, NULL);
- }
- }
-
if (get_nprocs() >= 2) {
if (ru->feprx) {
pthread_mutex_lock(&proc->mutex_fep);
@@ -1955,17 +1531,6 @@ void kill_NR_RU_proc(int inst) {
LOG_D(PHY, "Joining ru_stats_thread\n");
pthread_join(ru->ru_stats_thread, NULL);
}
-
- pthread_mutex_destroy(&proc->mutex_prach);
- pthread_mutex_destroy(&proc->mutex_asynch_rxtx);
- pthread_mutex_destroy(&proc->mutex_synch);
- pthread_mutex_destroy(&proc->mutex_FH);
- pthread_mutex_destroy(&proc->mutex_gNBs);
- pthread_cond_destroy(&proc->cond_prach);
- pthread_cond_destroy(&proc->cond_FH);
- pthread_cond_destroy(&proc->cond_asynch_rxtx);
- pthread_cond_destroy(&proc->cond_synch);
- pthread_cond_destroy(&proc->cond_gNBs);
}
int check_capabilities(RU_t *ru,RRU_capabilities_t *cap)
@@ -2200,11 +1765,9 @@ void set_function_spec_param(RU_t *ru) {
ru->nr_start_if = NULL; // no if interface
ru->rfdevice.host_type = RAU_HOST;
- // FK this here looks messed up. The following lines should be part of the if (ru->function == gNodeB_3GPP), shouldn't they?
-
- ru->fh_south_in = rx_rf; // local synchronous RF RX
- ru->fh_south_out = tx_rf; // local synchronous RF TX
- ru->start_rf = start_rf; // need to start the local RF interface
+ ru->fh_south_in = rx_rf; // local synchronous RF RX
+ ru->fh_south_out = tx_rf; // local synchronous RF TX
+ ru->start_rf = start_rf; // need to start the local RF interface
ru->stop_rf = stop_rf;
ru->start_write_thread = start_write_thread; // starting RF TX in different thread
printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf);
@@ -2306,7 +1869,7 @@ void init_NR_RU(char *rf_config_file)
pthread_cond_init(&RC.ru_cond,NULL);
// read in configuration file)
printf("configuring RU from file\n");
- RCconfig_RU();
+ NRRCconfig_RU();
LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_nr_L1_inst,RC.nb_RU,get_nprocs());
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
@@ -2381,7 +1944,7 @@ void stop_RU(int nb_ru)
/* --------------------------------------------------------*/
/* from here function to use configuration module */
-void RCconfig_RU(void)
+static void NRRCconfig_RU(void)
{
int i = 0, j = 0;
paramdef_t RUParams[] = RUPARAMS_DESC;
@@ -2416,39 +1979,41 @@ void RCconfig_RU(void)
if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) {
if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) {
RC.ru[j]->openair0_cfg.clock_source = internal;
- LOG_D(PHY, "RU clock source set as internal\n");
+ LOG_I(PHY, "RU clock source set as internal\n");
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) {
RC.ru[j]->openair0_cfg.clock_source = external;
- LOG_D(PHY, "RU clock source set as external\n");
+ LOG_I(PHY, "RU clock source set as external\n");
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) {
RC.ru[j]->openair0_cfg.clock_source = gpsdo;
- LOG_D(PHY, "RU clock source set as gpsdo\n");
+ LOG_I(PHY, "RU clock source set as gpsdo\n");
} else {
LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
}
}
else {
- RC.ru[j]->openair0_cfg.clock_source = unset;
+ LOG_I(PHY,"Setting clock source to internal\n");
+ RC.ru[j]->openair0_cfg.clock_source = internal;
}
if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) {
if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) {
RC.ru[j]->openair0_cfg.time_source = internal;
- LOG_D(PHY, "RU time source set as internal\n");
+ LOG_I(PHY, "RU time source set as internal\n");
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) {
RC.ru[j]->openair0_cfg.time_source = external;
- LOG_D(PHY, "RU time source set as external\n");
+ LOG_I(PHY, "RU time source set as external\n");
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) {
RC.ru[j]->openair0_cfg.time_source = gpsdo;
- LOG_D(PHY, "RU time source set as gpsdo\n");
+ LOG_I(PHY, "RU time source set as gpsdo\n");
} else {
LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
}
}
else {
- RC.ru[j]->openair0_cfg.time_source = unset;
+ LOG_I(PHY,"Setting time source to internal\n");
+ RC.ru[j]->openair0_cfg.time_source = internal;
}
-
+
if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
RC.ru[j]->if_south = LOCAL_RF;
@@ -2518,7 +2083,7 @@ void RCconfig_RU(void)
RC.ru[j]->if_south = REMOTE_IF4p5;
RC.ru[j]->function = NGFI_RAU_IF4p5;
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
- }
+ }
} /* strcmp(local_rf, "yes") != 0 */
RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
@@ -2527,6 +2092,7 @@ void RCconfig_RU(void)
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr);
RC.ru[j]->if_frequency = *(RUParamList.paramarray[j][RU_IF_FREQUENCY].u64ptr);
RC.ru[j]->if_freq_offset = *(RUParamList.paramarray[j][RU_IF_FREQ_OFFSET].iptr);
+ RC.ru[j]->do_precoding = *(RUParamList.paramarray[j][RU_DO_PRECODING].iptr);
if (config_isparamset(RUParamList.paramarray[j], RU_BF_WEIGHTS_LIST_IDX)) {
RC.ru[j]->nb_bfw = RUParamList.paramarray[j][RU_BF_WEIGHTS_LIST_IDX].numelt;
diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h
index 500819e684..00f786dfdc 100644
--- a/executables/nr-softmodem-common.h
+++ b/executables/nr-softmodem-common.h
@@ -68,11 +68,16 @@
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
#define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
#define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n"
-#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n"
+#define CONFIG_HLP_DLMCS_PHYTEST "Set the downlink MCS for PHYTEST mode\n"
+#define CONFIG_HLP_DLNL_PHYTEST "Set the downlink nrOfLayers for PHYTEST mode\n"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
-#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
+#define CONFIG_HLP_ULMCS_PHYTEST "Set the uplink MCS for PHYTEST mode\n"
+#define CONFIG_HLP_DLBW_PHYTEST "Set the number of PRBs used for DLSCH in PHYTEST mode\n"
+#define CONFIG_HLP_ULBW_PHYTEST "Set the number of PRBs used for ULSCH in PHYTEST mode\n"
+#define CONFIG_HLP_DLBM_PHYTEST "Bitmap for DLSCH slots (slot 0 starts at LSB)\n"
+#define CONFIG_HLP_ULBM_PHYTEST "Bitmap for ULSCH slots (slot 0 starts at LSB)\n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index d88ca03ad2..4b84640cd2 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -85,6 +85,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "x2ap_eNB.h"
#include "ngap_gNB.h"
#include "gnb_paramdef.h"
+#include
#include "nfapi/oai_integration/vendor_ext.h"
pthread_cond_t nfapi_sync_cond;
@@ -92,7 +93,7 @@ pthread_mutex_t nfapi_sync_mutex;
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
extern uint8_t nfapi_mode; // Default to monolithic mode
-
+THREAD_STRUCT thread_struct;
pthread_cond_t sync_cond;
pthread_mutex_t sync_mutex;
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
@@ -114,7 +115,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
//Temp fix for inexistent NR upper layer
unsigned char NB_gNB_INST = 1;
-static char *itti_dump_file = NULL;
int UE_scan = 1;
int UE_scan_carrier = 0;
@@ -136,9 +136,6 @@ double rx_gain[MAX_NUM_CCs][4] = {{110,0,0,0},{20,0,0,0}};
double rx_gain_off = 0.0;
-double sample_rate=30.72e6;
-double bw = 10.0e6;
-
static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
@@ -163,15 +160,20 @@ int otg_enabled;
//static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
//static nfapi_nr_config_request_t *config[MAX_NUM_CCs];
-uint32_t target_dl_mcs = 28; //maximum allowed mcs
-uint32_t target_ul_mcs = 20;
uint32_t timing_advance = 0;
uint64_t num_missed_slots=0; // counter for the number of missed slots
+#include
+#include
+
int split73=0;
void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) {
AssertFatal(false, "Must not be called in this context\n");
}
+void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask, uint16_t rnti, int32_t stat) {
+ AssertFatal(false, "Must not be called in this context\n");
+}
+
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
@@ -182,7 +184,6 @@ extern void *udp_eNB_task(void *args_p);
int transmission_mode=1;
int emulate_rf = 0;
int numerology = 0;
-int usrp_tx_thread = 0;
static char *parallel_config = NULL;
@@ -344,7 +345,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
- if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0 && get_softmodem_params()->sa==0)) {
+ if (AMF_MODE_ENABLED) {
if (gnb_nb > 0) {
/*
if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
@@ -369,25 +370,31 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
}
- if (itti_create_task (TASK_GTPV1_U, >pv1u_gNB_task, NULL) < 0) {
+ /*if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
LOG_E(GTPU, "Create task for GTPV1U failed\n");
return -1;
- }
+ }*/
}
}
-
if (gnb_nb > 0) {
if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) {
LOG_E(GNB_APP, "Create task for gNB APP failed\n");
return -1;
}
- LOG_I(NR_RRC,"Creating NR RRC gNB Task\n");
+ LOG_I(NR_RRC,"Creating NR RRC gNB Task\n");
if (itti_create_task (TASK_RRC_GNB, rrc_gnb_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for NR RRC gNB failed\n");
return -1;
}
+ //Use check on x2ap to consider the NSA scenario and check on AMF_MODE_ENABLED for the SA scenario
+ if(is_x2ap_enabled() || AMF_MODE_ENABLED){
+ if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
+ LOG_E(GTPU, "Create task for GTPV1U failed\n");
+ return -1;
+ }
+ }
}
return 0;
@@ -626,33 +633,36 @@ static void wait_nfapi_init(char *thread_name) {
}
void init_pdcp(void) {
- //if (!NODE_IS_DU(RC.rrc[0]->node_type)) {
- pdcp_layer_init();
- uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
- (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
-
- if (IS_SOFTMODEM_NOS1) {
- printf("IS_SOFTMODEM_NOS1 option enabled \n");
- pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
- }
+ if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
+ // pdcp_layer_init();
+ uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
+ (PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
+ if (IS_SOFTMODEM_NOS1) {
+ printf("IS_SOFTMODEM_NOS1 option enabled \n");
+ pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT;
+ }
nr_pdcp_module_init(pdcp_initmask, 0);
- /*if (NODE_IS_CU(RC.rrc[0]->node_type)) {
- pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
- } else {*/
- pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
- pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
- //}
- /*} else {
+ if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
+ LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n");
+ pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
+ } else {
+ LOG_I(PDCP, "node is gNB \n");
+ pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
+ pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
+ }
+ } else {
+ LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n");
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind);
- }*/
+ }
}
int main( int argc, char **argv )
{
int ru_id, CC_id = 0;
+
start_background_system();
///static configuration for NR at the moment
@@ -680,8 +690,8 @@ int main( int argc, char **argv )
}
openair0_cfg[0].threequarter_fs = threequarter_fs;
- AMF_MODE_ENABLED = !IS_SOFTMODEM_NOS1; //!get_softmodem_params()->phy_test;
- NGAP_CONF_MODE = !IS_SOFTMODEM_NOS1; //!get_softmodem_params()->phy_test;
+ AMF_MODE_ENABLED = get_softmodem_params()->sa;
+ NGAP_CONF_MODE = get_softmodem_params()->sa;
if (get_softmodem_params()->do_ra)
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
@@ -812,36 +822,38 @@ if(IS_SOFTMODEM_NOS1)
wait_nfapi_init("main?");
}
- printf("wait RUs\n");
- wait_RUs();
- printf("ALL RUs READY!\n");
- printf("RC.nb_RU:%d\n", RC.nb_RU);
- // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
- printf("ALL RUs ready - init gNBs\n");
- if(IS_SOFTMODEM_DOFORMS) {
- sleep(1);
- scopeParms_t p;
- p.argc=&argc;
- p.argv=argv;
- p.gNB=RC.gNB[0];
- p.ru=RC.ru[0];
- load_softscope("nr",&p);
- }
+ if (RC.nb_nr_L1_inst > 0) {
+ printf("wait RUs\n");
+ wait_RUs();
+ printf("ALL RUs READY!\n");
+ printf("RC.nb_RU:%d\n", RC.nb_RU);
+ // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration)
+ printf("ALL RUs ready - init gNBs\n");
+ if(IS_SOFTMODEM_DOSCOPE) {
+ sleep(1);
+ scopeParms_t p;
+ p.argc=&argc;
+ p.argv=argv;
+ p.gNB=RC.gNB[0];
+ p.ru=RC.ru[0];
+ load_softscope("nr",&p);
+ }
- if (NFAPI_MODE != NFAPI_MODE_PNF && NFAPI_MODE != NFAPI_MODE_VNF) {
- printf("Not NFAPI mode - call init_eNB_afterRU()\n");
- init_eNB_afterRU();
- } else {
- printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n");
- }
+ if (NFAPI_MODE != NFAPI_MODE_PNF && NFAPI_MODE != NFAPI_MODE_VNF) {
+ printf("Not NFAPI mode - call init_eNB_afterRU()\n");
+ init_eNB_afterRU();
+ } else {
+ printf("NFAPI mode - DO NOT call init_gNB_afterRU()\n");
+ }
- printf("ALL RUs ready - ALL gNBs ready\n");
- // connect the TX/RX buffers
- printf("Sending sync to all threads\n");
- pthread_mutex_lock(&sync_mutex);
- sync_var=0;
- pthread_cond_broadcast(&sync_cond);
- pthread_mutex_unlock(&sync_mutex);
+ printf("ALL RUs ready - ALL gNBs ready\n");
+ // connect the TX/RX buffers
+ printf("Sending sync to all threads\n");
+ pthread_mutex_lock(&sync_mutex);
+ sync_var=0;
+ pthread_cond_broadcast(&sync_cond);
+ pthread_mutex_unlock(&sync_mutex);
+ }
printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
end_configmodule();
printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
@@ -879,7 +891,10 @@ if(IS_SOFTMODEM_NOS1)
printf("stopping MODEM threads\n");
// cleanup
stop_gNB(NB_gNB_INST);
- stop_RU(NB_RU);
+
+ if (RC.nb_nr_L1_inst > 0) {
+ stop_RU(NB_RU);
+ }
/* release memory used by the RU/gNB threads (incomplete), after all
* threads have been stopped (they partially use the same memory) */
diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h
index d6cfe6b906..896c363cbf 100644
--- a/executables/nr-softmodem.h
+++ b/executables/nr-softmodem.h
@@ -18,19 +18,29 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_PARAMS_DESC_GNB { \
- {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
- {"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
- {"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
- {"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
+ {"m" , CONFIG_HLP_DLMCS_PHYTEST,0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \
+ {"l" , CONFIG_HLP_DLNL_PHYTEST,0, uptr:&target_dl_Nl, defintval:0, TYPE_UINT, 0}, \
+ {"t" , CONFIG_HLP_ULMCS_PHYTEST,0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \
+ {"M" , CONFIG_HLP_DLBW_PHYTEST,0, uptr:&target_dl_bw, defintval:0, TYPE_UINT, 0}, \
+ {"T" , CONFIG_HLP_ULBW_PHYTEST,0, uptr:&target_ul_bw, defintval:0, TYPE_UINT, 0}, \
+ {"D" , CONFIG_HLP_DLBM_PHYTEST,0, u64ptr:&dlsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \
+ {"U" , CONFIG_HLP_ULBM_PHYTEST,0, u64ptr:&ulsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
}
#include "threads_t.h"
extern threads_t threads;
+extern uint32_t target_dl_mcs;
+extern uint32_t target_dl_Nl;
+extern uint32_t target_ul_mcs;
+extern uint32_t target_dl_bw;
+extern uint32_t target_ul_bw;
+extern uint64_t dlsch_slot_bitmap;
+extern uint64_t ulsch_slot_bitmap;
// In nr-gnb.c
extern void init_gNB(int single_thread_flag,int wait_for_sync);
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index eb032335fe..de7e9069cb 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -28,6 +28,8 @@
#include "SCHED_NR_UE/defs.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "LAYER2/nr_pdcp/nr_pdcp_entity.h"
+//#include "executables/softmodem-common.h"
+#include "SCHED_NR_UE/pucch_uci_ue_nr.h"
/*
* NR SLOT PROCESSING SEQUENCE
@@ -91,6 +93,8 @@
#else
#define DURATION_RX_TO_TX (6) /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */
#endif
+#define RX_JOB_ID 0x1010
+#define TX_JOB_ID 100
typedef enum {
pss = 0,
@@ -112,6 +116,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
ue->Mod_id = UE_id;
ue->mac_enabled = 1;
ue->if_inst = nr_ue_if_module_init(0);
+ ue->dci_thres = 0;
// Setting UE mode to NOT_SYNCHED by default
for (gNB_id = 0; gNB_id < nb_connected_gNB; gNB_id++){
@@ -287,11 +292,11 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
mac->dl_info.dci_ind = NULL;
mac->dl_info.rx_ind = NULL;
- if (is_nr_DL_slot(mac->scc, ul_info.slot_rx))
+ if (is_nr_DL_slot(mac->scc->tdd_UL_DL_ConfigurationCommon, ul_info.slot_rx))
{
nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment);
}
- if (is_nr_UL_slot(mac->scc, ul_info.slot_tx))
+ if (is_nr_UL_slot(mac->scc->tdd_UL_DL_ConfigurationCommon, ul_info.slot_tx, mac->frame_type))
{
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() from %s\n", ul_info.slot_tx, __FUNCTION__);
nr_ue_ul_indication(&ul_info);
@@ -367,10 +372,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
* \param arg is a pointer to a \ref PHY_VARS_NR_UE structure.
*/
-typedef struct syncData_s {
- UE_nr_rxtx_proc_t proc;
- PHY_VARS_NR_UE *UE;
-} syncData_t;
+typedef nr_rxtx_thread_data_t syncData_t;
static void UE_synch(void *arg) {
syncData_t *syncD=(syncData_t *) arg;
@@ -475,43 +477,6 @@ static void UE_synch(void *arg) {
openair0_cfg[UE->rf_map.card].rx_freq[0],
openair0_cfg[UE->rf_map.card].tx_freq[0]);
- // reconfigure for potentially different bandwidth
- switch(UE->frame_parms.N_RB_DL) {
- case 6:
- openair0_cfg[UE->rf_map.card].sample_rate =1.92e6;
- openair0_cfg[UE->rf_map.card].rx_bw =.96e6;
- openair0_cfg[UE->rf_map.card].tx_bw =.96e6;
- // openair0_cfg[0].rx_gain[0] -= 12;
- break;
-
- case 25:
- openair0_cfg[UE->rf_map.card].sample_rate =7.68e6;
- openair0_cfg[UE->rf_map.card].rx_bw =2.5e6;
- openair0_cfg[UE->rf_map.card].tx_bw =2.5e6;
- // openair0_cfg[0].rx_gain[0] -= 6;
- break;
-
- case 50:
- openair0_cfg[UE->rf_map.card].sample_rate =15.36e6;
- openair0_cfg[UE->rf_map.card].rx_bw =5.0e6;
- openair0_cfg[UE->rf_map.card].tx_bw =5.0e6;
- // openair0_cfg[0].rx_gain[0] -= 3;
- break;
-
- case 100:
- openair0_cfg[UE->rf_map.card].sample_rate=30.72e6;
- openair0_cfg[UE->rf_map.card].rx_bw=10.0e6;
- openair0_cfg[UE->rf_map.card].tx_bw=10.0e6;
- // openair0_cfg[0].rx_gain[0] -= 0;
- break;
-
- case 66:
- openair0_cfg[UE->rf_map.card].sample_rate=122.88e6;
- openair0_cfg[UE->rf_map.card].rx_bw=100.e6;
- openair0_cfg[UE->rf_map.card].tx_bw=100.e6;
- break;
- }
-
if (UE->mode != loop_through_memory) {
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
@@ -554,11 +519,16 @@ static void UE_synch(void *arg) {
}
}
-void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
+void processSlotTX(void *arg) {
+
+ nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
+ UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
+ PHY_VARS_NR_UE *UE = rxtxD->UE;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
+ LOG_D(PHY,"%d.%d => slot type %d\n",proc->frame_tx,proc->nr_slot_tx,tx_slot_type);
if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){
// trigger L2 to run ue_scheduler thru IF module
@@ -585,10 +555,14 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
}
}
-void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
+void processSlotRX(void *arg) {
+ nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg;
+ UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
+ PHY_VARS_NR_UE *UE = rxtxD->UE;
fapi_nr_config_request_t *cfg = &UE->nrUE_config;
int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_slot_rx);
+ int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){
@@ -604,44 +578,56 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL );
#else
uint64_t a=rdtsc();
- phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel);
+ phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel, &rxtxD->txFifo);
LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500);
#endif
- if(IS_SOFTMODEM_NOS1){
+ if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa){
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0);
pdcp_run(&ctxt);
+
+ /* send tick to RLC and PDCP every ms */
+ if (proc->nr_slot_rx % UE->frame_parms.slots_per_subframe == 0) {
+ void nr_rlc_tick(int frame, int subframe);
+ void nr_pdcp_tick(int frame, int subframe);
+ nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe);
+ nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe);
+ }
}
+
+ // Wait for PUSCH processing to finish
+ notifiedFIFO_elt_t *res;
+ res = pullTpool(&rxtxD->txFifo,&(get_nrUE_params()->Tpool));
+ delNotifiedFIFO_elt(res);
+
+ } else {
+ processSlotTX(rxtxD);
}
-}
+ if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){
+ if (UE->UE_mode[gNB_id] <= PUSCH) {
+ if (get_softmodem_params()->usim_test==0) {
+ pucch_procedures_ue_nr(UE,
+ gNB_id,
+ proc,
+ FALSE);
+ }
-/*!
- * \brief This is the UE thread for RX subframe n and TX subframe n+4.
- * This thread performs the phy_procedures_UE_RX() on every received slot.
- * then, if TX is enabled it performs TX for n+4.
- * \param arg is a pointer to a \ref PHY_VARS_NR_UE structure.
- * \returns a pointer to an int. The storage is not on the heap and must not be freed.
- */
+ LOG_D(PHY, "Sending Uplink data \n");
+ nr_ue_pusch_common_procedures(UE,
+ proc->nr_slot_tx,
+ &UE->frame_parms,1);
+ }
-typedef struct processingData_s {
- UE_nr_rxtx_proc_t proc;
- PHY_VARS_NR_UE *UE;
-} processingData_t;
-
-void UE_processing(void *arg) {
- processingData_t *rxtxD = (processingData_t *) arg;
- UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
- PHY_VARS_NR_UE *UE = rxtxD->UE;
- int slot_tx = proc->nr_slot_tx;
- int frame_tx = proc->frame_tx;
-
- processSlotRX(UE, proc);
- processSlotTX(UE, proc);
- ue_ta_procedures(UE, slot_tx, frame_tx);
+ if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) {
+ nr_ue_prach_procedures(UE, proc, gNB_id);
+ }
+ LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx);
+ }
+ ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx);
}
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
@@ -758,25 +744,44 @@ void *UE_thread(void *arg) {
int start_rx_stream = 0;
AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), "");
UE->rfdevice.host_type = RAU_HOST;
+ UE->lost_sync = 0;
+ UE->is_synchronized = 0;
AssertFatal(UE->rfdevice.trx_start_func(&UE->rfdevice) == 0, "Could not start the device\n");
+
notifiedFIFO_t nf;
initNotifiedFIFO(&nf);
- int nbSlotProcessing=0;
- int thread_idx=0;
+
notifiedFIFO_t freeBlocks;
initNotifiedFIFO_nothreadSafe(&freeBlocks);
+
+ int nbSlotProcessing=0;
+ int thread_idx=0;
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
int timing_advance = UE->timing_advance;
- for (int i=0; iframe_parms.slots_per_frame;
int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0;
+ for (int i=0; itxFifo);
+ pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt);
+ }
+
while (!oai_exit) {
+ if (UE->lost_sync) {
+ int nb = abortTpool(&(get_nrUE_params()->Tpool),RX_JOB_ID);
+ nb += abortNotifiedFIFO(&nf, RX_JOB_ID);
+ LOG_I(PHY,"Number of aborted slots %d\n",nb);
+ for (int i=0; iis_synchronized = 0;
+ UE->lost_sync = 0;
+ }
+
if (syncRunning) {
notifiedFIFO_elt_t *res=tryPullTpool(&nf,&(get_nrUE_params()->Tpool));
@@ -786,9 +791,10 @@ void *UE_thread(void *arg) {
if (UE->is_synchronized) {
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
// shift the frame index with all the frames we trashed meanwhile we perform the synch search
- decoded_frame_rx=(decoded_frame_rx + (!UE->init_sync_frame) + trashed_frames) % MAX_FRAME_NUMBER;
+ decoded_frame_rx=(decoded_frame_rx + UE->init_sync_frame + trashed_frames) % MAX_FRAME_NUMBER;
}
delNotifiedFIFO_elt(res);
+ start_rx_stream=0;
} else {
readFrame(UE, ×tamp, true);
trashed_frames+=2;
@@ -835,13 +841,13 @@ void *UE_thread(void *arg) {
// whatever means thread_idx
// Fix me: will be wrong when slot 1 is slow, as slot 2 finishes
- // Slot 3 will overlap if RX_NB_TH is 2
+ // Slot 3 will overlap if NR_RX_NB_TH is 2
// this is general failure in UE !!!
- thread_idx = absolute_slot % RX_NB_TH;
+ thread_idx = absolute_slot % NR_RX_NB_TH;
int slot_nr = absolute_slot % nb_slot_frame;
notifiedFIFO_elt_t *msgToPush;
AssertFatal((msgToPush=pullNotifiedFIFO_nothreadSafe(&freeBlocks)) != NULL,"chained list failure");
- processingData_t *curMsg=(processingData_t *)NotifiedFifoData(msgToPush);
+ nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(msgToPush);
curMsg->UE=UE;
// update thread index for received subframe
curMsg->proc.thread_id = thread_idx;
@@ -869,18 +875,18 @@ void *UE_thread(void *arg) {
for (int i=0; iframe_parms.nb_antennas_tx; i++)
txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp(
- ((slot_nr + DURATION_RX_TO_TX - RX_NB_TH)%nb_slot_frame),&UE->frame_parms,0)];
+ ((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH)%nb_slot_frame),&UE->frame_parms,0)];
int readBlockSize, writeBlockSize;
if (slot_nr<(nb_slot_frame - 1)) {
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms);
- writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms);
+ writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH) % nb_slot_frame, &UE->frame_parms);
} else {
UE->rx_offset_diff = computeSamplesShift(UE);
readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) -
UE->rx_offset_diff;
- writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms)- UE->rx_offset_diff;
+ writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH) % nb_slot_frame, &UE->frame_parms)- UE->rx_offset_diff;
}
AssertFatal(readBlockSize ==
@@ -907,31 +913,33 @@ void *UE_thread(void *arg) {
}
curMsg->proc.timestamp_tx = timestamp+
- UE->frame_parms.get_samples_slot_timestamp(slot_nr,
- &UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp;
+ UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX)
+ - firstSymSamp;
notifiedFIFO_elt_t *res;
- while (nbSlotProcessing >= RX_NB_TH) {
+ while (nbSlotProcessing >= NR_RX_NB_TH) {
res=pullTpool(&nf, &(get_nrUE_params()->Tpool));
nbSlotProcessing--;
- processingData_t *tmp=(processingData_t *)res->msgData;
+ nr_rxtx_thread_data_t *tmp=(nr_rxtx_thread_data_t *)res->msgData;
if (tmp->proc.decoded_frame_rx != -1)
decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
- else
+ else
decoded_frame_rx=-1;
pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
}
- if ( decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx)
+ if (decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx)
LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
- decoded_frame_rx, curMsg->proc.frame_rx );
+ decoded_frame_rx, curMsg->proc.frame_rx);
// use previous timing_advance value to compute writeTimestamp
- writeTimestamp = timestamp + UE->frame_parms.get_samples_slot_timestamp(slot_nr, &UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) -
- firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance;
+ writeTimestamp = timestamp+
+ UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX
+ - NR_RX_NB_TH) - firstSymSamp - openair0_cfg[0].tx_sample_advance -
+ UE->N_TA_offset - timing_advance;
// but use current UE->timing_advance value to compute writeBlockSize
if (UE->timing_advance != timing_advance) {
@@ -940,51 +948,47 @@ void *UE_thread(void *arg) {
}
int flags = 0;
- int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH;
- uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
- uint8_t num_UL_slots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots +
- (mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0);
- uint8_t first_tx_slot = tdd_period - num_UL_slots;
- if (slot_tx_usrp%tdd_period==first_tx_slot)
- flags=2;
- else if (slot_tx_usrp%tdd_period==first_tx_slot+num_UL_slots-1)
- flags = 3;
- else if (slot_tx_usrp%tdd_period>first_tx_slot)
+ int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH;
+
+ if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) {
+
+ uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
+
+ int nrofUplinkSlots = 0;
+ if (mac->scc_SIB)
+ nrofUplinkSlots = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
+ else if (mac->scc)
+ nrofUplinkSlots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
+
+ uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSlots != 0);
+ uint8_t first_tx_slot = tdd_period - num_UL_slots;
+
+ if (slot_tx_usrp % tdd_period == first_tx_slot)
+ flags = 2;
+ else if (slot_tx_usrp % tdd_period == first_tx_slot + num_UL_slots - 1)
+ flags = 3;
+ else if (slot_tx_usrp % tdd_period > first_tx_slot)
+ flags = 1;
+ } else {
flags = 1;
+ }
if (flags || IS_SOFTMODEM_RFSIM)
- AssertFatal( writeBlockSize ==
- UE->rfdevice.trx_write_func(&UE->rfdevice,
- writeTimestamp,
- txp,
- writeBlockSize,
- UE->frame_parms.nb_antennas_tx,
- flags),"");
+ AssertFatal(writeBlockSize ==
+ UE->rfdevice.trx_write_func(&UE->rfdevice,
+ writeTimestamp,
+ txp,
+ writeBlockSize,
+ UE->frame_parms.nb_antennas_tx,
+ flags),"");
for (int i=0; iframe_parms.nb_antennas_tx; i++)
memset(txp[i], 0, writeBlockSize);
nbSlotProcessing++;
- msgToPush->key=slot_nr;
+ LOG_D(PHY,"Number of slots being processed at the moment: %d\n",nbSlotProcessing);
pushTpool(&(get_nrUE_params()->Tpool), msgToPush);
- if (IS_SOFTMODEM_RFSIM) { //getenv("RFSIMULATOR")
- // FixMe: Wait previous thread is done, because race conditions seems too bad
- // in case of actual RF board, the overlap between threads mitigate the issue
- // We must receive one message, that proves the slot processing is done
- res=pullTpool(&nf, &(get_nrUE_params()->Tpool));
- nbSlotProcessing--;
- processingData_t *tmp=(processingData_t *)res->msgData;
-
- if (tmp->proc.decoded_frame_rx != -1)
- decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx);
- else
- decoded_frame_rx=-1;
- //decoded_frame_rx=tmp->proc.decoded_frame_rx;
-
- pushNotifiedFIFO_nothreadSafe(&freeBlocks,res);
- }
-
} // while !oai_exit
return NULL;
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 8a32f38d0a..3a492ba929 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -82,12 +82,15 @@ unsigned short config_frames[4] = {2,9,11,13};
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
#include "PHY/TOOLS/phy_scope_interface.h"
#include "PHY/TOOLS/nr_phy_scope.h"
-#define NRUE_MAIN
#include
#include "executables/softmodem-common.h"
#include "executables/thread-common.h"
+#include "nr_nas_msg_sim.h"
+
extern const char *duplex_mode[];
+THREAD_STRUCT thread_struct;
+nrUE_params_t nrUE_params;
// Thread variables
pthread_cond_t nfapi_sync_cond;
@@ -146,11 +149,11 @@ int card_offset = 0;
uint64_t num_missed_slots = 0; // counter for the number of missed slots
int transmission_mode = 1;
int numerology = 0;
-int usrp_tx_thread = 0;
int oaisim_flag = 0;
int emulate_rf = 0;
-
-char uecap_xer[1024],uecap_xer_in=0;
+uint32_t N_RB_DL = 106;
+char uecap_xer_in = 0;
+char uecap_xer[1024];
/* see file openair2/LAYER2/MAC/main.c for why abstraction_flag is needed
* this is very hackish - find a proper solution
@@ -188,6 +191,7 @@ int create_tasks_nrue(uint32_t ue_nb) {
itti_wait_ready(1);
if (ue_nb > 0) {
+ LOG_I(NR_RRC,"create TASK_RRC_NRUE \n");
if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
@@ -200,6 +204,11 @@ int create_tasks_nrue(uint32_t ue_nb) {
return -1;
}
}
+ if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) {
+ LOG_E(NR_RRC, "Create task for NAS UE failed\n");
+ return -1;
+ }
+
itti_wait_ready(0);
return 0;
}
@@ -238,9 +247,16 @@ nrUE_params_t *get_nrUE_params(void) {
}
/* initialie thread pools used for NRUE processing paralleliation */
void init_tpools(uint8_t nun_dlsch_threads) {
- char *params=calloc(1,(RX_NB_TH*3)+1);
- for (int i=0; iframe_type);
}
- LOG_I(PHY, "Set UE N_RB_DL %d\n", fp->N_RB_DL);
+ fp->N_RB_DL = N_RB_DL;
+ LOG_I(PHY, "Set UE N_RB_DL %d\n", N_RB_DL);
LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs);
}
@@ -340,92 +356,10 @@ void init_openair0(void) {
for (card=0; cardthreequarter_fs;
- numerology = frame_parms->numerology_index;
-
- if(frame_parms->N_RB_DL == 66) {
- if (numerology==3) {
- openair0_cfg[card].sample_rate=122.88e6;
- openair0_cfg[card].samples_per_frame = 1228800;
- } else {
- LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n");
- exit(-1);
- }
- }else if(frame_parms->N_RB_DL == 32) {
- if (numerology==3) {
- openair0_cfg[card].sample_rate=61.44e6;
- openair0_cfg[card].samples_per_frame = 614400;
- } else {
- LOG_E(PHY,"Unsupported numerology! FR2 supports only 120KHz SCS for now.\n");
- exit(-1);
- }
- }else if(frame_parms->N_RB_DL == 217) {
- if (numerology==1) {
- if (frame_parms->threequarter_fs) {
- openair0_cfg[card].sample_rate=92.16e6;
- openair0_cfg[card].samples_per_frame = 921600;
- }
- else {
- openair0_cfg[card].sample_rate=122.88e6;
- openair0_cfg[card].samples_per_frame = 1228800;
- }
- } else {
- LOG_E(PHY,"Unsupported numerology!\n");
- exit(-1);
- }
- } else if(frame_parms->N_RB_DL == 273) {
- if (numerology==1) {
- if (frame_parms->threequarter_fs) {
- AssertFatal(0 == 1,"three quarter sampling not supported for N_RB 273\n");
- }
- else {
- openair0_cfg[card].sample_rate=122.88e6;
- openair0_cfg[card].samples_per_frame = 1228800;
- }
- } else {
- LOG_E(PHY,"Unsupported numerology!\n");
- exit(-1);
- }
- } else if(frame_parms->N_RB_DL == 106) {
- if (numerology==0) {
- if (frame_parms->threequarter_fs) {
- openair0_cfg[card].sample_rate=23.04e6;
- openair0_cfg[card].samples_per_frame = 230400;
- } else {
- openair0_cfg[card].sample_rate=30.72e6;
- openair0_cfg[card].samples_per_frame = 307200;
- }
- } else if (numerology==1) {
- if (frame_parms->threequarter_fs) {
- openair0_cfg[card].sample_rate=46.08e6;
- openair0_cfg[card].samples_per_frame = 460800;
- }
- else {
- openair0_cfg[card].sample_rate=61.44e6;
- openair0_cfg[card].samples_per_frame = 614400;
- }
- } else if (numerology==2) {
- openair0_cfg[card].sample_rate=122.88e6;
- openair0_cfg[card].samples_per_frame = 1228800;
- } else {
- LOG_E(PHY,"Unsupported numerology!\n");
- exit(-1);
- }
- } else if(frame_parms->N_RB_DL == 50) {
- openair0_cfg[card].sample_rate=15.36e6;
- openair0_cfg[card].samples_per_frame = 153600;
- } else if (frame_parms->N_RB_DL == 25) {
- openair0_cfg[card].sample_rate=7.68e6;
- openair0_cfg[card].samples_per_frame = 76800;
- } else if (frame_parms->N_RB_DL == 6) {
- openair0_cfg[card].sample_rate=1.92e6;
- openair0_cfg[card].samples_per_frame = 19200;
- }
- else {
- LOG_E(PHY,"Unknown NB_RB %d!\n",frame_parms->N_RB_DL);
- exit(-1);
- }
+ openair0_cfg[card].configFilename = NULL;
+ openair0_cfg[card].threequarter_fs = frame_parms->threequarter_fs;
+ openair0_cfg[card].sample_rate = frame_parms->samples_per_subframe * 1e3;
+ openair0_cfg[card].samples_per_frame = frame_parms->samples_per_frame;
if (frame_parms->frame_type==TDD)
openair0_cfg[card].duplex_mode = duplex_mode_TDD;
@@ -436,11 +370,12 @@ void init_openair0(void) {
openair0_cfg[card].num_rb_dl = frame_parms->N_RB_DL;
openair0_cfg[card].clock_source = get_softmodem_params()->clock_source;
openair0_cfg[card].time_source = get_softmodem_params()->timing_source;
- openair0_cfg[card].tx_num_channels = min(2, frame_parms->nb_antennas_tx);
- openair0_cfg[card].rx_num_channels = min(2, frame_parms->nb_antennas_rx);
+ openair0_cfg[card].tx_num_channels = min(4, frame_parms->nb_antennas_tx);
+ openair0_cfg[card].rx_num_channels = min(4, frame_parms->nb_antennas_rx);
- LOG_I(PHY, "HW: Configuring card %d, tx/rx num_channels %d/%d, duplex_mode %s\n",
+ LOG_I(PHY, "HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %s\n",
card,
+ openair0_cfg[card].sample_rate,
openair0_cfg[card].tx_num_channels,
openair0_cfg[card].rx_num_channels,
duplex_mode[openair0_cfg[card].duplex_mode]);
@@ -472,9 +407,10 @@ void init_pdcp(int ue_id) {
}
pdcp_layer_init();
nr_pdcp_module_init(pdcp_initmask, ue_id);
+ //nr_DRB_preconfiguration();
+ //pdcp_module_init(pdcp_initmask, 0);
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
- LOG_I(PDCP, "Before getting out from init_pdcp() \n");
}
// Stupid function addition because UE itti messages queues definition is common with eNB
@@ -502,6 +438,7 @@ int main( int argc, char **argv ) {
get_options (); //Command-line options specific for NRUE
get_common_options(SOFTMODEM_5GUE_BIT );
+ init_tpools(nrUE_params.nr_dlsch_parallel);
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
#if T_TRACER
T_Config_Init();
@@ -527,7 +464,7 @@ int main( int argc, char **argv ) {
init_NR_UE(1,rrc_config_path);
int mode_offset = get_softmodem_params()->nsa ? NUMBER_OF_UE_MAX : 0;
- int node_number = get_softmodem_params()->node_number;
+ uint16_t node_number = get_softmodem_params()->node_number;
ue_id_g = (node_number == 0) ? 0 : node_number - 2;
AssertFatal(ue_id_g >= 0, "UE id is expected to be nonnegative.\n");
@@ -555,6 +492,7 @@ int main( int argc, char **argv ) {
LOG_E(NR_RRC,"Cannot create ITTI tasks for RRC layer of nr-UE\n");
exit(-1);
}
+
if (!get_softmodem_params()->nsa) {
for (int CC_id=0; CC_idif_module->phy_config_request(&mac->phy_config);
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
+ if (get_softmodem_params()->sa) { // set frame config to initial values from command line and assume that the SSB is centered on the grid
+ nrUE_config->ssb_config.scs_common = get_softmodem_params()->numerology;
+ nrUE_config->carrier_config.dl_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL;
+ nrUE_config->carrier_config.ul_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL;
+ nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<ssb_config.scs_common)))/1000;
+ nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<ssb_config.scs_common)))/1000;
+ nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1;
- nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
-
- init_symbol_rotation(&UE[CC_id]->frame_parms, 0);
- init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
-
- #ifdef FR2_TEST
- // Overwrite DL frequency (for FR2 testing)
- if (downlink_frequency[0][0]!=0){
- frame_parms[CC_id]->dl_CarrierFreq = downlink_frequency[0][0];
- if (frame_parms[CC_id]->frame_type == TDD)
- frame_parms[CC_id]->ul_CarrierFreq = downlink_frequency[0][0];
+ // Initialize values, will be updated upon SIB1 reception
+ nrUE_config->cell_config.frame_duplex_type = TDD;
+ nrUE_config->ssb_table.ssb_mask_list[0].ssb_mask = 0xFFFFFFFF;
+ nrUE_config->ssb_table.ssb_period = 1;
}
- #endif
+ nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config,
+ mac->scc == NULL ? 78 : *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
+
+ init_symbol_rotation(&UE[CC_id]->frame_parms);
+ init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
}
+ init_NR_UE_threads(1);
+ printf("UE threads created by %ld\n", gettid());
init_openair0();
// init UE_PF_PO and mutex lock
pthread_mutex_init(&ue_pf_po_mutex, NULL);
@@ -591,18 +535,22 @@ int main( int argc, char **argv ) {
configure_linux();
mlockall(MCL_CURRENT | MCL_FUTURE);
- if(IS_SOFTMODEM_DOFORMS) {
+ if(IS_SOFTMODEM_DOSCOPE) {
load_softscope("nr",PHY_vars_UE_g[0][0]);
}
-
- init_NR_UE_threads(1);
- printf("UE threads created by %ld\n", gettid());
-
}
config_sync_var=0;
// wait for end of program
printf("TYPE TO TERMINATE\n");
+
+#if 0
+ if (create_tasks_nrue(1) < 0) {
+ printf("cannot create ITTI tasks\n");
+ exit(-1); // need a softer mode
+ }
+#endif
+
// Sleep a while before checking all parameters have been used
// Some are used directly in external threads, asynchronously
sleep(20);
diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h
index eae00ac482..fa1a7accfe 100644
--- a/executables/nr-uesoftmodem.h
+++ b/executables/nr-uesoftmodem.h
@@ -56,7 +56,7 @@
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
- {"r" , CONFIG_HLP_PRB, 0, iptr:&(fp->N_RB_DL), defintval:25, TYPE_UINT, 0}, \
+ {"r" , CONFIG_HLP_PRB, 0, uptr:&(N_RB_DL), defuintval:160, TYPE_UINT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
@@ -73,9 +73,6 @@ extern uint64_t get_nrUE_optmask(void);
extern uint64_t set_nrUE_optmask(uint64_t bitmask);
extern nrUE_params_t *get_nrUE_params(void);
-#ifdef NRUE_MAIN
-nrUE_params_t nrUE_params;
-#endif
// In nr-ue.c
extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c
index 18eff92411..b1cf26d156 100644
--- a/executables/ocp-gnb.c
+++ b/executables/ocp-gnb.c
@@ -61,8 +61,6 @@ uint32_t do_forms=0;
unsigned int mmapped_dma=0;
int8_t threequarter_fs=0;
-uint32_t target_dl_mcs = 28; //maximum allowed mcs
-uint32_t target_ul_mcs = 20;
int chain_offset=0;
uint16_t sl_ahead=6;
uint16_t sf_ahead=6;
@@ -70,16 +68,15 @@ uint32_t timing_advance = 0;
int transmission_mode=1;
int emulate_rf = 0;
int numerology = 0;
-int usrp_tx_thread = 0;
int config_sync_var=-1;
pthread_mutex_t nfapi_sync_mutex;
pthread_cond_t nfapi_sync_cond;
int nfapi_sync_var=-1;
-uint8_t nfapi_mode = NFAPI_MONOLITHIC; // Default to monolithic mode
double cpuf;
+THREAD_STRUCT thread_struct;
pthread_cond_t sync_cond;
pthread_mutex_t sync_mutex;
@@ -95,7 +92,8 @@ time_stats_t nfapi_meas; // total tx time
time_stats_t softmodem_stats_rx_sf; // total rx time
// not used but needed for link
openair0_config_t openair0_cfg[MAX_CARDS];
-
+uint16_t slot_ahead=6;
+msc_interface_t msc_interface;
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB];
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
int flexran_agent_start(mid_t mod_id) {
@@ -122,7 +120,6 @@ int restart_L1L2(module_id_t gnb_id) {
}
static int wait_for_sync = 0;
-static char *itti_dump_file = NULL;
static double snr_dB=20;
static int DEFBANDS[] = {7};
static int DEFENBS[] = {0};
@@ -996,7 +993,7 @@ int main( int argc, char **argv ) {
(void *)NULL, "time_meas", -1, OAI_PRIORITY_RT_LOW);
}
- if(IS_SOFTMODEM_DOFORMS) {
+ if(IS_SOFTMODEM_DOSCOPE) {
scopeParms_t tmp= {&argc, argv, &ru, RC.gNB[0]};
load_softscope("nr",&tmp);
}
diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c
index 66573c43f4..d8d5427d5d 100644
--- a/executables/softmodem-common.c
+++ b/executables/softmodem-common.c
@@ -45,6 +45,8 @@
static softmodem_params_t softmodem_params;
char *parallel_config=NULL;
char *worker_config=NULL;
+msc_interface_t msc_interface;
+int usrp_tx_thread = 0;
uint8_t nfapi_mode=0;
@@ -86,8 +88,8 @@ char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) {
void get_common_options(uint32_t execmask) {
uint32_t online_log_messages=0;
uint32_t glog_level=0 ;
- uint32_t start_telnetsrv = 0;
- uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0;
+ uint32_t start_telnetsrv = 0, start_telnetclt = 0;
+ uint32_t noS1 = 0, nokrnmod = 1, nonbiot = 0;
uint32_t rfsim = 0, basicsim = 0, do_forms = 0;
char *logmem_filename = NULL;
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
@@ -95,21 +97,26 @@ void get_common_options(uint32_t execmask) {
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
check_execmask(execmask);
config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
- config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
- sizeof(cmdline_logparams)/sizeof(paramdef_t));
- config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
-
- if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
+
+ int numparams=sizeof(cmdline_logparams)/sizeof(paramdef_t);
+ config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,numparams);
+ config_get( cmdline_logparams,numparams,NULL);
+
+ if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) {
set_glog_onlinelog(online_log_messages);
}
- if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
+ if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_LOGL_OPT))) {
set_glog(glog_level);
}
if (start_telnetsrv) {
load_module_shlib("telnetsrv",NULL,0,NULL);
}
+
+ if (start_telnetclt) {
+ set_softmodem_optmask(SOFTMODEM_TELNETCLT_BIT);
+ }
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
log_mem_filename = &logmem_filename[0];
@@ -140,7 +147,7 @@ void get_common_options(uint32_t execmask) {
}
if (do_forms) {
- set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT);
+ set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT);
}
if(parallel_config != NULL) set_parallel_conf(parallel_config);
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index 198d6fa499..7e63ab6814 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -73,6 +73,7 @@ extern "C"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
#define CONFIG_HLP_256QAM "Use the 256 QAM mcs table for PDSCH\n"
+#define CONFIG_HLP_NONSTOP "Go back to frame sync mode after 100 consecutive PBCH failures\n"
//#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation"
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
@@ -84,13 +85,17 @@ extern "C"
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
#define CONFIG_HLP_NUMEROLOGY "adding numerology for 5G\n"
+#define CONFIG_HLP_BAND "band index\n"
#define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n"
#define CONFIG_HLP_PARALLEL_CMD "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n"
#define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n"
+#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n"
+
#define CONFIG_HLP_NOS1 "Disable s1 interface\n"
#define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n"
#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
+#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n"
#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n"
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -107,6 +112,7 @@ extern "C"
#define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag
#define CHAIN_OFFSET softmodem_params.chain_offset
#define NUMEROLOGY softmodem_params.numerology
+#define BAND softmodem_params.band
#define EMULATE_RF softmodem_params.emulate_rf
#define CLOCK_SOURCE softmodem_params.clock_source
#define TIMING_SOURCE softmodem_params.timing_source
@@ -116,27 +122,30 @@ extern "C"
#define NFAPI softmodem_params.nfapi
#define NSA softmodem_params.nsa
#define NODE_NUMBER softmodem_params.node_number
+#define NON_STOP softmodem_params.non_stop
#define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat";
+extern int usrp_tx_thread;
#define CMDLINE_PARAMS_DESC { \
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\
- {"split73", CONFIG_HLP_SPLIT73, 0, strptr:(char **)&SPLIT73, defstrval:NULL, TYPE_STRING, sizeof(SPLIT73)},\
- {"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:(char **)&TP_CONFIG, defstrval:"n", TYPE_STRING, sizeof(TP_CONFIG)}, \
+ {"split73", CONFIG_HLP_SPLIT73, 0, strptr:(char **)&SPLIT73, defstrval:NULL, TYPE_STRING, sizeof(SPLIT73)}, \
+ {"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:(char **)&TP_CONFIG, defstrval:"n", TYPE_STRING, sizeof(TP_CONFIG)}, \
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
{"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \
- {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \
+ {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
- {"clock-source", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
- {"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \
+ {"clock-source", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
+ {"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
- {"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:0, TYPE_UINT64, 0}, \
- {"CO" , CONFIG_HLP_ULF, 0, iptr:&(uplink_frequency_offset[0][0]), defintval:0, TYPE_INT, 0}, \
+ {"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:3619200000, TYPE_UINT64, 0}, \
+ {"CO" , CONFIG_HLP_ULF, 0, iptr:&(uplink_frequency_offset[0][0]), defintval:0, TYPE_INT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
- {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:0, TYPE_INT, 0}, \
+ {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&NUMEROLOGY, defintval:1, TYPE_INT, 0}, \
+ {"band" , CONFIG_HLP_BAND, PARAMFLAG_BOOL, iptr:&BAND, defintval:78, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&EMULATE_RF, defintval:0, TYPE_INT, 0}, \
{"parallel-config", CONFIG_HLP_PARALLEL_CMD, 0, strptr:(char **)¶llel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
@@ -146,9 +155,11 @@ extern "C"
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
{"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \
- {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
{"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \
{"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \
+ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
+ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
+ {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \
}
#define CONFIG_HLP_NSA "Enable NSA mode \n"
@@ -157,23 +168,22 @@ extern "C"
#define CONFIG_HLP_LOGV "Set the global log verbosity \n"
#define CONFIG_HLP_TELN "Start embedded telnet server \n"
#define CONFIG_HLP_MSC "Enable the MSC tracing utility \n"
-/*----------------------------------------------------------------------------------------------------------------------------*/
-/* command line parameters for LOG utility */
-/* optname helpstr paramflags XXXptr defXXXval type numelt */
-/*----------------------------------------------------------------------------------------------------------------------------*/
+#define CONFIG_FLOG_OPT "R"
+#define CONFIG_LOGL_OPT "g"
+/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
+/* command line parameters for LOG utility */
+/* optname helpstr paramflags XXXptr defXXXval type numelt */
+/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
#define START_MSC softmodem_params.start_msc
#define CMDLINE_LOGPARAMS_DESC { \
- {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
- {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
- {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
- {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
- {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
+ {CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
+ {CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
+ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
+ {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
+ {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
+ {"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \
}
-#define CMDLINE_ONLINELOG_IDX 0
-#define CMDLINE_GLOGLEVEL_IDX 1
-#define CMDLINE_GLOGVERBO_IDX 2
-#define CMDLINE_STARTTELN_IDX 3
/* check function for global log level */
#define CMDLINE_LOGPARAMS_CHECK_DESC { \
@@ -182,6 +192,7 @@ extern "C"
{ .s5= {NULL} } , \
{ .s5= {NULL} } , \
{ .s5= {NULL} } , \
+ { .s5= {NULL} } , \
}
/***************************************************************************************************************************************/
@@ -192,8 +203,9 @@ extern "C"
#define SOFTMODEM_RFSIM_BIT (1<<10)
#define SOFTMODEM_BASICSIM_BIT (1<<11)
#define SOFTMODEM_SIML1_BIT (1<<12)
-#define SOFTMODEM_DOFORMS_BIT (1<<15)
+#define SOFTMODEM_DOSCOPE_BIT (1<<15)
#define SOFTMODEM_RECPLAY_BIT (1<<16)
+#define SOFTMODEM_TELNETCLT_BIT (1<<17)
#define SOFTMODEM_ENB_BIT (1<<20)
#define SOFTMODEM_GNB_BIT (1<<21)
#define SOFTMODEM_4GUE_BIT (1<<22)
@@ -208,8 +220,9 @@ extern "C"
#define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT)
#define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT)
#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
-#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT)
+#define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT)
#define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT)
+#define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT)
#define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT)
#define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT)
#define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT)
@@ -230,6 +243,7 @@ typedef struct {
int single_thread_flag; //eNodeB only
int chain_offset;
int numerology;
+ int band;
unsigned int start_msc;
uint32_t clock_source;
uint32_t timing_source;
@@ -239,6 +253,7 @@ typedef struct {
uint8_t nfapi;
int nsa;
uint16_t node_number;
+ int non_stop;
} softmodem_params_t;
extern uint64_t get_softmodem_optmask(void);
@@ -250,6 +265,14 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
extern void set_softmodem_sighandler(void);
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
+extern int usrp_tx_thread;
+extern uint16_t sl_ahead;
+extern uint16_t sf_ahead;
+extern volatile int oai_exit;
+
+void tx_func(void *param);
+void rx_func(void *param);
+void ru_tx_func(void *param);
extern uint8_t nfapi_mode;
extern int16_t vnf_pnf_sfnslot_delta;
#ifdef __cplusplus
diff --git a/executables/thread-common.h b/executables/thread-common.h
index 6f3af3cfc0..0aaeb3c30e 100644
--- a/executables/thread-common.h
+++ b/executables/thread-common.h
@@ -3,7 +3,7 @@
#include "PHY/defs_common.h"
-THREAD_STRUCT thread_struct;
+extern THREAD_STRUCT thread_struct;
static inline void set_parallel_conf(char *parallel_conf) {
mapping config[]= {
diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c
index a9f10a3841..22b38b0d92 100644
--- a/nfapi/oai_integration/nfapi_pnf.c
+++ b/nfapi/oai_integration/nfapi_pnf.c
@@ -73,7 +73,6 @@ extern pthread_mutex_t nfapi_sync_mutex;
extern int nfapi_sync_var;
extern int sync_var;
-char uecap_xer_in;
extern void init_eNB_afterRU(void);
extern void init_UE_stub(int nb_inst,int,int);
@@ -2200,7 +2199,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
- printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
+ printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n",
__FUNCTION__,config->vnf_ip_addr, config->vnf_p5_port,
pnf.phys[0].local_addr,
pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
@@ -2251,7 +2250,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
- printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
+ printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n",
__FUNCTION__,
config->vnf_ip_addr, config->vnf_p5_port,
pnf.phys[0].local_addr,
diff --git a/nfapi/oai_integration/nfapi_pnf.h b/nfapi/oai_integration/nfapi_pnf.h
index b3ab7cbdbc..61d4847eba 100644
--- a/nfapi/oai_integration/nfapi_pnf.h
+++ b/nfapi/oai_integration/nfapi_pnf.h
@@ -21,6 +21,7 @@
#if !defined(NFAPI_PNF_H__)
#define NFAPI_PNF_H__
+extern nfapi_ue_release_request_body_t release_rntis;
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h
index 0a83c1a27f..8e6bf9a802 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h
@@ -14,7 +14,7 @@
/// RX_IND
-#define FAPI_NR_RX_PDU_TYPE_MIB 0x01
+#define FAPI_NR_RX_PDU_TYPE_SSB 0x01
#define FAPI_NR_RX_PDU_TYPE_SIB 0x02
#define FAPI_NR_RX_PDU_TYPE_DLSCH 0x03
#define FAPI_NR_DCI_IND 0x04
@@ -45,6 +45,8 @@
#define FAPI_NR_DL_CONFIG_TYPE_DLSCH 0x02
#define FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH 0x03
#define FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH 0x04
+#define FAPI_NR_DL_CONFIG_TYPE_P_DLSCH 0x05
+#define FAPI_NR_DL_CONFIG_TYPES 0x05
#define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01
#define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02
@@ -59,6 +61,6 @@
#define FAPI_NR_UL_CONFIG_TYPE_PUCCH 0x02
#define FAPI_NR_UL_CONFIG_TYPE_PUSCH 0x03
#define FAPI_NR_UL_CONFIG_TYPE_SRS 0x04
-
+#define FAPI_NR_UL_CONFIG_TYPES 0x04
#endif
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
index 9df9be4cbd..c0abf6acb0 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h
@@ -111,8 +111,8 @@ typedef struct {
uint8_t ssb_index;
uint8_t ssb_length;
uint16_t cell_id;
-
-} fapi_nr_mib_pdu_t;
+ uint16_t ssb_start_subcarrier;
+} fapi_nr_ssb_pdu_t;
typedef struct {
uint32_t pdu_length;
@@ -124,7 +124,7 @@ typedef struct {
uint8_t pdu_type;
union {
fapi_nr_pdsch_pdu_t pdsch_pdu;
- fapi_nr_mib_pdu_t mib_pdu;
+ fapi_nr_ssb_pdu_t ssb_pdu;
fapi_nr_sib_pdu_t sib_pdu;
};
} fapi_nr_rx_indication_body_t;
@@ -972,7 +972,7 @@ typedef struct
typedef struct
{
- uint32_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
+ int ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
uint8_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload
uint8_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3
@@ -1058,12 +1058,6 @@ typedef struct {
fapi_nr_tdd_table_t tdd_table;
fapi_nr_prach_config_t prach_config;
- fapi_nr_dl_bwp_common_config_t dl_bwp_common;
- fapi_nr_dl_bwp_dedicated_config_t dl_bwp_dedicated;
-
- fapi_nr_ul_bwp_common_config_t ul_bwp_common;
- fapi_nr_ul_bwp_dedicated_config_t ul_bwp_dedicated;
-
} fapi_nr_config_request_t;
#endif
diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
index d148fc8ef2..3fd3371b9a 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h
@@ -357,7 +357,7 @@ typedef struct
//table 3-23
typedef struct
{
- nfapi_uint32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
+ nfapi_int32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm)
nfapi_uint8_tlv_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload
nfapi_uint8_tlv_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3
@@ -398,13 +398,13 @@ typedef struct
{
nfapi_uint32_tlv_t ssb_mask;//Bitmap for actually transmitted SSB. MSB->LSB of first 32 bit number corresponds to SSB 0 to SSB 31 MSB->LSB of second 32 bit number corresponds to SSB 32 to SSB 63 Value for each bit: 0: not transmitted 1: transmitted
-} nfapi_nr_ssb_mask_size_2_t;
+} nfapi_nr_ssb_mask_list_t;
typedef struct
{
- nfapi_uint8_tlv_t beam_id[64];//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63
+ nfapi_uint8_tlv_t beam_id;//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63
-} nfapi_nr_ssb_mask_size_64_t;
+} nfapi_nr_ssb_beam_id_list_t;
typedef struct
{
@@ -413,8 +413,8 @@ typedef struct
nfapi_uint8_tlv_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160
nfapi_uint8_tlv_t ssb_subcarrier_offset;//ssbSubcarrierOffset or 𝑘𝑆𝑆𝐵 (38.211, section 7.4.3.1) Value: 0->31
nfapi_uint32_tlv_t MIB;//MIB payload, where the 24 MSB are used and represent the MIB in [38.331 MIB IE] and represent 0 1 2 3 1 , , , ,..., A− a a a a a [38.212, sec 7.1.1]
- nfapi_nr_ssb_mask_size_2_t ssb_mask_list[2];
- nfapi_nr_ssb_mask_size_64_t* ssb_beam_id_list;//64
+ nfapi_nr_ssb_mask_list_t ssb_mask_list[2];
+ nfapi_nr_ssb_beam_id_list_t ssb_beam_id_list[64];
nfapi_uint8_tlv_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled
nfapi_uint8_tlv_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled
@@ -678,7 +678,7 @@ typedef struct {
} nfapi_nr_slot_indication_scf_t;
-// 3.4.2
+// 3.4.2
//for pdcch_pdu:
@@ -691,11 +691,10 @@ typedef struct
typedef struct
{
uint16_t pm_idx;//Index to precoding matrix (PM) pre-stored at cell configuration. Note: If precoding is not used this parameter should be set to 0. Value: 0->65535.
- nfapi_nr_dig_bf_interface_t* dig_bf_interface_list;
+ nfapi_nr_dig_bf_interface_t dig_bf_interface_list[1];//max dig_bf_interfaces
}nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t;
-/*
//table 3-43
typedef struct
{
@@ -703,23 +702,10 @@ typedef struct
uint16_t prg_size;//Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275
//watchout: dig_bf_interfaces here, in table 3-53 it's dig_bf_interface
uint8_t dig_bf_interfaces;//Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
- nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t* prgs_list;//
+ nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t prgs_list[1];//max prg_size
}nfapi_nr_tx_precoding_and_beamforming_t;
-*/
-typedef struct {
- /// Number of PRGs spanning this allocation. Value : 1->275
- uint16_t numPRGs;
- /// Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275
- uint16_t prgSize;
- /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
- uint8_t digBFInterfaces;
- // Depends on numPRGs
- uint16_t PMIdx[275];
- // Depends on digBFInterfaces
- uint16_t beamIdx[256];
-} nfapi_nr_tx_precoding_and_beamforming_t;
//table 3-37
@@ -755,16 +741,6 @@ typedef struct {
} nfapi_nr_dl_dci_pdu_t;
-typedef struct {
- /// Number of PRGs spanning this allocation. Value : 1->275
- uint16_t numPRGs;
- /// Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275
- uint16_t prgSize;
- /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255
- uint8_t digBFInterfaces;
- uint16_t PMIdx[275];
- uint16_t *beamIdx[275];
-} nr_beamforming_t;
typedef struct {
///Bandwidth part size [TS38.213 sec12]. Number of contiguous PRBs allocated to the BWP,Value: 1->275
@@ -1030,7 +1006,7 @@ typedef struct {
typedef struct {
uint16_t PDUType;
- uint16_t PDUSize;
+ uint32_t PDUSize;
union {
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu;
@@ -1600,8 +1576,7 @@ typedef struct
{
uint8_t csi_part1_crc;
uint16_t csi_part1_bit_len;
- //! fixme
- uint8_t* csi_part1_payload;//uint8_t[ceil(csiPart1BitLen/8)]
+ uint8_t* csi_part1_payload;
} nfapi_nr_csi_part1_pdu_t;
@@ -1610,8 +1585,7 @@ typedef struct
{
uint8_t csi_part2_crc;
uint16_t csi_part2_bit_len;
- //! fixme
- uint8_t* csi_part2_payload;//uint8_t[ceil(csiPart2BitLen/8)]
+ uint8_t* csi_part2_payload;
} nfapi_nr_csi_part2_pdu_t;
//table 3-63
diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
index 6ee9dec122..923f678792 100755
--- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
+++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
@@ -1,8810 +1,8806 @@
-/*
- * Copyright 2017 Cisco Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include "nfapi_nr_interface_scf.h"
-
-extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
-extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
-
-uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len)
-{
- uint32_t chksum = 0;
- // calcaulte upto the checksum
- chksum = crc32(chksum, buffer, 8);
-
- // skip the checksum
- uint8_t zeros[4] = {0, 0, 0, 0};
- chksum = crc32(chksum, zeros, 4);
-
- // continu with the rest of the mesage
- chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH);
-
- // return the inverse
- return ~(chksum);
-}
-
-int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len)
-{
- uint32_t checksum = nfapi_calculate_checksum(buffer, len);
-
- uint8_t* p_write = &buffer[8];
- return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1);
-}
-
-int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp)
-{
- uint8_t* p_write = &buffer[12];
- return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1);
-}
-
-uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len)
-{
- return nfapi_calculate_checksum(buffer, len);
-}
-
-void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
-{
- if(size == 0)
- return 0;
-
- void* buffer_p = NULL;
- if(config && config->allocate)
- {
- buffer_p = (config->allocate)(size);
- if(buffer_p != NULL){
- memset(buffer_p,0,size);
- }
- return buffer_p;
- }
- else
- {
- buffer_p = calloc(1, size);
- return buffer_p;
- }
-}
-
-void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config)
-{
- if(ptr == NULL)
- return;
-
- if(config && config->deallocate)
- {
- return (config->deallocate)(ptr);
- }
- else
- {
- return free(ptr);
- }
-}
-// Pack routines
-
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
-
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format);
-
- return ( push8(value->dci_format, ppWritePackedMsg, end) &&
- push8(value->cce_idx, ppWritePackedMsg, end) &&
- push8(value->aggregation_level, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
- push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
- push32(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->mcs_1, ppWritePackedMsg, end) &&
- push8(value->redundancy_version_1, ppWritePackedMsg, end) &&
- push8(value->new_data_indicator_1, ppWritePackedMsg, end) &&
- push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
- push8(value->mcs_2, ppWritePackedMsg, end) &&
- push8(value->redundancy_version_2, ppWritePackedMsg, end) &&
- push8(value->new_data_indicator_2, ppWritePackedMsg, end) &&
- push8(value->harq_process, ppWritePackedMsg, end) &&
- push8(value->tpmi, ppWritePackedMsg, end) &&
- push8(value->pmi, ppWritePackedMsg, end) &&
- push8(value->precoding_information, ppWritePackedMsg, end) &&
- push8(value->tpc, ppWritePackedMsg, end) &&
- push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
- push8(value->ngap, ppWritePackedMsg, end) &&
- push8(value->transport_block_size_index, ppWritePackedMsg, end) &&
- push8(value->downlink_power_offset, ppWritePackedMsg, end) &&
- push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
- push8(value->preamble_index, ppWritePackedMsg, end) &&
- push8(value->prach_mask_index, ppWritePackedMsg, end) &&
- push8(value->rnti_type, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
-
- return( push8(value->mcch_flag, ppWritePackedMsg, end) &&
- push8(value->mcch_change_notification, ppWritePackedMsg, end) &&
- push8(value->scrambling_identity, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
-
- return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
- push8(value->carrier_indicator, ppWritePackedMsg, end) &&
- push8(value->srs_flag, ppWritePackedMsg, end) &&
- push8(value->srs_request, ppWritePackedMsg, end) &&
- push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) &&
- push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
- push8(value->n_dl_rb, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
-
- return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) &&
- push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
-
- return ( push8(value->primary_cell_type, ppWritePackedMsg, end) &&
- push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) &&
- push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) &&
- pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
- push8(value->number_of_subbands, ppWritePackedMsg, end) &&
- push8(value->num_antennas, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_subbands; ++idx)
- {
- nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
-
- if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) &&
- push8(subband_info->scheduled_ues, ppWritePackedMsg, end)))
- return 0;
-
-
- uint8_t antenna_idx = 0;
- uint8_t scheduled_ue_idx = 0;
-
- for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
- {
- for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
- {
- if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end))
- return 0;
- }
- }
-
- }
-
-
- return 1;
-
-}
-
-static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv;
-
- return(
- push16(value->bwp_size, ppWritePackedMsg, end) &&
- push16(value->bwp_start, ppWritePackedMsg, end) &&
-
- push8(value->subcarrier_spacing, ppWritePackedMsg, end) &&
- push8(value->cyclic_prefix, ppWritePackedMsg, end) &&
-
- push16(value->start_rb, ppWritePackedMsg, end) &&
- push16(value->nr_of_rbs, ppWritePackedMsg, end) &&
-
- push8(value->csi_type, ppWritePackedMsg, end) &&
- push8(value->row, ppWritePackedMsg, end) &&
-
- push16(value->freq_domain, ppWritePackedMsg, end) &&
- push8(value->symb_l0, ppWritePackedMsg, end) &&
-
- push8(value->symb_l1, ppWritePackedMsg, end) &&
- push8(value->cdm_type, ppWritePackedMsg, end) &&
-
- push8(value->freq_density, ppWritePackedMsg, end) &&
- push16(value->scramb_id, ppWritePackedMsg, end) &&
-
- push8(value->power_control_offset, ppWritePackedMsg, end) &&
- push8(value->power_control_offset_ss, ppWritePackedMsg, end)
- );
-
-}
-
-
-static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
-
- for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
- {
- if(!(push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
- push16(value->dci_pdu[i].ScramblingId, ppWritePackedMsg, end) &&
-
- push16(value->dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) &&
- push8(value->dci_pdu[i].CceIndex, ppWritePackedMsg, end) &&
- push8(value->dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) &&
- push8(value->dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) &&
-
- push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
- push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
- pusharray8(value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
- return 0;
-
- }
-
- // TODO: resolve the packaging of array (currently sending a single element)
- return(
- push16(value->BWPSize, ppWritePackedMsg, end) &&
- push16(value->BWPStart, ppWritePackedMsg, end) &&
- push8(value->SubcarrierSpacing, ppWritePackedMsg, end) &&
- push8(value->CyclicPrefix, ppWritePackedMsg, end) &&
-
- push8(value->StartSymbolIndex, ppWritePackedMsg, end) &&
- push8(value->DurationSymbols, ppWritePackedMsg, end) &&
- pusharray8(value->FreqDomainResource, 6, 6, ppWritePackedMsg, end) &&
- push8(value->CceRegMappingType, ppWritePackedMsg, end) &&
-
- push8(value->RegBundleSize, ppWritePackedMsg, end) &&
- push8(value->InterleaverSize, ppWritePackedMsg, end) &&
- push8(value->CoreSetType, ppWritePackedMsg, end) &&
- push16(value->ShiftIndex, ppWritePackedMsg, end) &&
-
- push8(value->precoderGranularity, ppWritePackedMsg, end) &&
- push16(value->numDlDci, ppWritePackedMsg, end));
-
-}
-
-
-static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- NFAPI_TRACE(NFAPI_TRACE_DEBUG, "packing pdsch pdu. \n");
- nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
-
- // TODO: resolve the packaging of array (currently sending a single element)
- return(
- push16(value->pduBitmap, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push16(value->pduIndex, ppWritePackedMsg, end) &&
- push16(value->BWPSize, ppWritePackedMsg, end) &&
-
- push16(value->BWPStart, ppWritePackedMsg, end) &&
- push8(value->SubcarrierSpacing, ppWritePackedMsg, end) &&
- push8(value->CyclicPrefix, ppWritePackedMsg, end) &&
- push8(value->NrOfCodewords, ppWritePackedMsg, end) &&
-
- pusharray16(value->targetCodeRate, 2, 1, ppWritePackedMsg, end) &&
- pusharray8(value->qamModOrder, 2, 1, ppWritePackedMsg, end) &&
- pusharray8(value->mcsIndex, 2, 1, ppWritePackedMsg, end) &&
- pusharray8(value->mcsTable, 2, 1, ppWritePackedMsg, end) &&
-
- pusharray8(value->rvIndex, 2, 1, ppWritePackedMsg, end) &&
- pusharray32(value->TBSize, 2, 1, ppWritePackedMsg, end) &&
- push16(value->dataScramblingId, ppWritePackedMsg, end) &&
- push8(value->nrOfLayers, ppWritePackedMsg, end) &&
-
- push8(value->transmissionScheme, ppWritePackedMsg, end) &&
- push8(value->refPoint, ppWritePackedMsg, end) &&
- push16(value->dlDmrsSymbPos, ppWritePackedMsg, end) &&
- push8(value->dmrsConfigType, ppWritePackedMsg, end) &&
-
- push16(value->dlDmrsScramblingId, ppWritePackedMsg, end) &&
- push8(value->SCID, ppWritePackedMsg, end) &&
- push8(value->numDmrsCdmGrpsNoData, ppWritePackedMsg, end) &&
- push16(value->dmrsPorts, ppWritePackedMsg, end) &&
-
- push8(value->resourceAlloc, ppWritePackedMsg, end) &&
- push16(value->rbStart, ppWritePackedMsg, end) &&
- push16(value->rbSize, ppWritePackedMsg, end) &&
-
- push8(value->VRBtoPRBMapping, ppWritePackedMsg, end) &&
- push8(value->StartSymbolIndex, ppWritePackedMsg, end) &&
- push8(value->NrOfSymbols, ppWritePackedMsg, end) &&
- push8(value->PTRSPortIndex, ppWritePackedMsg, end) &&
-
- push8(value->PTRSTimeDensity, ppWritePackedMsg, end) &&
- push8(value->PTRSFreqDensity, ppWritePackedMsg, end) &&
- push8(value->PTRSReOffset, ppWritePackedMsg, end)
- );
-
-}
-
-
-static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Packing ssb. \n");
- nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
-
- return(
- push16(value->PhysCellId, ppWritePackedMsg, end) &&
- push8(value->BetaPss, ppWritePackedMsg, end) &&
- push8(value->SsbBlockIndex, ppWritePackedMsg, end) &&
- push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) &&
- push16(value->ssbOffsetPointA, ppWritePackedMsg, end) &&
- push8(value->bchPayloadFlag, ppWritePackedMsg, end) &&
- push32(value->bchPayload, ppWritePackedMsg, end) &&
- push8(value->ssbRsrp, ppWritePackedMsg, end)
- // TODO: pack precoding_and_beamforming too
- );
-
-}
-
-static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
-
- return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) &&
- push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) &&
- push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
- push8(value->codebook_size_determination, ppWritePackedMsg, end) &&
- push8(value->drms_table_flag, ppWritePackedMsg, end) &&
- push8(value->tpm_struct_flag, ppWritePackedMsg, end) &&
- (value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1));
-}
-
-static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
-
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__);
-
- return( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
-
- return ( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
- push32(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->modulation, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push16(value->mbsfn_area_id, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem;
-
- return ( push8(bf->subband_index, ppWritePackedMsg, end) &&
- push8(bf->num_antennas, ppWritePackedMsg, end) &&
- pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end));
-
-
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
-
- return ( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
- push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
- push32(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->modulation, ppWritePackedMsg, end) &&
- push8(value->redundancy_version, ppWritePackedMsg, end) &&
- push8(value->transport_blocks, ppWritePackedMsg, end) &&
- push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
- push8(value->transmission_scheme, ppWritePackedMsg, end) &&
- push8(value->number_of_layers, ppWritePackedMsg, end) &&
- push8(value->number_of_subbands, ppWritePackedMsg, end) &&
- pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) &&
- push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
- push8(value->pa, ppWritePackedMsg, end) &&
- push8(value->delta_power_offset_index, ppWritePackedMsg, end) &&
- push8(value->ngap, ppWritePackedMsg, end) &&
- push8(value->nprb, ppWritePackedMsg, end) &&
- push8(value->transmission_mode, ppWritePackedMsg, end) &&
- push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) &&
- push8(value->num_bf_vector, ppWritePackedMsg, end) &&
- packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info));
-
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
- return ( push8(value->nscid, ppWritePackedMsg, end) );
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
-
- return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) &&
- push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
- push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
- push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
- pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
- push8(value->pdsch_start, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
-
- return( push8(value->drms_config_flag, ppWritePackedMsg, end) &&
- push16(value->drms_scrambling, ppWritePackedMsg, end) &&
- push8(value->csi_config_flag, ppWritePackedMsg, end) &&
- push16(value->csi_scrambling, ppWritePackedMsg, end) &&
- push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) &&
- push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) &&
- push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
-
- return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) &&
- push8(value->maxlayers, ppWritePackedMsg, end) &&
- push8(value->n_dl_harq, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
-
- return( push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
- push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
- push8(value->ue_type, ppWritePackedMsg, end) &&
- push8(value->pdsch_payload_type, ppWritePackedMsg, end) &&
- push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
- push8(value->drms_table_flag, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
-
- return( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->p_rnti, ppWritePackedMsg, end) &&
- push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
- push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
- push32(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->mcs, ppWritePackedMsg, end) &&
- push8(value->redundancy_version, ppWritePackedMsg, end) &&
- push8(value->number_of_transport_blocks, ppWritePackedMsg, end) &&
- push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
- push8(value->transmission_scheme, ppWritePackedMsg, end) &&
- push8(value->number_of_layers, ppWritePackedMsg, end) &&
- push8(value->codebook_index, ppWritePackedMsg, end) &&
- push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
- push8(value->pa, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push8(value->nprb, ppWritePackedMsg, end) &&
- push8(value->ngap, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
-
- return ( push8(value->ue_mode, ppWritePackedMsg, end) &&
- push16(value->initial_transmission_sf_io, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
-
- return( push16(value->transmission_power, ppWritePackedMsg, end) &&
- push8(value->prs_bandwidth, ppWritePackedMsg, end) &&
- push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) &&
- push8(value->prs_muting, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
-
- return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) &&
- push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
- push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) &&
- pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
-
- if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) &&
- push8(value->cdm_type, ppWritePackedMsg, end) &&
- push8(value->num_bf_vector, ppWritePackedMsg, end)))
- {
- return 0;
- }
-
- uint16_t i;
- for(i = 0; i < value->num_bf_vector; ++i)
- {
- if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) &&
- pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end)))
- return 0;
- }
-
- return 1;
-}
-static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(vector->subband_index, ppWritePackedMsg, end) &&
- push8(vector->num_antennas, ppWritePackedMsg, end) &&
- pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
-
- return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) &&
- push16(value->epdcch_id, ppWritePackedMsg, end) &&
- push8(value->epdcch_start_symbol, ppWritePackedMsg, end) &&
- push8(value->epdcch_num_prb, ppWritePackedMsg, end) &&
- pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) &&
- pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
-
- return (push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
- push8(value->initial_lbt_sf, ppWritePackedMsg, end));
-}
-static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
-
- return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) &&
- push8(value->number_of_prb_pairs, ppWritePackedMsg, end) &&
- push8(value->resource_block_assignment, ppWritePackedMsg, end) &&
- push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) &&
- push8(value->start_symbol, ppWritePackedMsg, end) &&
- push8(value->ecce_index, ppWritePackedMsg, end) &&
- push8(value->aggregation_level, ppWritePackedMsg, end) &&
- push8(value->rnti_type, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->ce_mode, ppWritePackedMsg, end) &&
- push16(value->drms_scrambling_init, ppWritePackedMsg, end) &&
- push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push8(value->dci_format, ppWritePackedMsg, end) &&
- push16(value->resource_block_coding, ppWritePackedMsg, end) &&
- push8(value->mcs, ppWritePackedMsg, end) &&
- push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) &&
- push8(value->redundancy_version, ppWritePackedMsg, end) &&
- push8(value->new_data_indicator, ppWritePackedMsg, end) &&
- push8(value->harq_process, ppWritePackedMsg, end) &&
- push8(value->tpmi_length, ppWritePackedMsg, end) &&
- push8(value->tpmi, ppWritePackedMsg, end) &&
- push8(value->pmi_flag, ppWritePackedMsg, end) &&
- push8(value->pmi, ppWritePackedMsg, end) &&
- push8(value->harq_resource_offset, ppWritePackedMsg, end) &&
- push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
- push8(value->tpc, ppWritePackedMsg, end) &&
- push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) &&
- push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
- push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
- push8(value->preamble_index, ppWritePackedMsg, end) &&
- push8(value->prach_mask_index, ppWritePackedMsg, end) &&
- push8(value->starting_ce_level, ppWritePackedMsg, end) &&
- push8(value->srs_request, ppWritePackedMsg, end) &&
- push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) &&
- push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) &&
- push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
- push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) &&
- push8(value->direct_indication, ppWritePackedMsg, end) &&
- push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
- push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
- pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
-
- return (push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push16(value->transmission_power, ppWritePackedMsg, end) &&
- push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
-
- return (push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push8(value->ncce_index, ppWritePackedMsg, end) &&
- push8(value->aggregation_level, ppWritePackedMsg, end) &&
- push8(value->start_symbol, ppWritePackedMsg, end) &&
- push8(value->rnti_type, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
- push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
- push8(value->dci_format, ppWritePackedMsg, end) &&
- push8(value->scheduling_delay, ppWritePackedMsg, end) &&
- push8(value->resource_assignment, ppWritePackedMsg, end) &&
- push8(value->repetition_number, ppWritePackedMsg, end) &&
- push8(value->mcs, ppWritePackedMsg, end) &&
- push8(value->new_data_indicator, ppWritePackedMsg, end) &&
- push8(value->harq_ack_resource, ppWritePackedMsg, end) &&
- push8(value->npdcch_order_indication, ppWritePackedMsg, end) &&
- push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) &&
- push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) &&
- push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) &&
- push8(value->direct_indication, ppWritePackedMsg, end) &&
- push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
- push8(value->total_dci_length_including_padding, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
-
- return (push16(value->length, ppWritePackedMsg, end) &&
- push16(value->pdu_index, ppWritePackedMsg, end) &&
- push8(value->start_symbol, ppWritePackedMsg, end) &&
- push8(value->rnti_type, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push16(value->resource_assignment, ppWritePackedMsg, end) &&
- push16(value->repetition_number, ppWritePackedMsg, end) &&
- push8(value->modulation, ppWritePackedMsg, end) &&
- push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) &&
- push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
- push16(value->sf_idx, ppWritePackedMsg, end) &&
- push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_dl_tti_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)tlv;
-
- if(!(push16(value->PDUSize, ppWritePackedMsg, end) &&
- push16(value->PDUType, ppWritePackedMsg, end) ))
- return 0;
-
-
- // first match the pdu type, then call the respective function
- switch(value->PDUType)
- {
- case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
- {
- if(!(pack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppWritePackedMsg,end)))
- return 0;
- }
- break;
-
- case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
- {
- if(!(pack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppWritePackedMsg,end)))
- return 0;
- }
- break;
- case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
- {
- if(!(pack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppWritePackedMsg,end)))
- return 0;
- }
- break;
- case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
- {
- if(!(pack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppWritePackedMsg,end)))
- return 0;
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType );
- }
- break;
- }
-
- return 1;
-}
-
-static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
-
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich);
-
- if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) &&
- push8(value->number_dci, ppWritePackedMsg, end) &&
- push16(value->number_pdu, ppWritePackedMsg, end) &&
- push8(value->number_pdsch_rnti, ppWritePackedMsg, end) &&
- push16(value->transmission_power_pcfich, ppWritePackedMsg, end)))
- {
- return 0;
- }
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_pdu;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
-
- if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
- if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
- {
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__);
-
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value)))
- {
- return 0;
- }
- }
- break;
- case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
- {
- //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__);
-
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel10_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) &&
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) &
- pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value)))
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
-
- if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) &&
- pusharray8(pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end)
- //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
- ))
- return 0;
-
- int arr[12];
- for(int i=0;idl_tti_request_body.nGroup;i++)
- {
- for(int j=0;jdl_tti_request_body.nUe[i];j++)
- {
- arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
- }
- if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end)))
- return 0;
- }
-
- for(int i=0;idl_tti_request_body.nPDUs;i++)
- {
- if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end))
- return 0;
- }
-
-return 1;
-}
-
-static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
-
- //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
- //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
- {
- uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
- uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value);
- uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
-
- if (!x || !y || !z)
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z);
- }
-
- return x && y && z;
- }
-}
-
-static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end)
-{
- nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
-
- return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
-
- return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
- push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
-
- return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
-
- return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
- push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
- push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end));
-}
-
-//Pack fns for ul_tti PDUS
-
-
-static uint8_t pack_ul_tti_request_prach_pdu(nfapi_nr_prach_pdu_t* prach_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return(
- push16(prach_pdu->phys_cell_id, ppWritePackedMsg, end) &&
- push8(prach_pdu->num_prach_ocas, ppWritePackedMsg, end) &&
- push8(prach_pdu->prach_format, ppWritePackedMsg, end) &&
- push8(prach_pdu->num_ra, ppWritePackedMsg, end) &&
- push8(prach_pdu->prach_start_symbol, ppWritePackedMsg, end) &&
- push16(prach_pdu->num_cs, ppWritePackedMsg, end)
- // TODO: ignoring beamforming tlv for now
- );
-
-}
-
-static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t* pucch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return(
- push16(pucch_pdu->rnti, ppWritePackedMsg, end) &&
- push32(pucch_pdu->handle, ppWritePackedMsg, end) &&
- push16(pucch_pdu->bwp_size, ppWritePackedMsg, end) &&
- push16(pucch_pdu->bwp_start, ppWritePackedMsg, end) &&
- push8(pucch_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
- push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
- push8(pucch_pdu->format_type, ppWritePackedMsg, end) &&
- push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) &&
- push16(pucch_pdu->prb_start, ppWritePackedMsg, end) &&
- push16(pucch_pdu->prb_size, ppWritePackedMsg, end) &&
- push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
- push8(pucch_pdu->nr_of_symbols, ppWritePackedMsg, end) &&
- push8(pucch_pdu->freq_hop_flag, ppWritePackedMsg, end) &&
- push16(pucch_pdu->second_hop_prb, ppWritePackedMsg, end) &&
- push8(pucch_pdu->group_hop_flag, ppWritePackedMsg, end) &&
- push8(pucch_pdu->sequence_hop_flag, ppWritePackedMsg, end) &&
- push16(pucch_pdu->hopping_id, ppWritePackedMsg, end) &&
- push16(pucch_pdu->initial_cyclic_shift, ppWritePackedMsg, end) &&
- push16(pucch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
- push8(pucch_pdu->time_domain_occ_idx, ppWritePackedMsg, end) &&
- push8(pucch_pdu->pre_dft_occ_idx, ppWritePackedMsg, end) &&
- push8(pucch_pdu->pre_dft_occ_len, ppWritePackedMsg, end) &&
- push8(pucch_pdu->add_dmrs_flag, ppWritePackedMsg, end) &&
- push16(pucch_pdu->dmrs_scrambling_id, ppWritePackedMsg, end) &&
- push8(pucch_pdu->dmrs_cyclic_shift, ppWritePackedMsg, end) &&
- push8(pucch_pdu->sr_flag, ppWritePackedMsg, end) &&
- push8(pucch_pdu->bit_len_harq, ppWritePackedMsg, end) &&
- push16(pucch_pdu->bit_len_csi_part1, ppWritePackedMsg, end) &&
- push16(pucch_pdu->bit_len_csi_part2, ppWritePackedMsg, end)
- // TODO: ignoring beamforming tlv for now
- );
-
-}
-
-
-static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t* pusch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
-
- if (!(
- push16(pusch_pdu->pdu_bit_map, ppWritePackedMsg, end) &&
- push16(pusch_pdu->rnti, ppWritePackedMsg, end) &&
- push32(pusch_pdu->handle, ppWritePackedMsg, end) &&
- push16(pusch_pdu->bwp_size, ppWritePackedMsg, end) &&
- push16(pusch_pdu->bwp_start, ppWritePackedMsg, end) &&
- push8(pusch_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
- push8(pusch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
- push16(pusch_pdu->target_code_rate, ppWritePackedMsg, end) &&
- push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) &&
- push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) &&
- push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) &&
- push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) &&
- push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
- push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) &&
- push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) &&
- push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) &&
- push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) &&
- push8(pusch_pdu->scid, ppWritePackedMsg, end) &&
- push8(pusch_pdu->num_dmrs_cdm_grps_no_data, ppWritePackedMsg, end) &&
- push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) &&
- push8(pusch_pdu->resource_alloc, ppWritePackedMsg, end) &&
- push8(pusch_pdu->resource_alloc,ppWritePackedMsg, end) &&
- push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) &&
- push16(pusch_pdu->rb_start, ppWritePackedMsg, end) &&
- push16(pusch_pdu->rb_size, ppWritePackedMsg, end) &&
- push8(pusch_pdu->vrb_to_prb_mapping, ppWritePackedMsg, end) &&
- push8(pusch_pdu->frequency_hopping, ppWritePackedMsg, end) &&
- push16(pusch_pdu->tx_direct_current_location, ppWritePackedMsg, end) &&
- push8(pusch_pdu->uplink_frequency_shift_7p5khz, ppWritePackedMsg, end) &&
- push8(pusch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
- push8(pusch_pdu->nr_of_symbols, ppWritePackedMsg, end)
- // TODO: ignoring beamforming tlv for now
- ))
- return 0;
-
-
- //Pack Optional Data only included if indicated in pduBitmap
- switch(pusch_pdu->pdu_bit_map){
- case PUSCH_PDU_BITMAP_PUSCH_DATA:
- {
- // pack optional TLVs
- return(
- push8(pusch_pdu->pusch_data.rv_index, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_data.harq_process_id, ppWritePackedMsg, end) &&
- push32(pusch_pdu->pusch_data.tb_size, ppWritePackedMsg, end) &&
- push16(pusch_pdu->pusch_data.num_cb, ppWritePackedMsg, end) &&
- pusharray8(pusch_pdu->pusch_data.cb_present_and_position,1,1,ppWritePackedMsg, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_PUSCH_UCI:
- {
- return(
- push16(pusch_pdu->pusch_uci.harq_ack_bit_length, ppWritePackedMsg, end) &&
- push16(pusch_pdu->pusch_uci.csi_part1_bit_length, ppWritePackedMsg, end) &&
- push16(pusch_pdu->pusch_uci.csi_part2_bit_length, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_uci.alpha_scaling, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_uci.beta_offset_harq_ack, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_uci.beta_offset_csi1, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_uci.beta_offset_csi2, ppWritePackedMsg, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_PUSCH_PTRS:
- {
- return(
- push8(pusch_pdu->pusch_ptrs.num_ptrs_ports, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, ppWritePackedMsg, end) &&
- push16(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ptrs_time_density, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ptrs_freq_density, ppWritePackedMsg, end) &&
- push8(pusch_pdu->pusch_ptrs.ul_ptrs_power, ppWritePackedMsg, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_DFTS_OFDM:
- {
- return(
- push8(pusch_pdu->dfts_ofdm.low_papr_group_number, ppWritePackedMsg, end) &&
- push16(pusch_pdu->dfts_ofdm.low_papr_sequence_number, ppWritePackedMsg, end) &&
- push8(pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, ppWritePackedMsg, end) &&
- push8(pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, ppWritePackedMsg, end)
- );
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map );
- }
- }
-
- return 1;
-}
-
-static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t* srs_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return(
- push16(srs_pdu->rnti, ppWritePackedMsg, end) &&
- push32(srs_pdu->handle, ppWritePackedMsg, end) &&
- push16(srs_pdu->bwp_size, ppWritePackedMsg, end) &&
- push16(srs_pdu->bwp_start, ppWritePackedMsg, end) &&
- push8(srs_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
- push8(srs_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
- push8(srs_pdu->num_ant_ports, ppWritePackedMsg, end) &&
- push8(srs_pdu->num_symbols, ppWritePackedMsg, end) &&
- push8(srs_pdu->num_repetitions, ppWritePackedMsg, end) &&
- push8(srs_pdu->time_start_position, ppWritePackedMsg, end) &&
- push8(srs_pdu->config_index, ppWritePackedMsg, end) &&
- push16(srs_pdu->sequence_id, ppWritePackedMsg, end) &&
- push8(srs_pdu->bandwidth_index, ppWritePackedMsg, end) &&
- push8(srs_pdu->comb_size, ppWritePackedMsg, end) &&
- push8(srs_pdu->comb_offset, ppWritePackedMsg, end) &&
- push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) &&
- push8(srs_pdu->frequency_position, ppWritePackedMsg, end) &&
- push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) &&
- push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) &&
- push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) &&
- push8(srs_pdu->resource_type, ppWritePackedMsg, end) &&
- push16(srs_pdu->t_srs, ppWritePackedMsg, end) &&
- push16(srs_pdu->t_offset, ppWritePackedMsg, end)
-
- // TODO: ignoring beamforming tlv for now
- );
-
-}
-
-static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value));
-}
-
-static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
-
- return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
-
- if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end)))
- {
- return 0;
- }
-
- switch(cqi_ri_info_rel9->report_type)
- {
- case NFAPI_CSI_REPORT_TYPE_PERIODIC:
- {
- if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) &&
- push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end)))
- {
- return 0;
- }
- }
- break;
- case NFAPI_CSI_REPORT_TYPE_APERIODIC:
- {
- if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint8_t i;
- for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
- {
- if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint8_t j;
- for(j = 0; j < 8; ++j)
- {
- if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0)
- return 0;
- }
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
- }
- break;
- };
-
- return 1;
-}
-
-static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
-
- switch(cqi_ri_info_rel13->report_type)
- {
- case NFAPI_CSI_REPORT_TYPE_PERIODIC:
- {
- if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0)
- return 0;
- }
- break;
- case NFAPI_CSI_REPORT_TYPE_APERIODIC:
- {
- // No parameters
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type );
- }
- break;
- };
-
- return 1;
-}
-
-static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value));
-
-}
-
-static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
-
- return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) &&
- push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value);
-}
-
-static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
-
- return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) &&
- push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) &&
- push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
-
- return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value));
-}
-
-static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
-
- return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) &&
- push16(ue_info_rel8->rnti, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
-
- return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
- push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
-
- return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) &&
- push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) &&
- push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
- push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value));
-}
-
-static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
-
- return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) &&
- push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) &&
- push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
- push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) &&
- push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) &&
- push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) &&
- push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
-
- return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
- push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
-
- return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) &&
- push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) &&
- push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
- push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
- push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) &&
- push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) &&
- push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
-
- return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) &&
- push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) &&
- push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) &&
- push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) &&
- push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
-
- return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) &&
- push8(harq_info_rel13->n_srs, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value));
-
-}
-
-static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
-
- return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) &&
- push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
-
- return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) &&
- push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
-}
-static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
-
- return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) &&
- push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) &&
- push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) &&
- push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) &&
- push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) &&
- push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value));
-
-}
-
-static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
- return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end);
-}
-static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
-
- return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) &&
- push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value));
-}
-
-static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
-
- return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) &&
- push16(srs_pdu_rel8->size, ppWritePackedMsg, end) &&
- push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) &&
- push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
- return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end);
-}
-
-static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
-
- return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
-
- return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
-
- return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) &&
- push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) &&
- push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) &&
- push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
- push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) &&
- push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
- push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) &&
- pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value));
-}
-static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
-
- return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) &&
- push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) &&
- push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end));
-
-}
-
-static uint8_t pack_ul_tti_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_ul_tti_request_number_of_pdus_t* value = (nfapi_nr_ul_tti_request_number_of_pdus_t*)tlv;
-
- if(!(push16(value->pdu_size, ppWritePackedMsg, end) &&
- push16(value->pdu_type, ppWritePackedMsg, end) ))
- return 0;
-
-
- // first match the pdu type, then call the respective function
- switch(value->pdu_type)
- {
- case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
- {
- if(!pack_ul_tti_request_prach_pdu(&value->prach_pdu, ppWritePackedMsg, end))
- return 0;
- }
- break;
-
- case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
- {
- if(!pack_ul_tti_request_pucch_pdu(&value->pucch_pdu, ppWritePackedMsg, end))
- return 0;
- }
- break;
- case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
- {
- if(!pack_ul_tti_request_pusch_pdu(&value->pusch_pdu, ppWritePackedMsg, end))
- return 0;
- }
- break;
- case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
- {
- if(!pack_ul_tti_request_srs_pdu(&value->srs_pdu, ppWritePackedMsg, end))
- return 0;
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", value->pdu_type );
- }
- break;
- }
-
- return 1;
-}
-
-static uint8_t pack_ul_tti_groups_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_ul_tti_request_number_of_groups_t* value = (nfapi_nr_ul_tti_request_number_of_groups_t*)tlv;
-
- if(!push8(value->n_ue, ppWritePackedMsg, end))
- return 0;
- for(int i=0; in_ue;i++)
- {
- if(!push8(value->ue_list[i].pdu_idx, ppWritePackedMsg, end))
- return 0;
- }
- return 1;
-}
-
-static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
-
- if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) &&
- push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) &&
- push8(value->srs_present, ppWritePackedMsg, end)))
- return 0;
-
- uint16_t i = 0;
- for(i = 0; i < value->number_of_pdus; ++i)
- {
- nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
-
- if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
- if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
- {
- if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
- {
- if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
- pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) &&
- pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value)))
- return 0;
- }
- break;
- case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value)))
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
-
- }
- return 1;
-}
-
-static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg;
-
- if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->n_pdus , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->n_group, ppWritePackedMsg, end) ))
- return 0;
-
- for(int i=0; in_pdus; i++)
- {
- if(!pack_ul_tti_pdu_list_value(&pNfapiMsg->pdus_list[i], ppWritePackedMsg, end))
- return 0;
- }
-
- for(int i=0; in_group; i++)
- {
- if(!pack_ul_tti_groups_list_value(&pNfapiMsg->groups_list[i], ppWritePackedMsg, end))
- return 0;
-
- }
-
- return 1;
-}
-
-static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ;
-}
-
-static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
-
- return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
- push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
- push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) &&
- push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) &&
- push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
-
- return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) &&
- push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
-
- return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) &&
- push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) &&
- push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) &&
- push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
-
- return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
- push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
-
- return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) &&
- push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
-
- return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) &&
- push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) &&
- push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) &&
- push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
- push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
- push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) &&
- push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
- pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end));
-
-}
-
-static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
-
- return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
- push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) &&
- push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
-
- if(!(push16(value->sfnsf, ppWritePackedMsg, end) &&
- push8(value->number_of_dci, ppWritePackedMsg, end) &&
- push8(value->number_of_hi, ppWritePackedMsg, end)))
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
-
- if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
- if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_HI_DCI0_HI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value)))
- return 0;
- }
- break;
- case NFAPI_HI_DCI0_DCI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value)))
- return 0;
- }
- break;
- case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value)))
- return 0;
- }
- break;
- case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value)))
- return 0;
- }
- break;
- case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
- {
- if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value)))
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
-
- }
-
- return 1;
-}
-
-static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv;
-
- for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
- {
- if(!(push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, ppWritePackedMsg, end) &&
-
- push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) &&
-
- push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
-
- pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
-
- return 0;
- }
-
- return (push16(value->PDUType, ppWritePackedMsg, end) &&
- push16(value->PDUSize, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, ppWritePackedMsg, end) &&
-
- push8(value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, ppWritePackedMsg, end) &&
- pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, ppWritePackedMsg, end) &&
-
- push8(value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, ppWritePackedMsg, end) &&
- push8(value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, ppWritePackedMsg, end) &&
- push16(value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, ppWritePackedMsg, end));
-
-}
-
-static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg;
-
- if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
- push8(pNfapiMsg->numPdus, ppWritePackedMsg, end)
- ))
- return 0;
-
- for(int i=0; inumPdus; i++)
- {
- if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end))
- return 0;
- }
- return 1;
-
-
-}
-
-static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-//pack_tx_data_pdu_list_value
-static uint8_t pack_tx_data_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_pdu_t* value = (nfapi_nr_pdu_t*)tlv;
-
- if(!(push32(value->num_TLV, ppWritePackedMsg, end) &&
- push16(value->PDU_index, ppWritePackedMsg, end) &&
- push16(value->PDU_length, ppWritePackedMsg, end)
- ))
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_tlvs = value->num_TLV;
- for(; i < total_number_of_tlvs; ++i)
- {
-
- if (!(push16(value->TLVs[i].length, ppWritePackedMsg, end) &&
- push16(value->TLVs[i].tag, ppWritePackedMsg, end)))
- return 0;
-
- switch(value->TLVs[i].tag)
- {
- case 0:
- {
- if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end))
- return 0;
- break;
-
- }
-
- case 1:
- {
- if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length , value->TLVs[i].length, ppWritePackedMsg, end))
- return 0;
- break;
-
- }
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", value->TLVs[i].tag );
- break;
- }
-
- }
- }
- return 1;
-}
-
-static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv;
-
- if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]);
-
- if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) &&
- push16(pdu->pdu_index, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t j;
- for(j = 0; j < pdu->num_segments; ++j)
- {
- // Use -1 as it is unbounded
- // DJP - does not handle -1
- // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
- int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
-
- if (pdu->segments[j].segment_length == 3)
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
- pdu->segments[j].segment_data[0],
- pdu->segments[j].segment_data[1],
- pdu->segments[j].segment_data[2]
- );
- }
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret);
-
- if (push_ret == 0)
- {
- return 0;
- }
- }
- }
-
- return 1;
-}
-
-static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg;
-
- if (!(
- push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
- push16(pNfapiMsg->Number_of_PDUs, ppWritePackedMsg, end)
- ))
- return 0;
-
- for(int i=0; iNumber_of_PDUs; i++)
- {
- if(!pack_tx_data_pdu_list_value(&pNfapiMsg->pdu_list[i], ppWritePackedMsg, end))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
-
- int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
- int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value);
- int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
-
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z);
-
- return x && y && z;
-}
-
-static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
- if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
- return 0;
- }
-
- uint8_t j;
- uint16_t num = value->number_of_TLVs;
- for(j = 0; j < num; ++j){
- if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
- return 0;
- }
- }
- return 1;
-}
-
-static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
- int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
- int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
- int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
- return x && y && z;
-}
-
-static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
-
- nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
-
- int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
- int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
- return x && z;
-}
-
-static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) );
-}
-
-static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
-
- return ( pull32(ppReadPackedMsg, &value->handle, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end));
-}
-
-static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(data->value_0, ppWritePackedMsg, end) &&
- push8(data->value_1, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(data->value_0, ppWritePackedMsg, end) &&
- push8(data->value_1, ppWritePackedMsg, end) &&
- push8(data->value_2, ppWritePackedMsg, end) &&
- push8(data->value_3, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(data->value_0, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- return ( push8(data->value_0, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv;
-
- if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) &&
- push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t result = 0;
- switch(harq_indication_tdd_rel8->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = 1;
- break;
- default:
- // err....
- break;
- }
-
- return result;
-
-}
-
-static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv;
-
- if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) &&
- push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t idx;
- for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx)
- {
- uint8_t result = 0;
-
- switch(harq_indication_tdd_rel9->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end);
- break;
- default:
- // err....
- break;
- }
-
- if(result == 0)
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv;
-
- if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) &&
- push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t idx;
- for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx)
- {
- uint8_t result = 0;
- switch(harq_indication_tdd_rel13->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
- result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end);
- break;
- default:
- // err....
- break;
- }
-
- if(result == 0)
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv;
-
- return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) &&
- push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv;
-
- return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) &&
- push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) &&
- pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv;
-
- return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) &&
- push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) &&
- pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
-
- return ( push8(value->ul_cqi, ppWritePackedMsg, end) &&
- push8(value->channel, ppWritePackedMsg, end));
-
-}
-
-static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
-
- if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_harqs;
- assert(total_number_of_pdus <= NFAPI_HARQ_IND_MAX_PDU);
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) &&
- pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) &&
- pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
-
- return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
-
- if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_crcs;
- assert(total_number_of_pdus <= NFAPI_CRC_IND_MAX_PDU);
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
- return 1;
-}
-
-static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-
-}
-static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
-
- return ( push16(value->length, ppWritePackedMsg, end) &&
- push16(value->offset, ppWritePackedMsg, end) &&
- push8(value->ul_cqi, ppWritePackedMsg, end) &&
- push16(value->timing_advance, ppWritePackedMsg, end));
-}
-static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
-
- return ( push16(value->timing_advance_r9, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
-
- //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "RX ULSCH BODY\n");
-
- if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
- return 0;
-
- // need to calculate the data offset's.
- uint16_t i = 0;
- uint16_t offset = 2; // taking into account the number_of_pdus
- uint16_t total_number_of_pdus = value->number_of_pdus;
- //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "ULSCH:pdus:%d\n", total_number_of_pdus);
-
- assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
- if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
- {
- //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_UE_INFORMATION_TAG\n");
- offset += 4 + 6;
- }
-
- if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
- {
- //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_INDICATION_REL8_TAG\n");
- offset += 4 + 7;
- }
-
- if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG)
- {
- //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_INDICATION_REL9_TAG\n");
- offset += 4 + 2;
- }
- }
-
- // Now update the structure to include the offset
- assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
- for(i =0; i < total_number_of_pdus; ++i)
- {
- nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
-
- if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
- {
- if(pdu->rx_indication_rel8.offset == 1)
- {
- pdu->rx_indication_rel8.offset = offset;
- offset += pdu->rx_indication_rel8.length;
- }
- }
- }
-
- // Write out the pdu
- assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) &&
- pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value)))
- return 0;
- }
-
- // Write out the pdu data
- assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- uint16_t length = 0;
- nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
-
- if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
- {
- length = pdu->rx_indication_rel8.length;
- }
-
- if( pusharray8(value->rx_pdu_list[i].rx_ind_data, NFAPI_RX_IND_DATA_MAX, length, ppWritePackedMsg, end) == 0)
- return 0;
- }
- return 1;
-}
-
-
-static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
-
- return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) &&
- push8(preamble_rel8->preamble, ppWritePackedMsg, end) &&
- push16(preamble_rel8->timing_advance, ppWritePackedMsg, end));
-}
-static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
-
- return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) );
-}
-static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
-
- return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
-
- if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_preambles;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) &&
- pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) &&
- pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
-
- return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) &&
- push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
- push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) &&
- pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
-
- return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
-
- return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) );
-
-}
-
-static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
-
- return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ;
-}
-
-static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
-
- if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
- push8(value->number_of_subbands, ppWritePackedMsg, end) &&
- push8(value->num_atennas, ppWritePackedMsg, end)))
- return 0;
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_subbands; ++idx)
- {
- if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) &&
- pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end)))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv;
-
- if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_ues;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) &&
- pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) &&
- pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) &&
- pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) &&
- pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-
-}
-
-static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
-
- if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_srs;
- assert(total_number_of_pdus <= NFAPI_SR_IND_MAX_PDU);
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
- return 1;
-}
-
-static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-
-}
-
-static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
-
- return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) &&
- push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) &&
- push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
-
- return ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) &&
- push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) &&
- push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
- pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) &&
- push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
-
- if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0)
- return 0;
-
- // need to calculate the data offset's. This very bittle due the hardcoding
- // of the sizes. can not use the sizeof as we have an array for the Rel9
- // info
- uint16_t i = 0;
- uint16_t offset = 2; // taking into account the number_of_cqis
- uint16_t total_number_of_pdus = value->number_of_cqis;
- assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
-
- offset += 2; // for the instance length
-
- if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
- {
- offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t)
- }
-
- if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
- {
- offset += 4 + 8;
- }
-
- if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
- {
- offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported;
- }
-
- if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG)
- {
- offset += 4 + 2;
- }
- }
-
- // Now update the structure to include the offset
- assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
- for(i =0; i < total_number_of_pdus; ++i)
- {
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
-
- if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
- {
- if(pdu->cqi_indication_rel8.data_offset == 1)
- {
- pdu->cqi_indication_rel8.data_offset = offset;
- offset += pdu->cqi_indication_rel8.length;
- }
- }
-
- if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
- {
- if(pdu->cqi_indication_rel9.data_offset == 1)
- {
- pdu->cqi_indication_rel9.data_offset = offset;
- offset += pdu->cqi_indication_rel9.length;
- }
- }
-
- }
-
- // Write out the cqi information
- assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) &&
- pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) &&
- pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
-
- }
-
- // Write out the cqi raw data
- assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- uint16_t length = 0;
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
-
- if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
- {
- length = pdu->cqi_indication_rel8.length;
- }
-
- if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
- {
- length = pdu->cqi_indication_rel9.length;
- }
-
- if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0)
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-
-}
-
-static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push32(value->mp_cca, ppWritePackedMsg, end) &&
- push32(value->n_cca, ppWritePackedMsg, end) &&
- push32(value->offset, ppWritePackedMsg, end) &&
- push32(value->lte_txop_sf, ppWritePackedMsg, end) &&
- push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) &&
- push32(value->lbt_mode, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push32(value->offset, ppWritePackedMsg, end) &&
- push16(value->sfn_sf_end, ppWritePackedMsg, end) &&
- push32(value->lbt_mode, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
-
- if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
-
- if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
- if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
- {
- if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0)
- return 0;
- }
- break;
- case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
- {
- if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0)
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push32(value->result, ppWritePackedMsg, end) &&
- push32(value->lte_txop_symbols, ppWritePackedMsg, end) &&
- push32(value->initial_partial_sf, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
-
- return ( push32(value->handle, ppWritePackedMsg, end) &&
- push32(value->result, ppWritePackedMsg, end));
-}
-
-static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
-
- if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(; i < total_number_of_pdus; ++i)
- {
- nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
-
- if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
- return 0;
-
- // Put a 0 size in and then determine the size after the pdu
- // has been writen and write the calculated size
- uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
- pdu->pdu_size = 0;
-
- if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
- {
- if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0)
- return 0;
- }
- break;
- case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
- {
- if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0)
- return 0;
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
-
- // add 1 for the pdu_type. The delta will include the pdu_size
- pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
- push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
-
- return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) );
-}
-
-static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
-
- if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_harqs = value->number_of_harqs;
- for(; i < total_number_of_harqs; ++i)
- {
- nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
-
- uint8_t* instance_length_p = *ppWritePackedMsg;
- if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- return 0;
-
- if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
- pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) &&
- pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-
-static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
-
- return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) &&
- push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) &&
- push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) &&
- push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end));
-}
-
-
-static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
-
- if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0)
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected;
- for(; i < total_number_of_initial_scs_detected; ++i)
- {
- nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
-
- //uint8_t* instance_length_p = *ppWritePackedMsg;
- //if(!push16(pdu->instance_length, ppWritePackedMsg, end))
- // return 0;
-
- if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value)))
- return 0;
-
- // calculate the instance length subtracting the size of the instance
- // length feild
- //uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
- //push16(instance_length, &instance_length_p, end);
- }
-
- return 1;
-}
-
-static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
-
- return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
- pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg;
-
- return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
-
- return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg;
-
- return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
-
- return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
-
- return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg;
-
- return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) &&
- push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) &&
- pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) &&
- pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
-}
-
-
-//NR UPLINK indication function packing
-
-//RX DATA INDICATION
-
-static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_rx_data_pdu_t* value = (nfapi_nr_rx_data_pdu_t*)tlv;
-
- if(!(push32(value->handle, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->harq_id, ppWritePackedMsg, end) &&
- push16(value->pdu_length, ppWritePackedMsg, end) &&
- push8(value->ul_cqi, ppWritePackedMsg, end) &&
- push16(value->timing_advance, ppWritePackedMsg, end) &&
- push16(value->rssi, ppWritePackedMsg, end)
- ))
- return 0;
-
- if(pusharray8(value->pdu, value->pdu_length, value->pdu_length, ppWritePackedMsg, end) == 0)
- return 0;
-
- return 1;
-}
-
-static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
-
- if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
- ))
- return 0;
-
- for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
- {
- if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
- return 0;
- }
-
- return 1;
-}
-
-//NR CRC INDICATION
-
-static uint8_t pack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
-
- if(!(push32(value->handle, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->harq_id, ppWritePackedMsg, end) &&
- push8(value->tb_crc_status, ppWritePackedMsg, end) &&
- push16(value->num_cb, ppWritePackedMsg, end) &&
- //pusharray8(value->cb_crc_status, (int)(value->num_cb / 8) + 1, (int)(value->num_cb / 8) + 1, ppWritePackedMsg, end) && //length is ceil(NumCb/8)
- push8(value->ul_cqi, ppWritePackedMsg, end) &&
- push16(value->timing_advance, ppWritePackedMsg, end) &&
- push16(value->rssi, ppWritePackedMsg, end)
- ))
- return 0;
-
- return 1;
-}
-
-static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
-
- if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->number_crcs, ppWritePackedMsg, end)
- ))
- return 0;
-
- for (int i = 0; i < pNfapiMsg->number_crcs; i++)
- {
- if(!pack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppWritePackedMsg, end))
- return 0;
- }
-
-return 1;
-}
-
-//SRS INDICATION
-
-static uint8_t pack_nr_srs_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_srs_indication_pdu_t* value = (nfapi_nr_srs_indication_pdu_t*)tlv;
-
- if(!(push32(value->handle, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push16(value->timing_advance, ppWritePackedMsg, end) &&
- push8(value->num_symbols, ppWritePackedMsg, end) &&
- push8(value->wide_band_snr, ppWritePackedMsg, end) &&
- push8(value->num_reported_symbols, ppWritePackedMsg, end) &&
- push8(value->reported_symbol_list->num_rbs, ppWritePackedMsg, end)
- ))
- return 0;
- for(int i = 0; i < value->reported_symbol_list->num_rbs; i++)
- {
- if(!(push8(value->reported_symbol_list->rb_list->rb_snr, ppWritePackedMsg, end)
- ))
- return 0;
- }
- return 1;
-}
-
-static uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
-
- if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
- ))
- return 0;
-
- for(int i=0; inumber_of_pdus;i++)
- {
- if(!pack_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
- return 0;
- }
-
-return 1;
-}
-
-//RACH INDICATION
-
-static uint8_t pack_nr_rach_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
-
- if(!(push16(value->phy_cell_id, ppWritePackedMsg, end) &&
- push8(value->symbol_index, ppWritePackedMsg, end) &&
- push8(value->slot_index, ppWritePackedMsg, end) &&
- push8(value->freq_index, ppWritePackedMsg, end) &&
- push8(value->avg_rssi, ppWritePackedMsg, end) &&
- push8(value->avg_snr, ppWritePackedMsg, end) &&
- push8(value->num_preamble, ppWritePackedMsg, end)
- ))
- return 0;
- for(int i = 0; i < value->num_preamble; i++)
- {
- if(!(push8(value->preamble_list[i].preamble_index, ppWritePackedMsg, end) &&
- push16(value->preamble_list[i].timing_advance, ppWritePackedMsg, end) &&
- push32(value->preamble_list[i].preamble_pwr, ppWritePackedMsg, end)
- ))
- return 0;
- }
- return 1;
-}
-
-static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
-
- if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
- push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
- ))
- return 0;
-
- for(int i=0; inumber_of_pdus;i++)
- {
- if(!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
- return 0;
- }
-
-return 1;
-}
-
-
-//UCI INDICATION
-
-static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
-
- if(!(push8(value->pduBitmap, ppWritePackedMsg, end) &&
- push32(value->handle, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->pucch_format, ppWritePackedMsg, end) &&
- push8(value->ul_cqi, ppWritePackedMsg, end) &&
- push16(value->timing_advance, ppWritePackedMsg, end) &&
- push16(value->rssi, ppWritePackedMsg, end)
- ))
- return 0;
- if (value->pduBitmap & 0x01) { //SR
- if (!(push8(value->sr->sr_indication, ppWritePackedMsg, end) &&
- push8(value->sr->sr_confidence_level, ppWritePackedMsg, end)
- ))
- return 0;
- }
-
- if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
- if (!(push8(value->harq->num_harq, ppWritePackedMsg, end) &&
- push8(value->harq->harq_confidence_level, ppWritePackedMsg, end)
- ))
- return 0;
- for (int i = 0; i < value->harq->num_harq; i++)
- {
- if (!(push8(value->harq->harq_list[i].harq_value, ppWritePackedMsg, end)
- ))
- return 0;
- }
- }
-
- return 1;
-}
-
-static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
- nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
-
- if(!(push8(value->pduBitmap, ppWritePackedMsg, end) &&
- push32(value->handle, ppWritePackedMsg, end) &&
- push16(value->rnti, ppWritePackedMsg, end) &&
- push8(value->pucch_format, ppWritePackedMsg, end) &&
- push8(value->ul_cqi, ppWritePackedMsg, end) &&
- push16(value->timing_advance, ppWritePackedMsg, end) &&
- push16(value->rssi, ppWritePackedMsg, end)
- ))
- return 0;
-
- if (value->pduBitmap & 0x01) { //SR
- if(!(push8(value->sr.sr_bit_len, ppWritePackedMsg, end) &&
- pusharray8(value->sr.sr_payload, (int)(value->sr.sr_bit_len / 8) + 1, (int)(value->sr.sr_bit_len / 8) + 1, ppWritePackedMsg, end)
- ))
- return 0;
- }
-
- if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
- if(!(push8(value->harq.harq_crc, ppWritePackedMsg, end) &&
- push8(value->harq.harq_bit_len, ppWritePackedMsg, end) &&
- pusharray8(value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8) + 1, (int)(value->harq.harq_bit_len / 8) + 1, ppWritePackedMsg, end)
- ))
- return 0;
- }
-
- if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
- if(!(push8(value->csi_part1.csi_part1_crc, ppWritePackedMsg, end) &&
- push8(value->csi_part1.csi_part1_bit_len, ppWritePackedMsg, end) &&
- pusharray8(value->csi_part1.csi_part1_payload, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, ppWritePackedMsg, end)
- ))
- return 0;
- }
-
- if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
- if(!(push8(value->csi_part2.csi_part2_crc, ppWritePackedMsg, end) &&
- push8(value->csi_part2.csi_part2_bit_len, ppWritePackedMsg, end) &&
- pusharray8(value->csi_part2.csi_part2_payload, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, ppWritePackedMsg, end)
- ))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
-{
- nfapi_nr_uci_t* value = (nfapi_nr_uci_t*)tlv;
-
- if(!(push16(value->pdu_type, ppWritePackedMsg, end) &&
- push16(value->pdu_size, ppWritePackedMsg, end)
- ))
- return 0;
-
- switch (value->pdu_type) {
- case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
- NFAPI_TRACE(NFAPI_TRACE_WARN, "Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
- break;
-
- case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
- nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &value->pucch_pdu_format_0_1;
- if (!pack_nr_uci_pucch_0_1(uci_pdu, ppWritePackedMsg, end))
- return 0;
- break;
- }
- case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
- nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
- if (!pack_nr_uci_pucch_2_3_4(uci_pdu, ppWritePackedMsg, end))
- return 0;
- break;
- }
- }
-
- return 1;
-}
-
-static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
-
- if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
- push16(pNfapiMsg->num_ucis, ppWritePackedMsg, end)
- ))
- return 0;
-
- for (int i = 0; i < pNfapiMsg->num_ucis; i++)
- {
- if (!pack_nr_uci_indication_body(&(pNfapiMsg->uci_list[i]), ppWritePackedMsg, end))
- return 0;
- }
-
-return 1;
-}
-
-// Main pack function - public
-
-int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
-{
- nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
- uint8_t *pWritePackedMessage = pPackedBuf;
- uint8_t *pPackedLengthField = &pWritePackedMessage[4];
- uint8_t *end = pPackedBuf + packedBufLen;
-
- if (pMessageBuf == NULL || pPackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
- return -1;
- }
- // process the header
- if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
- push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
- push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
- push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
- push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
- push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
- return -1;
- }
-
- if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
- }
- // look for the specific message
- uint8_t result = 0;
- switch (pMessageHeader->message_id)
- {
- case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
- result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
- NFAPI_TRACE(NFAPI_TRACE_DEBUG, "result of pack dl_tti_req is %d. \n",result);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
- result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
- case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
- result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
- case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
- result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
- result = pack_nr_rx_data_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
- result = pack_nr_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
- result = pack_nr_uci_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
- result = pack_nr_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
- result = pack_nr_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
- result = pack_nr_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
- result = pack_nr_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_TIMING_INFO:
- result = pack_nr_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- default:
- {
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
- {
- if(config && config->pack_p7_vendor_extension)
- {
- result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- break;
- }
-
- if(result == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
- return -1;
- }
-
- // check for a valid message length
- uintptr_t msgHead = (uintptr_t)pPackedBuf;
- uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
- uint32_t packedMsgLen = msgEnd - msgHead;
- uint16_t packedMsgLen16;
- if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
- return -1;
- }
- else
- {
- packedMsgLen16 = (uint16_t)packedMsgLen;
- }
-
- // Update the message length in the header
- pMessageHeader->message_length = packedMsgLen16;
-
- if(!push16(packedMsgLen16, &pPackedLengthField, end))
- return -1;
-
- if(1)
- {
- //quick test
- if(pMessageHeader->message_length != packedMsgLen)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
- }
- }
-
- return (packedMsgLen);
-}
-
-int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
-{
- nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
- uint8_t *pWritePackedMessage = pPackedBuf;
- uint8_t *pPackedLengthField = &pWritePackedMessage[4];
- uint8_t *end = pPackedBuf + packedBufLen;
-
- if (pMessageBuf == NULL || pPackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
- return -1;
- }
- // process the header
- if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
- push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
- push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
- push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
- push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
- push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
- return -1;
- }
-
- if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
- {
- //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
- }
- // look for the specific message
- uint8_t result = 0;
- switch (pMessageHeader->message_id)
- {
- case NFAPI_DL_CONFIG_REQUEST:
- result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UL_CONFIG_REQUEST:
- result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
- case NFAPI_TX_REQUEST:
- result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
- case NFAPI_HI_DCI0_REQUEST:
- result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_HARQ_INDICATION:
- result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_CRC_INDICATION:
- result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RACH_INDICATION:
- result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_SRS_INDICATION:
- result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_SR_INDICATION:
- result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_NRACH_INDICATION:
- result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_DL_NODE_SYNC:
- result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_UL_NODE_SYNC:
- result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- case NFAPI_TIMING_INFO:
- result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
- break;
-
- default:
- {
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
- {
- if(config && config->pack_p7_vendor_extension)
- {
- result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- break;
- }
-
- if(result == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
- return -1;
- }
-
- // check for a valid message length
- uintptr_t msgHead = (uintptr_t)pPackedBuf;
- uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
- uint32_t packedMsgLen = msgEnd - msgHead;
- uint16_t packedMsgLen16;
- if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
- return -1;
- }
- else
- {
- packedMsgLen16 = (uint16_t)packedMsgLen;
- }
-
- // Update the message length in the header
- pMessageHeader->message_length = packedMsgLen16;
-
- if(!push16(packedMsgLen16, &pPackedLengthField, end))
- return -1;
-
- if(1)
- {
- //quick test
- if(pMessageHeader->message_length != packedMsgLen)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
- }
- }
-
- return (packedMsgLen);
-}
-
-// Unpack routines
-// NR:
-static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &value->bwp_size, end) &&
- pull16(ppReadPackedMsg, &value->bwp_start, end) &&
-
- pull8(ppReadPackedMsg, &value->subcarrier_spacing, end) &&
- pull8(ppReadPackedMsg, &value->cyclic_prefix, end) &&
-
- pull16(ppReadPackedMsg, &value->start_rb, end) &&
- pull16(ppReadPackedMsg, &value->nr_of_rbs, end) &&
-
- pull8(ppReadPackedMsg, &value->csi_type, end) &&
- pull8(ppReadPackedMsg, &value->row, end) &&
-
- pull16(ppReadPackedMsg, &value->freq_domain, end) &&
- pull8(ppReadPackedMsg, &value->symb_l0, end) &&
-
- pull8(ppReadPackedMsg, &value->symb_l1, end) &&
- pull8(ppReadPackedMsg, &value->cdm_type, end) &&
-
- pull8(ppReadPackedMsg, &value->freq_density, end) &&
- pull16(ppReadPackedMsg, &value->scramb_id, end) &&
-
- pull8(ppReadPackedMsg, &value->power_control_offset, end) &&
- pull8(ppReadPackedMsg, &value->power_control_offset_ss, end)
- );
-
-}
-
-
-static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
-
- for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
- {
- if(!(pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) &&
- pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingId, end) &&
-
- pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingRNTI, end) &&
- pull8(ppReadPackedMsg, &value->dci_pdu[i].CceIndex, end) &&
- pull8(ppReadPackedMsg, &value->dci_pdu[i].AggregationLevel, end) &&
- pull8(ppReadPackedMsg, &value->dci_pdu[i].beta_PDCCH_1_0, end) &&
-
- pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) &&
- pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) &&
-
- pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, end)))
-
- return 0;
- }
-
- // TODO: resolve the packaging of array (currently sending a single element)
- return(
- pull16(ppReadPackedMsg, &value->BWPSize, end) &&
- pull16(ppReadPackedMsg, &value->BWPStart, end) &&
- pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) &&
- pull8(ppReadPackedMsg, &value->CyclicPrefix, end) &&
-
- pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) &&
- pull8(ppReadPackedMsg, &value->DurationSymbols, end) &&
- pullarray8(ppReadPackedMsg, value->FreqDomainResource, 6, 6, end) &&
- pull8(ppReadPackedMsg, &value->CceRegMappingType, end) &&
-
- pull8(ppReadPackedMsg, &value->RegBundleSize, end) &&
- pull8(ppReadPackedMsg, &value->InterleaverSize, end) &&
- pull8(ppReadPackedMsg, &value->CoreSetType, end) &&
- pull16(ppReadPackedMsg, &value->ShiftIndex, end) &&
-
- pull8(ppReadPackedMsg, &value->precoderGranularity, end) &&
- pull16(ppReadPackedMsg, &value->numDlDci, end));
-
-}
-
-
-static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
-
- // TODO: resolve the packaging of array (currently sending a single element)
- return(
- pull16(ppReadPackedMsg, &value->pduBitmap, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull16(ppReadPackedMsg, &value->pduIndex, end) &&
- pull16(ppReadPackedMsg, &value->BWPSize, end) &&
-
- pull16(ppReadPackedMsg, &value->BWPStart, end) &&
- pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) &&
- pull8(ppReadPackedMsg, &value->CyclicPrefix, end) &&
- pull8(ppReadPackedMsg, &value->NrOfCodewords, end) &&
-
- pullarray16(ppReadPackedMsg, value->targetCodeRate, 2, 1, end) &&
- pullarray8(ppReadPackedMsg, value->qamModOrder, 2, 1, end) &&
- pullarray8(ppReadPackedMsg, value->mcsIndex, 2, 1, end) &&
- pullarray8(ppReadPackedMsg, value->mcsTable, 2, 1, end) &&
-
- pullarray8(ppReadPackedMsg, value->rvIndex, 2, 1, end) &&
- pullarray32(ppReadPackedMsg, value->TBSize, 2, 1, end) &&
- pull16(ppReadPackedMsg, &value->dataScramblingId, end) &&
- pull8(ppReadPackedMsg, &value->nrOfLayers, end) &&
-
- pull8(ppReadPackedMsg, &value->transmissionScheme, end) &&
- pull8(ppReadPackedMsg, &value->refPoint, end) &&
- pull16(ppReadPackedMsg, &value->dlDmrsSymbPos, end) &&
- pull8(ppReadPackedMsg, &value->dmrsConfigType, end) &&
-
- pull16(ppReadPackedMsg, &value->dlDmrsScramblingId, end) &&
- pull8(ppReadPackedMsg, &value->SCID, end) &&
- pull8(ppReadPackedMsg, &value->numDmrsCdmGrpsNoData, end) &&
- pull16(ppReadPackedMsg, &value->dmrsPorts, end) &&
-
- pull8(ppReadPackedMsg, &value->resourceAlloc, end) &&
- pull16(ppReadPackedMsg, &value->rbStart, end) &&
- pull16(ppReadPackedMsg, &value->rbSize, end) &&
-
- pull8(ppReadPackedMsg, &value->VRBtoPRBMapping, end) &&
- pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) &&
- pull8(ppReadPackedMsg, &value->NrOfSymbols, end) &&
- pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) &&
-
- pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) &&
- pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) &&
- pull8(ppReadPackedMsg, &value->PTRSReOffset, end)
- );
-
-}
-
-
-static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- NFAPI_TRACE(NFAPI_TRACE_DEBUG, "ssb received and unpacked. \n");
- nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &value->PhysCellId, end) &&
- pull8(ppReadPackedMsg, &value->BetaPss, end) &&
- pull8(ppReadPackedMsg, &value->SsbBlockIndex, end) &&
- pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) &&
- pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) &&
- pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) &&
- pull32(ppReadPackedMsg, &value->bchPayload, end) &&
- pull8(ppReadPackedMsg, &value->ssbRsrp, end)
- // TODO: pack precoding_and_beamforming too
- );
-
-}
-
-
-// LTE:
-static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) &&
- pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
- pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) &&
- pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end));
-
-}
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end));
-}
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end));
-}
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end));
-}
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) &&
- pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end));
-}
-
-static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end)
-{
- if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
- pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
- pull8(ppReadPackedMsg, &value->num_antennas, end)))
- return 0;
-
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_subbands; ++idx)
- {
- nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
-
- if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) &&
- pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end)))
- return 0;
-
- uint8_t antenna_idx = 0;
- uint8_t scheduled_ue_idx = 0;
-
- for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
- {
- for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
- {
- if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end))
- return 0;
- }
- }
-
- }
-
-
- return 1;
-
-}
-
-
-static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
-
- // If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been
- // added
- uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5;
- dci_dl_pdu_rel13->tpm_struct_flag = 0;
-
- return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) &&
- pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) &&
- ( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) &&
- ( (tpm_struct_flag_present == 1 && dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1));
-
-}
-
-static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) &&
- pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end));
-}
-
-static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) &&
- pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) &&
- pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) &&
- pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) &&
- pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end));
-}
-
-static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
-
- if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
- pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) &&
- pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end)))
- return 0;
-
- uint16_t j = 0;
- for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j)
- {
- if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) &&
- pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end)))
- return 0;
- }
- return 1;
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) );
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
- pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ;
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end));
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end));
-}
-static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) &&
- pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) &&
- pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end));
-}
-
-static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) &&
- pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
- pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) &&
- pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) &&
- pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end));
-}
-static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) &&
- pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end));
-}
-
-static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) &&
- pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) &&
- pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) &&
- pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end));
-}
-
-static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) &&
- pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) &&
- pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) &&
- pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
- pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) &&
- pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end));
-}
-
-static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
-
- if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) &&
- pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) &&
- pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end)))
- return 0;
-
-
- uint16_t idx =0;
- for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx)
- {
- if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end)))
- return 0;
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n");
- //pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??);
- }
- return 1;
-}
-
-static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) &&
- pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) &&
- pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) &&
- pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end));
-}
-
-static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) &&
- pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end));
-}
-
-static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
-
-
- return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) &&
- pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) &&
- pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) &&
- pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end));
-}
-
-
-static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) &&
- pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) &&
- pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end));
-}
-
-static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) &&
- pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) &&
- pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end));
-}
-
-static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) &&
- pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) &&
- pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) &&
- pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) &&
- pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) &&
- pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end));
-}
-
-
-static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)msg;
-
- if(!(pull16(ppReadPackedMsg, &value->PDUSize, end) &&
- pull16(ppReadPackedMsg, &value->PDUType, end) ))
- return 0;
-
-
- // first match the pdu type, then call the respective function
- switch(value->PDUType)
- {
- case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
- {
- if(!(unpack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppReadPackedMsg,end)))
- return 0;
- }
- break;
-
- case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
- {
- if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end)))
- return 0;
- }
- break;
- case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
- {
- if(!(unpack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppReadPackedMsg,end)))
- return 0;
- }
- break;
- case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
- {
- if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end)))
- return 0;
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType );
- }
- break;
- }
-
- return 1;
-}
-
-
-
-
-static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) &&
- pull8(ppReadPackedMsg, &value->number_dci, end) &&
- pull16(ppReadPackedMsg, &value->number_pdu, end) &&
- pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) &&
- pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end)))
- return 0;
-
- if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU);
- return 0;
- }
-
- if(value->number_pdu)
- {
- value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config);
- if(value->dl_config_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu);
- return 0;
- }
- }
- else
- {
- value->dl_config_pdu_list = 0;
- }
-
- uint16_t i;
- uint16_t total_number_of_pdus = value->number_pdu;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- {
- // pdu end of beyond buffer end
- return 0;
- }
-
- switch(pdu->pdu_type)
- {
- case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
- { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value},
- { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value},
- { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value},
- { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value},
- { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
-
- }
- break;
- case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
-
- }
- break;
- default:
- // Need to log an error
- break;
- }
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_dl_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
-
- if (!(pull16(ppReadPackedMsg,&pNfapiMsg->SFN, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nGroup, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nPDUs, end) &&
- pullarray8(ppReadPackedMsg,pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, end)
- //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
- ))
- return 0;
-
- int arr[12];
- for(int i=0;idl_tti_request_body.nGroup;i++)
- {
- for(int j=0;jdl_tti_request_body.nUe[i];j++)
- {
- arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
- }
- if(!(pullarrays32(ppReadPackedMsg,arr,12,pNfapiMsg->dl_tti_request_body.nUe[i], end)))
- return 0;
- }
-
- for(int i=0;idl_tti_request_body.nPDUs;i++)
- {
- if(!unpack_dl_tti_request_body_value(ppReadPackedMsg, end, &pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i]))
- return 0;
- }
-
-return 1;
-}
-
-
-static uint8_t unpack_ul_tti_request_prach_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_prach_pdu_t* prach_pdu = (nfapi_nr_prach_pdu_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &prach_pdu->phys_cell_id, end) &&
- pull8(ppReadPackedMsg, &prach_pdu->num_prach_ocas, end) &&
- pull8(ppReadPackedMsg, &prach_pdu->prach_format, end) &&
- pull8(ppReadPackedMsg, &prach_pdu->num_ra, end) &&
- pull8(ppReadPackedMsg, &prach_pdu->prach_start_symbol, end) &&
- pull16(ppReadPackedMsg, &prach_pdu->num_cs, end)
- // TODO: ignoring beamforming tlv for now
- );
-}
-
-
-static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_pucch_pdu_t* pucch_pdu = (nfapi_nr_pucch_pdu_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &pucch_pdu->rnti, end) &&
- pull32(ppReadPackedMsg, &pucch_pdu->handle, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->bwp_size, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->bwp_start, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->subcarrier_spacing, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->nr_of_symbols, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->freq_hop_flag, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->second_hop_prb, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->group_hop_flag, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->sequence_hop_flag, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->hopping_id, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->initial_cyclic_shift, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->data_scrambling_id, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->time_domain_occ_idx, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_idx, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_len, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->add_dmrs_flag, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->dmrs_scrambling_id, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->dmrs_cyclic_shift, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->sr_flag, end) &&
- pull8(ppReadPackedMsg, &pucch_pdu->bit_len_harq, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part1, end) &&
- pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part2, end)
- // TODO: ignoring beamforming tlv for now
- );
-}
-
-
-static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_pusch_pdu_t* pusch_pdu = (nfapi_nr_pusch_pdu_t*)tlv;
-
- if (!(
- pull16(ppReadPackedMsg, &pusch_pdu->pdu_bit_map, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->rnti, end) &&
- pull32(ppReadPackedMsg, &pusch_pdu->handle, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->bwp_size, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->bwp_start, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->subcarrier_spacing, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->cyclic_prefix, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->target_code_rate, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->scid, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->num_dmrs_cdm_grps_no_data, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc,end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->rb_start, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->rb_size, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->vrb_to_prb_mapping, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->frequency_hopping, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->tx_direct_current_location, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->uplink_frequency_shift_7p5khz, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->start_symbol_index, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->nr_of_symbols, end)
- // TODO: ignoring beamforming tlv for now
- ))
- return 0;
-
-
- //Pack Optional Data only included if indicated in pduBitmap
- switch(pusch_pdu->pdu_bit_map){
- case PUSCH_PDU_BITMAP_PUSCH_DATA:
- {
- // pack optional TLVs
- return(
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.rv_index, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.harq_process_id, end) &&
- pull32(ppReadPackedMsg, &pusch_pdu->pusch_data.tb_size, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->pusch_data.num_cb, end) &&
- pullarray8(ppReadPackedMsg, pusch_pdu->pusch_data.cb_present_and_position,1,1,end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_PUSCH_UCI:
- {
- return(
- pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.harq_ack_bit_length, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part1_bit_length, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part2_bit_length, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.alpha_scaling, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_harq_ack, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi1, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi2, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_PUSCH_PTRS:
- {
- return(
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.num_ptrs_ports, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, end) &&
-+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, end) &&
-+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_time_density, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_freq_density, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ul_ptrs_power, end)
- );
- }
- break;
-
- case PUSCH_PDU_BITMAP_DFTS_OFDM:
- {
- return(
- pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_group_number, end) &&
- pull16(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_sequence_number, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, end) &&
- pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, end)
- );
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map );
- }
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_srs_pdu_t* srs_pdu = (nfapi_nr_srs_pdu_t*)tlv;
-
- return(
- pull16(ppReadPackedMsg, &srs_pdu->rnti, end) &&
- pull32(ppReadPackedMsg, &srs_pdu->handle, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->bwp_size, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->bwp_start, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->subcarrier_spacing, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->cyclic_prefix, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->num_ant_ports, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->num_symbols, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->num_repetitions, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->time_start_position, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->config_index, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->sequence_id, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->bandwidth_index, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->comb_size, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) &&
- pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->t_srs, end) &&
- pull16(ppReadPackedMsg, &srs_pdu->t_offset, end)
- // TODO: ignoring beamforming tlv for now
- );
-}
-
-
-static uint8_t unpack_ul_tti_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_ul_tti_request_number_of_pdus_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_pdus_t*)msg;
-
- if(!(pull16(ppReadPackedMsg, &pNfapiMsg->pdu_size, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->pdu_type, end) ))
- return 0;
-
-
- // first natch the pdu type, then call the respective function
- switch(pNfapiMsg->pdu_type)
- {
-
- case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
- {
- if(!unpack_ul_tti_request_prach_pdu(&pNfapiMsg->prach_pdu, ppReadPackedMsg, end))
- return 0;
- }
- break;
-
- case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
- {
- if(!unpack_ul_tti_request_pucch_pdu(&pNfapiMsg->pucch_pdu, ppReadPackedMsg, end))
- return 0;
- }
- break;
-
- case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
- {
- if(!unpack_ul_tti_request_pusch_pdu(&pNfapiMsg->pusch_pdu, ppReadPackedMsg, end))
- return 0;
- }
- break;
-
- case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
- {
- if(!unpack_ul_tti_request_srs_pdu(&pNfapiMsg->srs_pdu, ppReadPackedMsg, end))
- return 0;
- }
- break;
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", pNfapiMsg->pdu_type );
- }
- break;
-
-
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_ul_tti_request_number_of_groups_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_groups_t*)msg;
-
- if(!pull8(ppReadPackedMsg, &pNfapiMsg->n_ue, end))
- return 0;
- for (int i = 0; i < pNfapiMsg->n_ue; i++)
- {
- if(!pull8(ppReadPackedMsg, &pNfapiMsg->ue_list[i].pdu_idx ,end) )
- return 0;
- }
- return 1;
-}
-
-
-static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg;
-
- if (!(
- pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) ))
- return 0;
-
- for(int i=0; i< pNfapiMsg->n_pdus; i++)
- {
- if (!unpack_ul_tti_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdus_list[i]))
- return 0;
- }
-
- for(int i=0; i< pNfapiMsg->n_group; i++)
- {
- if (!unpack_ul_tti_groups_list_value(ppReadPackedMsg, end, &pNfapiMsg->groups_list[i]))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value},
- };
-
- return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end ));
-}
-
-static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) &&
- pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) &
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end));
-}
-static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel11->dmrs_config_flag, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end));
-}
-static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &ulsch_pdu_rel13->ue_type, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) &&
- pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) &&
- pull8(ppReadPackedMsg, &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end));
-}
-static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end));
-}
-
-static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end)))
- return 0;
-
- switch(cqi_ri_info_rel9->report_type)
- {
- case NFAPI_CSI_REPORT_TYPE_PERIODIC:
- {
- if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) &&
- pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end)))
- return 0;
- }
- break;
- case NFAPI_CSI_REPORT_TYPE_APERIODIC:
- {
- if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0)
- return 0;
-
- uint8_t i;
- for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
- {
- if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0)
- return 0;
-
- uint8_t j;
- for(j = 0; j < 8; ++j)
- {
- if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0)
- return 0;
- }
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
- return 0;
- }
- break;
- };
- return 1;
-}
-
-// NOTE : This function is a little unconventional as we uese the side to
-// determine the report type
-static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
- if(cqi_ri_info_rel13->tl.length == 0)
- {
- cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC;
- }
- else
- {
- cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC;
- if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0)
- return 0;
- }
- return 1;
-}
-static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) &&
- pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end));
-}
-static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end));
-}
-
-static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end));
-}
-
-static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) &&
- pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end));
-}
-static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) &&
- pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end));
-}
-static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) &&
- pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) &&
- pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) &&
- pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end));
-}
-
-static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end));
-}
-static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) &&
- pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end));
-}
-static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) &&
- pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) &&
- pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end));
-}
-
-static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
-
- return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end));
-}
-
-static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) &&
- pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) &&
- pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) &&
- pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) &&
- pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) &&
- pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) &&
- pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) &&
- pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) &&
- pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) &&
- pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) &&
- pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) &&
- pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) &&
- pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) &&
- pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) &&
- pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) &&
- pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) &&
- pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) &&
- pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) &&
- pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end));
-}
-
-static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) &&
- pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end));
-}
-
-
-static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) &&
- pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) &&
- pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) &&
- pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end));
-}
-
-static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
- return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end);
-}
-
-static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end));
-}
-
-static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end));
-}
-
-static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) &&
- pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) &&
- pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) &&
- pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) &&
- pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) &&
- pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) &&
- pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end)))
- return 0;
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value},
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value},
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
- { NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value},
- };
-
- return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0);
-}
-
-static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) &&
- pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) &&
- pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end));
-}
-
-
-static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- #define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value},
-
- #define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \
- { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value},
-
- #define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\
- { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value},
-
- #define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value},
-
- #define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \
- { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
-
- #define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \
- { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value},
-
- #define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value},
-
- #define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \
- { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value},
-
- #define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \
- { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \
- { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value},
-
- #define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value},
-
- #define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \
- { NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value},
-
-
- nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) &&
- pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) &&
- pull8(ppReadPackedMsg, &value->srs_present, end)))
- return 0;
-
- if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_pdus > 0)
- {
- value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config);
-
- if(value->ul_config_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
- return 0;
- }
- }
- else
- {
- value->ul_config_pdu_list = 0;
- }
-
-
- uint16_t i;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- {
- // pdu end is past buffer end
- return 0;
- }
-
- switch(pdu->pdu_type)
- {
- case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
-
- case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu)
- UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information)
- UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu)
- UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information)
- UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu)
- UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information)
- UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information)
- UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information)
- UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information)
- UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information)
- UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information)
- UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu)
- UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information)
- UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu)
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- }
- }
- return 1;
-}
-
-
-static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
-
- return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) &&
- pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) &&
- pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) &&
- pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) &&
- pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end));
-}
-
-static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) &&
- pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end));
-}
-
-static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) &&
- pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) &&
- pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) &&
- pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end));
-}
-
-static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) &&
- pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end));
-}
-
-static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
-
- return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) &&
- pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end));
-}
-
-static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) &&
- pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) &&
- pull8(ppReadPackedMsg, &value->resource_block_assignment, end) &&
- pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) &&
- pull8(ppReadPackedMsg, &value->start_symbol, end) &&
- pull8(ppReadPackedMsg, &value->ecce_index, end) &&
- pull8(ppReadPackedMsg, &value->aggreagation_level, end) &&
- pull8(ppReadPackedMsg, &value->rnti_type, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->ce_mode, end) &&
- pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) &&
- pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) &&
- pull16(ppReadPackedMsg, &value->transmission_power, end) &&
- pull8(ppReadPackedMsg, &value->dci_format, end) &&
- pull8(ppReadPackedMsg, &value->resource_block_start, end) &&
- pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
- pull8(ppReadPackedMsg, &value->mcs, end) &&
- pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) &&
- pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) &&
- pull8(ppReadPackedMsg, &value->new_data_indication, end) &&
- pull8(ppReadPackedMsg, &value->harq_process, end) &&
- pull8(ppReadPackedMsg, &value->redudency_version, end) &&
- pull8(ppReadPackedMsg, &value->tpc, end) &&
- pull8(ppReadPackedMsg, &value->csi_request, end) &&
- pull8(ppReadPackedMsg, &value->ul_inex, end) &&
- pull8(ppReadPackedMsg, &value->dai_presence_flag, end) &&
- pull8(ppReadPackedMsg, &value->dl_assignment_index, end) &&
- pull8(ppReadPackedMsg, &value->srs_request, end) &&
- pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) &&
- pull32(ppReadPackedMsg, &value->tcp_bitmap, end) &&
- pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) &&
- pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) &&
- pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end));
-}
-
-static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->ncce_index, end) &&
- pull8(ppReadPackedMsg, &value->aggregation_level, end) &&
- pull8(ppReadPackedMsg, &value->start_symbol, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) &&
- pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) &&
- pull8(ppReadPackedMsg, &value->subcarrier_indication, end) &&
- pull8(ppReadPackedMsg, &value->resource_assignment, end) &&
- pull8(ppReadPackedMsg, &value->scheduling_delay, end) &&
- pull8(ppReadPackedMsg, &value->mcs, end) &&
- pull8(ppReadPackedMsg, &value->redudancy_version, end) &&
- pull8(ppReadPackedMsg, &value->repetition_number, end) &&
- pull8(ppReadPackedMsg, &value->new_data_indicator, end) &&
- pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end));
-}
-
-static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
-
- if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) &&
- pull8(ppReadPackedMsg, &value->number_of_dci, end) &&
- pull8(ppReadPackedMsg, &value->number_of_hi, end)))
- return 0;
-
- uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci;
-
- if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU);
- return 0;
- }
-
- if(totalNumPdus > 0)
- {
- value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config);
- if(value->hi_dci0_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus);
- return 0;
- }
- }
- else
- {
- value->hi_dci0_pdu_list = 0;
- }
-
- uint8_t i;
- for(i = 0; i < totalNumPdus; ++i)
- {
- nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- {
- // pdu end if past buffer end
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size too big %p %p\n", __FUNCTION__, packedPduEnd, end);
- return 0;
- }
-
- switch(pdu->pdu_type)
- {
- case NFAPI_HI_DCI0_HI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value},
- { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_HI_DCI0_DCI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
- { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
- { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
- { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
- { NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
- }
- break;
- };
- }
-
- return 1;
-}
-
-//unpack_ul_dci_pdu_list_value
-
-static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)msg;
- for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
- {
- if(!(pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, end) &&
-
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, end) &&
-
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end) &&
-
- pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end)))
-
- return 0;
- }
-
- return (pull16(ppReadPackedMsg, &value->PDUType, end) &&
- pull16(ppReadPackedMsg, &value->PDUSize, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, end) &&
-
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, end) &&
- pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, end) &&
-
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) &&
- pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) &&
- pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end));
-
-}
-
-static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
-nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg;
-
- if (!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->numPdus, end)
- ))
- return 0;
- for(int i=0; i< pNfapiMsg->numPdus; i++)
- {
- if (!unpack_ul_dci_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->ul_dci_pdu_list[i]))
- return 0;
- }
-
- return 1;
-
-}
-
-static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-
-}
-static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
-{
- nfapi_nr_pdu_t* pNfapiMsg = (nfapi_nr_pdu_t*)msg;
-
- if(!(pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->PDU_length, end)
- ))
- return 0;
-
- uint16_t i = 0;
- uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV;
- for(; i < total_number_of_tlvs; ++i)
- {
-
- if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end)))
- return 0;
-
- switch(pNfapiMsg->TLVs[i].tag){
- case 0:
- {
- if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end))
- return 0;
- break;
-
- }
-
- case 1:
- {
- if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length , pNfapiMsg->TLVs[i].length, end))
- return 0;
- break;
-
- }
-
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", pNfapiMsg->TLVs[i].tag );
- break;
- }
-
- }
- }
-
-
- return 1;
-}
-
-static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg;
-
- if(!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->Number_of_PDUs, end)))
- return 0;
-
- for(int i=0; i< pNfapiMsg->Number_of_PDUs; i++)
- {
- if (!unpack_tx_data_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdu_list[i]))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- uint8_t proceed = 1;
- nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
-
- if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
- return 0;
-
- while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
- {
- nfapi_tl_t generic_tl;
- if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- return 0;
-
- switch(generic_tl.tag)
- {
- case NFAPI_TX_REQUEST_BODY_TAG:
- {
- pNfapiMsg->tx_request_body.tl = generic_tl;
-
- if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0)
- return 0;
-
- if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU);
- return 0;
- }
-
- if(pNfapiMsg->tx_request_body.number_of_pdus > 0)
- {
- pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config);
- if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus);
- return 0;
- }
- }
- else
- {
- pNfapiMsg->tx_request_body.tx_pdu_list = 0;
- }
-
-
- uint16_t i;
- uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus;
- for(i = 0; i < totalNumPdus; ++i)
- {
- nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
- if (pdu) {
- uint16_t length = 0;
- uint16_t index = 0;
-
- if(!(pull16(ppReadPackedMsg, &length, end) &&
- pull16(ppReadPackedMsg, &index, end)))
- return 0;
-
- pdu->pdu_length = length;
- pdu->pdu_index = index;
-
-
- // TODO : May need to rethink this bit
- pdu->num_segments = 1;
- pdu->segments[0].segment_length = pdu->pdu_length;
- pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
-
- if(pdu->segments[0].segment_data)
- {
- if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
- return 0;
- if (pdu->segments[0].segment_length == 3)
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
- pdu->segments[0].segment_data[0],
- pdu->segments[0].segment_data[1],
- pdu->segments[0].segment_data[2]
- );
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
- }
- } else {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
- }
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag );
- }
- break;
- };
- }
-
- return 1;
-}
-
-
-//UNPACK NR UPLINK INDICATION FUNCTIONS
-
-//RX DATA INDICATION
-
-static uint8_t unpack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t* value,
- uint8_t **ppReadPackedMsg,
- uint8_t *end,
- nfapi_p7_codec_config_t* config)
-{
- if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->harq_id, end) &&
- pull16(ppReadPackedMsg, &value->pdu_length, end) &&
- pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end) &&
- pull16(ppReadPackedMsg, &value->rssi, end)
- ))
- return 0;
-
- uint16_t length = value->pdu_length;
- value->pdu = nfapi_p7_allocate(length, config);
-
- if (pullarray8(ppReadPackedMsg, value->pdu, length, length, end) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
- return 0;
- }
- return 1;
-}
-
-
-static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
- if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
- ))
- return 0;
- if (pNfapiMsg->number_of_pdus > 0)
- {
- pNfapiMsg->pdu_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->pdu_list) * pNfapiMsg->number_of_pdus, config);
- }
-
- for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
- {
- if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end, config))
- return 0;
- }
-
-return 1;
-}
-
-//NR CRC INDICATION
-
-static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->harq_id, end) &&
- pull8(ppReadPackedMsg, &value->tb_crc_status, end) &&
- pull16(ppReadPackedMsg, &value->num_cb, end) &&
- //pullarray8(ppReadPackedMsg, value->cb_crc_status, (int)(value->num_cb / 8) + 1, (int)(value->num_cb / 8) + 1, end) && //length is ceil(NumCb/8)
- pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end) &&
- pull16(ppReadPackedMsg, &value->rssi, end)
- ))
- return 0;
-
- return 1;
-}
-
-static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
-
- if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
- ))
- return 0;
-
- if (pNfapiMsg->number_crcs > 0)
- {
- pNfapiMsg->crc_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->crc_list) * pNfapiMsg->number_crcs, config);
- }
-
- for (int i = 0; i < pNfapiMsg->number_crcs; i++)
- {
- if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppReadPackedMsg, end))
- return 0;
- }
-
-return 1;
-}
-
-//SRS INDICATION
-
-static uint8_t unpack_nr_srs_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nr_srs_indication_pdu_t* value = (nfapi_nr_srs_indication_pdu_t*)tlv;
-
- if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end) &&
- pull8(ppReadPackedMsg, &value->num_symbols, end) &&
- pull8(ppReadPackedMsg, &value->wide_band_snr, end) &&
- pull8(ppReadPackedMsg, &value->num_reported_symbols, end) &&
- pull16(ppReadPackedMsg, &value->reported_symbol_list->num_rbs, end)
- ))
- return 0;
- for(int i = 0; i < value->reported_symbol_list->num_rbs; i++)
- {
- if(!(pull8(ppReadPackedMsg, &value->reported_symbol_list->rb_list->rb_snr, end)
- ))
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
-
- if (!(pull16(ppReadPackedMsg,&pNfapiMsg->sfn , end) &&
- pull16(ppReadPackedMsg,&pNfapiMsg->slot , end) &&
- pull8(ppReadPackedMsg,&pNfapiMsg->number_of_pdus, end)
- ))
- return 0;
-
- for(int i=0; inumber_of_pdus;i++)
- {
- if(!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end))
- return 0;
- }
-
-return 1;
-}
-
-//NR RACH
-
-static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* value,
- uint8_t **ppReadPackedMsg,
- uint8_t *end,
- nfapi_p7_codec_config_t* config)
-{
-
- if(!(pull16(ppReadPackedMsg, &value->phy_cell_id, end) &&
- pull8(ppReadPackedMsg, &value->symbol_index, end) &&
- pull8(ppReadPackedMsg, &value->slot_index, end) &&
- pull8(ppReadPackedMsg, &value->freq_index, end) &&
- pull8(ppReadPackedMsg, &value->avg_rssi, end) &&
- pull8(ppReadPackedMsg, &value->avg_snr, end) &&
- pull8(ppReadPackedMsg, &value->num_preamble, end)
- ))
- return 0;
-
- if (value->num_preamble > 0) {
- value->preamble_list = nfapi_p7_allocate(sizeof(*value->preamble_list) * value->num_preamble, config);
- for(int i = 0; i < value->num_preamble; i++)
- {
- if(!(pull8(ppReadPackedMsg, &value->preamble_list[i].preamble_index, end) &&
- pull16(ppReadPackedMsg, &value->preamble_list[i].timing_advance, end) &&
- pull32(ppReadPackedMsg, &value->preamble_list[i].preamble_pwr, end)
- ))
- return 0;
- }
- }
- return 1;
-}
-
-static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) {
-
- nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
- if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
- pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
- ))
- return 0;
-
- if (pNfapiMsg->number_of_pdus > 0) {
- pNfapiMsg->pdu_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->pdu_list) * pNfapiMsg->number_of_pdus, config);
- for(int i = 0; i < pNfapiMsg->number_of_pdus; i++)
- {
- if(!unpack_nr_rach_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end, config))
- return 0;
- }
- }
- return 1;
-}
-
-//NR UCI
-
-static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t *value,
- uint8_t **ppReadPackedMsg,
- uint8_t *end,
- nfapi_p7_codec_config_t *config) {
-
- if (!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
- pull32(ppReadPackedMsg, &value->handle, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->pucch_format, end) &&
- pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end) &&
- pull16(ppReadPackedMsg, &value->rssi, end)
- ))
- return 0;
- if (value->pduBitmap & 0x01) { //SR
- if (!(pull8(ppReadPackedMsg, &value->sr->sr_indication, end) &&
- pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
- ))
- return 0;
- }
- if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
-
- value->harq = nfapi_p7_allocate(sizeof(*value->harq), config);
- if (value->harq == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nr_harq pdu\n", __FUNCTION__);
- return 0;
- }
- if (!(pull8(ppReadPackedMsg, &value->harq->num_harq, end) &&
- pull8(ppReadPackedMsg, &value->harq->harq_confidence_level, end)
- ))
- return 0;
- value->harq->harq_list = NULL;
- if (value->harq->num_harq > 0) {
- value->harq->harq_list = nfapi_p7_allocate(sizeof(*value->harq->harq_list) * value->harq->num_harq, config);
- if (value->harq->harq_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n",
- __FUNCTION__, value->harq->num_harq);
- return 0;
- }
- for (int i = 0; i < value->harq->num_harq; i++) {
- if (!pull8(ppReadPackedMsg, &value->harq->harq_list[i].harq_value, end)) {
- return 0;
- }
- }
- }
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
- nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
- pull32(ppReadPackedMsg, &value->handle, end) &&
- pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->pucch_format, end) &&
- pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end) &&
- pull16(ppReadPackedMsg, &value->rssi, end)
- ))
- return 0;
- if (value->pduBitmap & 0x01) { //SR
- if(!(pull16(ppReadPackedMsg, &value->sr.sr_bit_len, end) &&
- pullarray8(ppReadPackedMsg, value->sr.sr_payload, (int)(value->sr.sr_bit_len / 8) + 1, (int)(value->sr.sr_bit_len / 8) + 1, end)
- ))
- return 0;
- }
-
- if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
- if(!(pull8(ppReadPackedMsg, &value->harq.harq_crc, end) &&
- pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end) &&
- pullarray8(ppReadPackedMsg, value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8) + 1, (int)(value->harq.harq_bit_len / 8) + 1, end)
- ))
- return 0;
- }
-
- if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
- if(!(pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end) &&
- pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, end) &&
- pullarray8(ppReadPackedMsg, value->csi_part1.csi_part1_payload, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, end)
- ))
- return 0;
- }
-
- if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
- if(!(pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end) &&
- pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, end) &&
- pullarray8(ppReadPackedMsg, value->csi_part2.csi_part2_payload, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, end)
- ))
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t *value,
- uint8_t **ppReadPackedMsg,
- uint8_t *end,
- nfapi_p7_codec_config_t *config)
-{
- if(!(pull16(ppReadPackedMsg, &value->pdu_type, end) &&
- pull16(ppReadPackedMsg, &value->pdu_size, end)
- ))
- return 0;
-
- switch (value->pdu_type) {
- case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
- NFAPI_TRACE(NFAPI_TRACE_WARN, "Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
- break;
-
- case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
- nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &value->pucch_pdu_format_0_1;
- if (!unpack_nr_uci_pucch_0_1(uci_pdu, ppReadPackedMsg, end, config))
- return 0;
- break;
- }
- case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
- nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
- if (!unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end))
- return 0;
- break;
- }
- default:
- NFAPI_TRACE(NFAPI_TRACE_WARN, "Unexpected pdu type %d\n", value->pdu_type);
- break;
- }
-
- return 1;
-}
-
-static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
-
- if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
- pull16(ppReadPackedMsg, &pNfapiMsg->num_ucis, end)
- ))
- return 0;
-
- pNfapiMsg->uci_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->uci_list) * pNfapiMsg->num_ucis, config);
- for (int i = 0; i < pNfapiMsg->num_ucis; i++)
- {
- if(!unpack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppReadPackedMsg, end, config))
- return 0;
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- uint8_t proceed = 1;
- nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
-
- if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
- return 0;
-
- while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
- {
- nfapi_tl_t generic_tl;
- if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- return 0;
-
- switch(generic_tl.tag)
- {
- case NFAPI_UE_RELEASE_BODY_TAG:
- {
- pNfapiMsg->ue_release_request_body.tl = generic_tl;
- if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
- return 0;
-
- if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
- return 0;
- } else {
- uint8_t j;
- uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
- for(j = 0; j < num; ++j){
- if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
- return 0;
- }
- }
- }
- }
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
- }
- break;
- };
- }
-
- return 1;
-}
-
-static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->value_0, end) &&
- pull8(ppReadPackedMsg, &value->value_1, end));
-}
-
-static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->value_0, end) &&
- pull8(ppReadPackedMsg, &value->value_1, end) &&
- pull8(ppReadPackedMsg, &value->value_2, end) &&
- pull8(ppReadPackedMsg, &value->value_3, end));
-}
-static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv;
- return ( pull8(ppReadPackedMsg, &value->value_0, end));
-}
-static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv;
- return (pull8(ppReadPackedMsg, &value->value_0, end));
-}
-
-static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
- pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
- return 0;
-
- uint8_t result = 0;
- switch(value->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = 1;
- break;
- default:
- // TODO add error message
- return 0;
- break;
- }
- return result;
-}
-
-static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
- pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
- return 0;
-
- if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
- {
- // TODO : add error message
- return 0;
- }
-
- uint16_t idx = 0;
- for(idx = 0; idx < value->number_of_ack_nack; ++idx)
- {
- uint8_t result = 0;
- switch(value->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
- break;
- default:
- // TODO add error message
- return 0;
- break;
- }
-
- if(result == 0)
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
- pull16(ppReadPackedMsg, &value->number_of_ack_nack, end)))
- return 0;
-
- if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
- {
- // TODO : add error message
- return 0;
- }
-
- uint16_t idx = 0;
- for(idx = 0; idx < value->number_of_ack_nack; ++idx)
- {
- uint8_t result = 0;
- switch(value->mode)
- {
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
- result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end);
- break;
- case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
- result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end);
- break;
- default:
- // TODO add error message
- return 0;
- break;
- }
-
- if(result == 0)
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv;
- return (pull8(ppReadPackedMsg, &value->harq_tb1, end) &&
- pull8(ppReadPackedMsg, &value->harq_tb2, end));
-}
-
-static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->mode, end) &&
- pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
- pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end));
-}
-
-static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->mode, end) &&
- pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
- pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end));
-}
-
-static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
-
- return (pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
- pull8(ppReadPackedMsg, &value->channel, end));
-}
-
-
-
-static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
- uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(harqBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
- return 0;
-
- if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
- return 0;
- }
-
- assert(value->number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
- value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * NFAPI_HARQ_IND_MAX_PDU, config);
- if(value->harq_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
- return 0;
- }
-
- assert(value->number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
- for (size_t i = 0; i < value->number_of_harqs; ++i)
- {
- nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value},
- { NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value},
- { NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value},
- { NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value},
- { NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value},
- { NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value},
- { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
- return 0;
-
- }
-
- return 1;
-}
-
-static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
- return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) );
-}
-
-static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
- uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(crcBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0)
- return 0;
-
- if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_crcs > 0)
- {
- assert(value->number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
- value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * NFAPI_CRC_IND_MAX_PDU, config);
- if(value->crc_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs);
- return 0;
- }
- }
- else
- {
- value->crc_pdu_list = 0;
- }
-
- assert(value->number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
- for (size_t i = 0; i < value->number_of_crcs; ++i)
- {
- nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value },
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0)
- return 0;
- }
-
- return 1;
-}
-
-static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &value->length, end) &&
- pull16(ppReadPackedMsg, &value->offset, end) &&
- pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end));
-}
-static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
- return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
-}
-
-static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
-{
- nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t*)tlv;
-
- NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s value->tl.length in unpack: %u \n", __FUNCTION__,
- value->tl.length);
- uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s rxBodyEnd: %p end: %p\n", __FUNCTION__,
- rxBodyEnd, end);
- if (rxBodyEnd > end)
- {
- // pdu end is past buffer end
- return 0;
- }
-
- if (pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
- return 0;
-
- if (value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
- return 0;
- }
-
- if (value->number_of_pdus > 0)
- {
- assert(value->number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
- value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * NFAPI_RX_IND_MAX_PDU, config);
- if (value->rx_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
- return 0;
- }
- }
- else
- {
- value->rx_pdu_list = 0;
- }
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s number_of_pdus = %u\n", __FUNCTION__, value->number_of_pdus);
- for (int i = 0; i < value->number_of_pdus; i++)
- {
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s i = %u\n", __FUNCTION__, i);
- nfapi_tl_t generic_tl;
-
- // NFAPI_RX_UE_INFORMATION_TAG
- if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
- return 0;
- }
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
-
- if (generic_tl.tag != NFAPI_RX_UE_INFORMATION_TAG)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
- return 0;
- }
-
- assert(i < NFAPI_RX_IND_MAX_PDU);
- nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
-
- pdu->rx_ue_information.tl = generic_tl;
- if (unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_ue_info failure\n", __FUNCTION__);
- return 0;
- }
-
- // NFAPI_RX_INDICATION_REL8_TAG
- if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
- return 0;
- }
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
-
- if (generic_tl.tag != NFAPI_RX_INDICATION_REL8_TAG)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
- return 0;
- }
-
- pdu->rx_indication_rel8.tl = generic_tl;
- if (unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel8 failure\n", __FUNCTION__);
- return 0;
- }
- //What is offset not stripping 10 bytes
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s pdu->rx_indication_rel8.offset = %u", __FUNCTION__,
- pdu->rx_indication_rel8.offset);
-
- // NFAPI_RX_INDICATION_REL9_TAG
- if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
- return 0;
- }
-
- NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
-
- if (generic_tl.tag != NFAPI_RX_INDICATION_REL9_TAG)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
- return 0;
- }
-
- pdu->rx_indication_rel9.tl = generic_tl;
- if (unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel9 failure\n", __FUNCTION__);
- return 0;
- }
- }
-
- assert(value->number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
- for (int i = 0; i < value->number_of_pdus; ++i)
- {
- nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
- if (pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
- {
- uint32_t length = pdu->rx_indication_rel8.length;
- if (pullarray8(ppReadPackedMsg, pdu->rx_ind_data, NFAPI_RX_IND_DATA_MAX, length, end) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
- return 0;
- }
- }
- }
-
- return 1;
-}
-
-static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) &&
- pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) &&
- pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end));
-}
-
-static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
- return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end);
-}
-
-static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
- return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end);
-}
-
-static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
- uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(rachBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0)
- return 0;
-
- if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_preambles > 0)
- {
- value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config);
- if(value->preamble_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles);
- return 0;
- }
- }
- else
- {
- value->preamble_list = 0;
- }
-
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_preambles; ++i)
- {
- nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value },
- { NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value },
- { NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value },
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0)
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
-
- if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) &&
- pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) &&
- pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) &&
- pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end)))
- return 0;
- return 1;
-}
-
-static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
- return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end));
-}
-
-static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
- return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end));
-}
-
-static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
- return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end));
-}
-
-static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
-
- if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
- pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
- pull8(ppReadPackedMsg, &value->num_atennas, end)))
- return 0;
-
- if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS)
- {
- // todo : add error
- return 0;
- }
-
- if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS)
- {
- // todo : add error
- return 0;
- }
-
- uint8_t idx = 0;
- for(idx = 0; idx < value->number_of_subbands; ++idx)
- {
- if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) &&
- pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end)))
- return 0;
- }
-
- return 1;
-}
-
-
-static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv;
- uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(srsBodyEnd > end)
- return 0;
-
- if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0)
- return 0;
-
- if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_ues > 0)
- {
- value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config);
- if(value->srs_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues);
- return 0;
- }
- }
- else
- {
- value->srs_pdu_list = 0;
- }
-
-
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_ues; ++i)
- {
- nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
-
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value},
- { NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value},
- { NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value},
- { NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value},
- { NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value},
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0)
- return 0;
- }
- return 1;
-}
-
-static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
- uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(srBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0)
- return 0;
-
- if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_srs > 0)
- {
- assert(value->number_of_srs <= NFAPI_SR_IND_MAX_PDU);
- value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
- if(value->sr_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs);
- return 0;
- }
- }
- else
- {
- value->sr_pdu_list = 0;
- }
-
- uint8_t i = 0;
- assert(value->number_of_srs <= NFAPI_SR_IND_MAX_PDU);
- for(i = 0; i < value->number_of_srs; ++i)
- {
- nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value },
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0)
- return 0;
- }
-
- return 1;
-
-}
-
-static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) &&
- pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) &&
- pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end));
-
-}
-
-static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
-
- if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) &&
- pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) &&
- pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end)))
- return 0;
-
- if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n");
- return 0;
- }
-
- if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) &&
- pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end)))
- return 0;
-
- return 1;
-}
-
-static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
-
- // the cqiBodyEnd points to the end of the cqi PDU's
- uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- //uint8_t* cqiPduEnd = cqiBodyEnd;
- //uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
-
- if(cqiBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0)
- return 0;
-
- if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU);
- return -1;
- }
-
- if(value->number_of_cqis > 0)
- {
- assert(value->number_of_cqis <= NFAPI_SR_IND_MAX_PDU);
- value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
- if(value->cqi_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
- return 0;
- }
- }
- else
- {
- value->cqi_pdu_list = 0;
- }
-
- if(value->number_of_cqis > 0)
- {
- assert(value->number_of_cqis <= NFAPI_SR_IND_MAX_PDU);
- value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
- if(value->cqi_raw_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
- return 0;
- }
- }
- else
- {
- value->cqi_raw_pdu_list = 0;
- }
-
- uint8_t i = 0;
- assert(value->number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
- for(i = 0; i < value->number_of_cqis; ++i)
- {
- nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
- memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t));
-
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
-
- while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd)
- {
- nfapi_tl_t generic_tl;
- if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
- return 0;
-
- switch(generic_tl.tag)
- {
- case NFAPI_RX_UE_INFORMATION_TAG:
- pdu->rx_ue_information.tl = generic_tl;
- if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
- return 0;
- break;
- case NFAPI_CQI_INDICATION_REL8_TAG:
- pdu->cqi_indication_rel8.tl = generic_tl;
- if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0)
- return 0;
-
- break;
- case NFAPI_CQI_INDICATION_REL9_TAG:
- pdu->cqi_indication_rel9.tl = generic_tl;
- if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0)
- return 0;
-
- break;
- case NFAPI_UL_CQI_INFORMATION_TAG:
- pdu->ul_cqi_information.tl = generic_tl;
- if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0)
- return 0;
- break;
- default:
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag );
- }
- break;
-
- };
- }
- }
-
- uint8_t idx = 0;
- assert(value->number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
- for(idx = 0; idx < value->number_of_cqis; ++idx)
- {
- if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
- {
- if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0)
- return 0;
- }
- else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
- {
- if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0)
- return 0;
- }
- }
-
-
- return 1;
-
-}
-
-static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &value->handle, end) &&
- pull32(ppReadPackedMsg, &value->mp_cca, end) &&
- pull32(ppReadPackedMsg, &value->n_cca, end) &&
- pull32(ppReadPackedMsg, &value->offset, end) &&
- pull32(ppReadPackedMsg, &value->lte_txop_sf, end) &&
- pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) &&
- pull32(ppReadPackedMsg, &value->lbt_mode, end));
-}
-
-static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &value->handle, end) &&
- pull32(ppReadPackedMsg, &value->offset, end) &&
- pull16(ppReadPackedMsg, &value->sfn_sf_end, end) &&
- pull32(ppReadPackedMsg, &value->lbt_mode, end));
-}
-
-
-static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
-
- if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
- return 0;
-
- if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_pdus)
- {
- value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config);
- if(value->lbt_dl_config_req_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
- return 0;
- }
- }
- else
- {
- value->lbt_dl_config_req_pdu_list = 0;
- }
-
-
- uint16_t i;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type);
- return 0;
- }
- }
-
- return 1;
-}
-static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &value->handle, end) &&
- pull32(ppReadPackedMsg, &value->result, end) &&
- pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) &&
- pull32(ppReadPackedMsg, &value->initial_partial_sf, end));
-
-}
-static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
-
- return (pull32(ppReadPackedMsg, &value->handle, end) &&
- pull32(ppReadPackedMsg, &value->result, end));
-}
-
-static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
-
- if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
- return 0;
-
- if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU);
- return 0;
- }
-
- if(value->number_of_pdus > 0)
- {
- value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config);
- if(value->lbt_indication_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
- return 0;
- }
- }
- else
- {
- value->lbt_indication_pdu_list = 0;
- }
-
- uint16_t i;
- uint16_t total_number_of_pdus = value->number_of_pdus;
- for(i = 0; i < total_number_of_pdus; ++i)
- {
- nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
-
- if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
- pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
- return 0;
-
- uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
-
- if(packedPduEnd > end)
- return 0;
-
- switch(pdu->pdu_type)
- {
- case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
- {
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value},
- };
-
- unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
- }
- break;
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type);
- return 0;
- }
- }
-
- return 1;
-}
-static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
- return (pull8(ppReadPackedMsg, &value->harq_tb1, end));
-}
-
-
-static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
- uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(nbharqBodyEnd > end)
- return 0;
-
- if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
- return 0;
-
- if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
- return 0;
- }
-
- value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config);
- if(value->nb_harq_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
- return 0;
- }
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_harqs; ++i)
- {
- nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
- if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
- return 0;
-
- uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
- { NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value},
- { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
- return 0;
-
- }
-
- return 1;
-}
-
-static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
-{
- nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
-
- return (pull16(ppReadPackedMsg, &value->rnti, end) &&
- pull8(ppReadPackedMsg, &value->initial_sc, end) &&
- pull16(ppReadPackedMsg, &value->timing_advance, end) &&
- pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
-}
-
-static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
- if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
- return 0;
- }
- else{
- NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
- }
- return 1;
-}
-
-static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
-{
- nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
- uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length;
-
- if(nrachBodyEnd > end)
- return 0;
-
- if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0)
- return 0;
-
- if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU);
- return 0;
- }
-
- value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config);
- if(value->nrach_pdu_list == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected);
- return 0;
- }
-
- uint8_t i = 0;
- for(i = 0; i < value->number_of_initial_scs_detected; ++i)
- {
- nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
-
- uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6;
-
- unpack_tlv_t unpack_fns[] =
- {
- { NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value},
- };
-
- if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0)
- return 0;
-
- }
-
- return 1;
-}
-
-static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- { NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value},
- };
-
- return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_nr_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_nr_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
-{
- nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg;
-
- unpack_p7_tlv_t unpack_fns[] =
- {
- };
-
- return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) &&
- pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) &&
- pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) &&
- unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
-}
-
-
-
-// unpack length check
-
-static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
-{
- int retLen = 0;
-
- switch (msgId)
- {
- case NFAPI_DL_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t))
- retLen = sizeof(nfapi_dl_config_request_t);
- break;
-
- case NFAPI_UL_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t))
- retLen = sizeof(nfapi_ul_config_request_t);
- break;
-
- case NFAPI_SUBFRAME_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
- retLen = sizeof(nfapi_subframe_indication_t);
- break;
-
- case NFAPI_HI_DCI0_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t))
- retLen = sizeof(nfapi_hi_dci0_request_t);
- break;
-
- case NFAPI_TX_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_tx_request_t))
- retLen = sizeof(nfapi_tx_request_t);
- break;
-
- case NFAPI_HARQ_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_harq_indication_t))
- retLen = sizeof(nfapi_harq_indication_t);
- break;
-
- case NFAPI_CRC_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_crc_indication_t))
- retLen = sizeof(nfapi_crc_indication_t);
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_rx_indication_t))
- retLen = sizeof(nfapi_rx_indication_t);
- break;
-
- case NFAPI_RACH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_rach_indication_t))
- retLen = sizeof(nfapi_rach_indication_t);
- break;
-
- case NFAPI_SRS_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_srs_indication_t))
- retLen = sizeof(nfapi_srs_indication_t);
- break;
-
- case NFAPI_RX_SR_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_sr_indication_t))
- retLen = sizeof(nfapi_sr_indication_t);
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t))
- retLen = sizeof(nfapi_cqi_indication_t);
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t))
- retLen = sizeof(nfapi_lbt_dl_config_request_t);
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t))
- retLen = sizeof(nfapi_lbt_dl_indication_t);
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t))
- retLen = sizeof(nfapi_nb_harq_indication_t);
- break;
-
- case NFAPI_NRACH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t))
- retLen = sizeof(nfapi_nrach_indication_t);
- break;
-
- case NFAPI_DL_NODE_SYNC:
- if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t))
- retLen = sizeof(nfapi_dl_node_sync_t);
- break;
-
- case NFAPI_UL_NODE_SYNC:
- if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t))
- retLen = sizeof(nfapi_ul_node_sync_t);
- break;
-
- case NFAPI_TIMING_INFO:
- if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
- retLen = sizeof(nfapi_timing_info_t);
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
- retLen = sizeof(nfapi_ue_release_request_t);
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
- retLen = sizeof(nfapi_ue_release_response_t);
- break;
-
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
- break;
- }
-
- return retLen;
-}
-
-static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
-{
- int retLen = 0;
-
- switch (msgId)
- {
- case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_dl_tti_request_t))
- retLen = sizeof(nfapi_nr_dl_tti_request_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_ul_tti_request_t))
- retLen = sizeof(nfapi_nr_ul_tti_request_t);
- break;
-
- case NFAPI_SUBFRAME_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
- retLen = sizeof(nfapi_subframe_indication_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_ul_dci_request_t))
- retLen = sizeof(nfapi_nr_ul_dci_request_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t))
- retLen = sizeof(nfapi_nr_tx_data_request_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nr_rx_data_indication_t))
- retLen = sizeof(nfapi_nr_rx_data_indication_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nr_crc_indication_t))
- retLen = sizeof(nfapi_nr_crc_indication_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nr_rach_indication_t))
- retLen = sizeof(nfapi_nr_rach_indication_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nr_uci_indication_t))
- retLen = sizeof(nfapi_nr_uci_indication_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
- if (unpackedBufLen >= sizeof(nfapi_nr_srs_indication_t))
- retLen = sizeof(nfapi_nr_srs_indication_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
- if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t))
- retLen = sizeof(nfapi_nr_dl_node_sync_t);
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
- if (unpackedBufLen >= sizeof(nfapi_nr_ul_node_sync_t))
- retLen = sizeof(nfapi_nr_ul_node_sync_t);
- break;
-
- case NFAPI_TIMING_INFO:
- if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
- retLen = sizeof(nfapi_timing_info_t);
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
- retLen = sizeof(nfapi_ue_release_request_t);
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
- retLen = sizeof(nfapi_ue_release_response_t);
- break;
-
- default:
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
- break;
- }
-
- return retLen;
-}
-
-
-
-// Main unpack functions - public
-
-int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
-{
- nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
-
- // process the header
- if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
- return -1;
-
- return 0;
-}
-
-int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
-{
- int result = 0;
- nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
-
- // clean the supplied buffer for - tag value blanking
- (void)memset(pUnpackedBuf, 0, unpackedBufLen);
-
- // process the header
- if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
- return -1;
- }
-
- if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
- return -1;
- }
-
- /*
- if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
- return -1;
- }
- */
-
- // look for the specific message
- switch (pMessageHeader->message_id)
- {
- case NFAPI_DL_CONFIG_REQUEST:
- if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen))
- result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UL_CONFIG_REQUEST:
- if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen))
- result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
- case NFAPI_TX_REQUEST:
- if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen))
- result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_HI_DCI0_REQUEST:
- if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen))
- result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
- result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_HARQ_INDICATION:
- if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
- result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_CRC_INDICATION:
- if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
- result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_ULSCH_INDICATION:
- if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
- result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RACH_INDICATION:
- if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
- result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_SRS_INDICATION:
- if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen))
- result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_SR_INDICATION:
- if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen))
- result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_RX_CQI_INDICATION:
- if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen))
- result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_LBT_DL_CONFIG_REQUEST:
- if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen))
- result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_LBT_DL_INDICATION:
- if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
- result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NB_HARQ_INDICATION:
- if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
- result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NRACH_INDICATION:
- if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
- result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_DL_NODE_SYNC:
- if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen))
- result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UL_NODE_SYNC:
- if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen))
- result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_TIMING_INFO:
- if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
- result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
- result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- default:
-
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
- {
- if(config && config->unpack_p7_vendor_extension)
- {
- result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
- break;
- }
-
- if(result == 0)
- return -1;
- else
- return 0;
-}
-
-int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
-{
- int result = 0;
- nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
- uint8_t *pReadPackedMessage = pMessageBuf;
- uint8_t *end = pMessageBuf + messageBufLen;
-
- if (pMessageBuf == NULL || pUnpackedBuf == NULL)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
- return -1;
- }
-
- if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
- return -1;
- }
-
- // clean the supplied buffer for - tag value blanking
- (void)memset(pUnpackedBuf, 0, unpackedBufLen);
-
- // process the header
- if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
- pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
- pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
- return -1;
- }
-
- if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
- return -1;
- }
-
- /*
- if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
- return -1;
- }
- */
-
- // look for the specific message
- switch (pMessageHeader->message_id)
- {
- case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen))
- result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen))
- result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
- case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen))
- result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
- case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen))
- result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UE_RELEASE_REQUEST:
- if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
- result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen))
- result = unpack_nr_rx_data_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION, unpackedBufLen))
- result = unpack_nr_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION, unpackedBufLen))
- result = unpack_nr_uci_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION, unpackedBufLen))
- result = unpack_nr_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION, unpackedBufLen))
- result = unpack_nr_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen))
- result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
- if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen))
- result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_TIMING_INFO:
- if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
- result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- case NFAPI_UE_RELEASE_RESPONSE:
- if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
- result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
- else
- return -1;
- break;
-
- default:
-
- if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
- pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
- {
- if(config && config->unpack_p7_vendor_extension)
- {
- result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
- }
- }
- else
- {
- NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
- }
- break;
- }
-
- if(result == 0)
- return -1;
- else
- return 0;
-}
-
+/*
+ * Copyright 2017 Cisco Systems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include "nfapi_nr_interface_scf.h"
+
+extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
+extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
+
+uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len)
+{
+ uint32_t chksum = 0;
+ // calcaulte upto the checksum
+ chksum = crc32(chksum, buffer, 8);
+
+ // skip the checksum
+ uint8_t zeros[4] = {0, 0, 0, 0};
+ chksum = crc32(chksum, zeros, 4);
+
+ // continu with the rest of the mesage
+ chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH);
+
+ // return the inverse
+ return ~(chksum);
+}
+
+int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len)
+{
+ uint32_t checksum = nfapi_calculate_checksum(buffer, len);
+
+ uint8_t* p_write = &buffer[8];
+ return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1);
+}
+
+int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp)
+{
+ uint8_t* p_write = &buffer[12];
+ return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1);
+}
+
+uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len)
+{
+ return nfapi_calculate_checksum(buffer, len);
+}
+
+void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
+{
+ if(size == 0)
+ return 0;
+
+ void* buffer_p = NULL;
+ if(config && config->allocate)
+ {
+ buffer_p = (config->allocate)(size);
+ if(buffer_p != NULL){
+ memset(buffer_p,0,size);
+ }
+ return buffer_p;
+ }
+ else
+ {
+ buffer_p = calloc(1, size);
+ return buffer_p;
+ }
+}
+
+void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config)
+{
+ if(ptr == NULL)
+ return;
+
+ if(config && config->deallocate)
+ {
+ return (config->deallocate)(ptr);
+ }
+ else
+ {
+ return free(ptr);
+ }
+}
+// Pack routines
+
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
+
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format);
+
+ return ( push8(value->dci_format, ppWritePackedMsg, end) &&
+ push8(value->cce_idx, ppWritePackedMsg, end) &&
+ push8(value->aggregation_level, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+ push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+ push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->mcs_1, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version_1, ppWritePackedMsg, end) &&
+ push8(value->new_data_indicator_1, ppWritePackedMsg, end) &&
+ push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+ push8(value->mcs_2, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version_2, ppWritePackedMsg, end) &&
+ push8(value->new_data_indicator_2, ppWritePackedMsg, end) &&
+ push8(value->harq_process, ppWritePackedMsg, end) &&
+ push8(value->tpmi, ppWritePackedMsg, end) &&
+ push8(value->pmi, ppWritePackedMsg, end) &&
+ push8(value->precoding_information, ppWritePackedMsg, end) &&
+ push8(value->tpc, ppWritePackedMsg, end) &&
+ push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
+ push8(value->ngap, ppWritePackedMsg, end) &&
+ push8(value->transport_block_size_index, ppWritePackedMsg, end) &&
+ push8(value->downlink_power_offset, ppWritePackedMsg, end) &&
+ push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
+ push8(value->preamble_index, ppWritePackedMsg, end) &&
+ push8(value->prach_mask_index, ppWritePackedMsg, end) &&
+ push8(value->rnti_type, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
+
+ return( push8(value->mcch_flag, ppWritePackedMsg, end) &&
+ push8(value->mcch_change_notification, ppWritePackedMsg, end) &&
+ push8(value->scrambling_identity, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
+
+ return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
+ push8(value->carrier_indicator, ppWritePackedMsg, end) &&
+ push8(value->srs_flag, ppWritePackedMsg, end) &&
+ push8(value->srs_request, ppWritePackedMsg, end) &&
+ push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) &&
+ push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
+ push8(value->n_dl_rb, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
+
+ return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) &&
+ push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
+
+ return ( push8(value->primary_cell_type, ppWritePackedMsg, end) &&
+ push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) &&
+ push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) &&
+ pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
+ push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+ push8(value->num_antennas, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_subbands; ++idx)
+ {
+ nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
+
+ if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) &&
+ push8(subband_info->scheduled_ues, ppWritePackedMsg, end)))
+ return 0;
+
+
+ uint8_t antenna_idx = 0;
+ uint8_t scheduled_ue_idx = 0;
+
+ for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
+ {
+ for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
+ {
+ if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end))
+ return 0;
+ }
+ }
+
+ }
+
+
+ return 1;
+
+}
+
+static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv;
+
+ return(
+ push16(value->bwp_size, ppWritePackedMsg, end) &&
+ push16(value->bwp_start, ppWritePackedMsg, end) &&
+
+ push8(value->subcarrier_spacing, ppWritePackedMsg, end) &&
+ push8(value->cyclic_prefix, ppWritePackedMsg, end) &&
+
+ push16(value->start_rb, ppWritePackedMsg, end) &&
+ push16(value->nr_of_rbs, ppWritePackedMsg, end) &&
+
+ push8(value->csi_type, ppWritePackedMsg, end) &&
+ push8(value->row, ppWritePackedMsg, end) &&
+
+ push16(value->freq_domain, ppWritePackedMsg, end) &&
+ push8(value->symb_l0, ppWritePackedMsg, end) &&
+
+ push8(value->symb_l1, ppWritePackedMsg, end) &&
+ push8(value->cdm_type, ppWritePackedMsg, end) &&
+
+ push8(value->freq_density, ppWritePackedMsg, end) &&
+ push16(value->scramb_id, ppWritePackedMsg, end) &&
+
+ push8(value->power_control_offset, ppWritePackedMsg, end) &&
+ push8(value->power_control_offset_ss, ppWritePackedMsg, end)
+ );
+
+}
+
+
+static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
+
+ for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
+ {
+ if(!(push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
+ push16(value->dci_pdu[i].ScramblingId, ppWritePackedMsg, end) &&
+
+ push16(value->dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) &&
+ push8(value->dci_pdu[i].CceIndex, ppWritePackedMsg, end) &&
+ push8(value->dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) &&
+ push8(value->dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) &&
+
+ push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
+ push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
+ pusharray8(value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ // TODO: resolve the packaging of array (currently sending a single element)
+ return(
+ push16(value->BWPSize, ppWritePackedMsg, end) &&
+ push16(value->BWPStart, ppWritePackedMsg, end) &&
+ push8(value->SubcarrierSpacing, ppWritePackedMsg, end) &&
+ push8(value->CyclicPrefix, ppWritePackedMsg, end) &&
+
+ push8(value->StartSymbolIndex, ppWritePackedMsg, end) &&
+ push8(value->DurationSymbols, ppWritePackedMsg, end) &&
+ pusharray8(value->FreqDomainResource, 6, 6, ppWritePackedMsg, end) &&
+ push8(value->CceRegMappingType, ppWritePackedMsg, end) &&
+
+ push8(value->RegBundleSize, ppWritePackedMsg, end) &&
+ push8(value->InterleaverSize, ppWritePackedMsg, end) &&
+ push8(value->CoreSetType, ppWritePackedMsg, end) &&
+ push16(value->ShiftIndex, ppWritePackedMsg, end) &&
+
+ push8(value->precoderGranularity, ppWritePackedMsg, end) &&
+ push16(value->numDlDci, ppWritePackedMsg, end));
+
+}
+
+
+static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
+
+ // TODO: resolve the packaging of array (currently sending a single element)
+ return(
+ push16(value->pduBitmap, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push16(value->pduIndex, ppWritePackedMsg, end) &&
+ push16(value->BWPSize, ppWritePackedMsg, end) &&
+
+ push16(value->BWPStart, ppWritePackedMsg, end) &&
+ push8(value->SubcarrierSpacing, ppWritePackedMsg, end) &&
+ push8(value->CyclicPrefix, ppWritePackedMsg, end) &&
+ push8(value->NrOfCodewords, ppWritePackedMsg, end) &&
+
+ pusharray16(value->targetCodeRate, 2, 1, ppWritePackedMsg, end) &&
+ pusharray8(value->qamModOrder, 2, 1, ppWritePackedMsg, end) &&
+ pusharray8(value->mcsIndex, 2, 1, ppWritePackedMsg, end) &&
+ pusharray8(value->mcsTable, 2, 1, ppWritePackedMsg, end) &&
+
+ pusharray8(value->rvIndex, 2, 1, ppWritePackedMsg, end) &&
+ pusharray32(value->TBSize, 2, 1, ppWritePackedMsg, end) &&
+ push16(value->dataScramblingId, ppWritePackedMsg, end) &&
+ push8(value->nrOfLayers, ppWritePackedMsg, end) &&
+
+ push8(value->transmissionScheme, ppWritePackedMsg, end) &&
+ push8(value->refPoint, ppWritePackedMsg, end) &&
+ push16(value->dlDmrsSymbPos, ppWritePackedMsg, end) &&
+ push8(value->dmrsConfigType, ppWritePackedMsg, end) &&
+
+ push16(value->dlDmrsScramblingId, ppWritePackedMsg, end) &&
+ push8(value->SCID, ppWritePackedMsg, end) &&
+ push8(value->numDmrsCdmGrpsNoData, ppWritePackedMsg, end) &&
+ push16(value->dmrsPorts, ppWritePackedMsg, end) &&
+
+ push8(value->resourceAlloc, ppWritePackedMsg, end) &&
+ push16(value->rbStart, ppWritePackedMsg, end) &&
+ push16(value->rbSize, ppWritePackedMsg, end) &&
+
+ push8(value->VRBtoPRBMapping, ppWritePackedMsg, end) &&
+ push8(value->StartSymbolIndex, ppWritePackedMsg, end) &&
+ push8(value->NrOfSymbols, ppWritePackedMsg, end) &&
+ push8(value->PTRSPortIndex, ppWritePackedMsg, end) &&
+
+ push8(value->PTRSTimeDensity, ppWritePackedMsg, end) &&
+ push8(value->PTRSFreqDensity, ppWritePackedMsg, end) &&
+ push8(value->PTRSReOffset, ppWritePackedMsg, end)
+ );
+
+}
+
+
+static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
+
+ return(
+ push16(value->PhysCellId, ppWritePackedMsg, end) &&
+ push8(value->BetaPss, ppWritePackedMsg, end) &&
+ push8(value->SsbBlockIndex, ppWritePackedMsg, end) &&
+ push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) &&
+ push16(value->ssbOffsetPointA, ppWritePackedMsg, end) &&
+ push8(value->bchPayloadFlag, ppWritePackedMsg, end) &&
+ push32(value->bchPayload, ppWritePackedMsg, end) &&
+ push8(value->ssbRsrp, ppWritePackedMsg, end)
+ // TODO: pack precoding_and_beamforming too
+ );
+
+}
+
+static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
+
+ return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) &&
+ push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) &&
+ push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
+ push8(value->codebook_size_determination, ppWritePackedMsg, end) &&
+ push8(value->drms_table_flag, ppWritePackedMsg, end) &&
+ push8(value->tpm_struct_flag, ppWritePackedMsg, end) &&
+ (value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1));
+}
+
+static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
+
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__);
+
+ return( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
+
+ return ( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+ push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->modulation, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push16(value->mbsfn_area_id, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem;
+
+ return ( push8(bf->subband_index, ppWritePackedMsg, end) &&
+ push8(bf->num_antennas, ppWritePackedMsg, end) &&
+ pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end));
+
+
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
+
+ return ( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+ push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+ push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->modulation, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version, ppWritePackedMsg, end) &&
+ push8(value->transport_blocks, ppWritePackedMsg, end) &&
+ push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+ push8(value->transmission_scheme, ppWritePackedMsg, end) &&
+ push8(value->number_of_layers, ppWritePackedMsg, end) &&
+ push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+ pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) &&
+ push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
+ push8(value->pa, ppWritePackedMsg, end) &&
+ push8(value->delta_power_offset_index, ppWritePackedMsg, end) &&
+ push8(value->ngap, ppWritePackedMsg, end) &&
+ push8(value->nprb, ppWritePackedMsg, end) &&
+ push8(value->transmission_mode, ppWritePackedMsg, end) &&
+ push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) &&
+ push8(value->num_bf_vector, ppWritePackedMsg, end) &&
+ packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info));
+
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
+ return ( push8(value->nscid, ppWritePackedMsg, end) );
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
+
+ return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) &&
+ push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
+ push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
+ push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
+ pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) &&
+ push8(value->pdsch_start, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
+
+ return( push8(value->drms_config_flag, ppWritePackedMsg, end) &&
+ push16(value->drms_scrambling, ppWritePackedMsg, end) &&
+ push8(value->csi_config_flag, ppWritePackedMsg, end) &&
+ push16(value->csi_scrambling, ppWritePackedMsg, end) &&
+ push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) &&
+ push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) &&
+ push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
+
+ return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) &&
+ push8(value->maxlayers, ppWritePackedMsg, end) &&
+ push8(value->n_dl_harq, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
+
+ return( push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
+ push8(value->initial_lbt_sf, ppWritePackedMsg, end) &&
+ push8(value->ue_type, ppWritePackedMsg, end) &&
+ push8(value->pdsch_payload_type, ppWritePackedMsg, end) &&
+ push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+ push8(value->drms_table_flag, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
+
+ return( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->p_rnti, ppWritePackedMsg, end) &&
+ push8(value->resource_allocation_type, ppWritePackedMsg, end) &&
+ push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) &&
+ push32(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->mcs, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version, ppWritePackedMsg, end) &&
+ push8(value->number_of_transport_blocks, ppWritePackedMsg, end) &&
+ push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) &&
+ push8(value->transmission_scheme, ppWritePackedMsg, end) &&
+ push8(value->number_of_layers, ppWritePackedMsg, end) &&
+ push8(value->codebook_index, ppWritePackedMsg, end) &&
+ push8(value->ue_category_capacity, ppWritePackedMsg, end) &&
+ push8(value->pa, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push8(value->nprb, ppWritePackedMsg, end) &&
+ push8(value->ngap, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
+
+ return ( push8(value->ue_mode, ppWritePackedMsg, end) &&
+ push16(value->initial_transmission_sf_io, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
+
+ return( push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push8(value->prs_bandwidth, ppWritePackedMsg, end) &&
+ push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) &&
+ push8(value->prs_muting, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
+
+ return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) &&
+ push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) &&
+ push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) &&
+ pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
+
+ if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) &&
+ push8(value->cdm_type, ppWritePackedMsg, end) &&
+ push8(value->num_bf_vector, ppWritePackedMsg, end)))
+ {
+ return 0;
+ }
+
+ uint16_t i;
+ for(i = 0; i < value->num_bf_vector; ++i)
+ {
+ if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) &&
+ pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ return 1;
+}
+static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(vector->subband_index, ppWritePackedMsg, end) &&
+ push8(vector->num_antennas, ppWritePackedMsg, end) &&
+ pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
+
+ return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) &&
+ push16(value->epdcch_id, ppWritePackedMsg, end) &&
+ push8(value->epdcch_start_symbol, ppWritePackedMsg, end) &&
+ push8(value->epdcch_num_prb, ppWritePackedMsg, end) &&
+ pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) &&
+ pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
+
+ return (push8(value->dwpts_symbols, ppWritePackedMsg, end) &&
+ push8(value->initial_lbt_sf, ppWritePackedMsg, end));
+}
+static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
+
+ return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) &&
+ push8(value->number_of_prb_pairs, ppWritePackedMsg, end) &&
+ push8(value->resource_block_assignment, ppWritePackedMsg, end) &&
+ push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) &&
+ push8(value->start_symbol, ppWritePackedMsg, end) &&
+ push8(value->ecce_index, ppWritePackedMsg, end) &&
+ push8(value->aggregation_level, ppWritePackedMsg, end) &&
+ push8(value->rnti_type, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->ce_mode, ppWritePackedMsg, end) &&
+ push16(value->drms_scrambling_init, ppWritePackedMsg, end) &&
+ push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push8(value->dci_format, ppWritePackedMsg, end) &&
+ push16(value->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(value->mcs, ppWritePackedMsg, end) &&
+ push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) &&
+ push8(value->redundancy_version, ppWritePackedMsg, end) &&
+ push8(value->new_data_indicator, ppWritePackedMsg, end) &&
+ push8(value->harq_process, ppWritePackedMsg, end) &&
+ push8(value->tpmi_length, ppWritePackedMsg, end) &&
+ push8(value->tpmi, ppWritePackedMsg, end) &&
+ push8(value->pmi_flag, ppWritePackedMsg, end) &&
+ push8(value->pmi, ppWritePackedMsg, end) &&
+ push8(value->harq_resource_offset, ppWritePackedMsg, end) &&
+ push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+ push8(value->tpc, ppWritePackedMsg, end) &&
+ push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) &&
+ push8(value->downlink_assignment_index, ppWritePackedMsg, end) &&
+ push8(value->allocate_prach_flag, ppWritePackedMsg, end) &&
+ push8(value->preamble_index, ppWritePackedMsg, end) &&
+ push8(value->prach_mask_index, ppWritePackedMsg, end) &&
+ push8(value->starting_ce_level, ppWritePackedMsg, end) &&
+ push8(value->srs_request, ppWritePackedMsg, end) &&
+ push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) &&
+ push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) &&
+ push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+ push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) &&
+ push8(value->direct_indication, ppWritePackedMsg, end) &&
+ push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) &&
+ push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
+ pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
+
+ return (push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push16(value->transmission_power, ppWritePackedMsg, end) &&
+ push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
+
+ return (push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push8(value->ncce_index, ppWritePackedMsg, end) &&
+ push8(value->aggregation_level, ppWritePackedMsg, end) &&
+ push8(value->start_symbol, ppWritePackedMsg, end) &&
+ push8(value->rnti_type, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
+ push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
+ push8(value->dci_format, ppWritePackedMsg, end) &&
+ push8(value->scheduling_delay, ppWritePackedMsg, end) &&
+ push8(value->resource_assignment, ppWritePackedMsg, end) &&
+ push8(value->repetition_number, ppWritePackedMsg, end) &&
+ push8(value->mcs, ppWritePackedMsg, end) &&
+ push8(value->new_data_indicator, ppWritePackedMsg, end) &&
+ push8(value->harq_ack_resource, ppWritePackedMsg, end) &&
+ push8(value->npdcch_order_indication, ppWritePackedMsg, end) &&
+ push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) &&
+ push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) &&
+ push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) &&
+ push8(value->direct_indication, ppWritePackedMsg, end) &&
+ push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+ push8(value->total_dci_length_including_padding, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
+
+ return (push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->pdu_index, ppWritePackedMsg, end) &&
+ push8(value->start_symbol, ppWritePackedMsg, end) &&
+ push8(value->rnti_type, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push16(value->resource_assignment, ppWritePackedMsg, end) &&
+ push16(value->repetition_number, ppWritePackedMsg, end) &&
+ push8(value->modulation, ppWritePackedMsg, end) &&
+ push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) &&
+ push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
+ push16(value->sf_idx, ppWritePackedMsg, end) &&
+ push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_dl_tti_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)tlv;
+
+ if(!(push16(value->PDUSize, ppWritePackedMsg, end) &&
+ push16(value->PDUType, ppWritePackedMsg, end) ))
+ return 0;
+
+
+ // first match the pdu type, then call the respective function
+ switch(value->PDUType)
+ {
+ case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
+ {
+ if(!(pack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppWritePackedMsg,end)))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
+ {
+ if(!(pack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppWritePackedMsg,end)))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
+ {
+ if(!(pack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppWritePackedMsg,end)))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
+ {
+ if(!(pack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppWritePackedMsg,end)))
+ return 0;
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType );
+ }
+ break;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
+
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich);
+
+ if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) &&
+ push8(value->number_dci, ppWritePackedMsg, end) &&
+ push16(value->number_pdu, ppWritePackedMsg, end) &&
+ push8(value->number_pdsch_rnti, ppWritePackedMsg, end) &&
+ push16(value->transmission_power_pcfich, ppWritePackedMsg, end)))
+ {
+ return 0;
+ }
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_pdu;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
+
+ if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+ if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__);
+
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value)))
+ {
+ return 0;
+ }
+ }
+ break;
+ case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__);
+
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel10_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) &&
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) &
+ pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
+
+ if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) &&
+ pusharray8(pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end)
+ //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ int arr[12];
+ for(int i=0;idl_tti_request_body.nGroup;i++)
+ {
+ for(int j=0;jdl_tti_request_body.nUe[i];j++)
+ {
+ arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
+ }
+ if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ for(int i=0;idl_tti_request_body.nPDUs;i++)
+ {
+ if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
+
+ //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) &&
+ //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+ {
+ uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+ uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value);
+ uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+ if (!x || !y || !z)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z);
+ }
+
+ return x && y && z;
+ }
+}
+
+static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end)
+{
+ nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
+
+ return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
+
+ return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
+ push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
+
+ return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
+
+ return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+ push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+ push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end));
+}
+
+//Pack fns for ul_tti PDUS
+
+
+static uint8_t pack_ul_tti_request_prach_pdu(nfapi_nr_prach_pdu_t* prach_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return(
+ push16(prach_pdu->phys_cell_id, ppWritePackedMsg, end) &&
+ push8(prach_pdu->num_prach_ocas, ppWritePackedMsg, end) &&
+ push8(prach_pdu->prach_format, ppWritePackedMsg, end) &&
+ push8(prach_pdu->num_ra, ppWritePackedMsg, end) &&
+ push8(prach_pdu->prach_start_symbol, ppWritePackedMsg, end) &&
+ push16(prach_pdu->num_cs, ppWritePackedMsg, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+
+}
+
+static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t* pucch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return(
+ push16(pucch_pdu->rnti, ppWritePackedMsg, end) &&
+ push32(pucch_pdu->handle, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->bwp_size, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->bwp_start, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->format_type, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->prb_start, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->prb_size, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->nr_of_symbols, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->freq_hop_flag, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->second_hop_prb, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->group_hop_flag, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->sequence_hop_flag, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->hopping_id, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->initial_cyclic_shift, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->time_domain_occ_idx, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->pre_dft_occ_idx, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->pre_dft_occ_len, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->add_dmrs_flag, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->dmrs_scrambling_id, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->dmrs_cyclic_shift, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->sr_flag, ppWritePackedMsg, end) &&
+ push8(pucch_pdu->bit_len_harq, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->bit_len_csi_part1, ppWritePackedMsg, end) &&
+ push16(pucch_pdu->bit_len_csi_part2, ppWritePackedMsg, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+
+}
+
+
+static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t* pusch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+
+ if (!(
+ push16(pusch_pdu->pdu_bit_map, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->rnti, ppWritePackedMsg, end) &&
+ push32(pusch_pdu->handle, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->bwp_size, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->bwp_start, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->target_code_rate, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->scid, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->num_dmrs_cdm_grps_no_data, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->resource_alloc, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->resource_alloc,ppWritePackedMsg, end) &&
+ push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->rb_start, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->rb_size, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->vrb_to_prb_mapping, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->frequency_hopping, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->tx_direct_current_location, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->uplink_frequency_shift_7p5khz, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->nr_of_symbols, ppWritePackedMsg, end)
+ // TODO: ignoring beamforming tlv for now
+ ))
+ return 0;
+
+
+ //Pack Optional Data only included if indicated in pduBitmap
+ switch(pusch_pdu->pdu_bit_map){
+ case PUSCH_PDU_BITMAP_PUSCH_DATA:
+ {
+ // pack optional TLVs
+ return(
+ push8(pusch_pdu->pusch_data.rv_index, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_data.harq_process_id, ppWritePackedMsg, end) &&
+ push32(pusch_pdu->pusch_data.tb_size, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->pusch_data.num_cb, ppWritePackedMsg, end) &&
+ pusharray8(pusch_pdu->pusch_data.cb_present_and_position,1,1,ppWritePackedMsg, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_PUSCH_UCI:
+ {
+ return(
+ push16(pusch_pdu->pusch_uci.harq_ack_bit_length, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->pusch_uci.csi_part1_bit_length, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->pusch_uci.csi_part2_bit_length, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_uci.alpha_scaling, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_uci.beta_offset_harq_ack, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_uci.beta_offset_csi1, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_uci.beta_offset_csi2, ppWritePackedMsg, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_PUSCH_PTRS:
+ {
+ return(
+ push8(pusch_pdu->pusch_ptrs.num_ptrs_ports, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ptrs_time_density, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ptrs_freq_density, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->pusch_ptrs.ul_ptrs_power, ppWritePackedMsg, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_DFTS_OFDM:
+ {
+ return(
+ push8(pusch_pdu->dfts_ofdm.low_papr_group_number, ppWritePackedMsg, end) &&
+ push16(pusch_pdu->dfts_ofdm.low_papr_sequence_number, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, ppWritePackedMsg, end) &&
+ push8(pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, ppWritePackedMsg, end)
+ );
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map );
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t* srs_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return(
+ push16(srs_pdu->rnti, ppWritePackedMsg, end) &&
+ push32(srs_pdu->handle, ppWritePackedMsg, end) &&
+ push16(srs_pdu->bwp_size, ppWritePackedMsg, end) &&
+ push16(srs_pdu->bwp_start, ppWritePackedMsg, end) &&
+ push8(srs_pdu->subcarrier_spacing, ppWritePackedMsg, end) &&
+ push8(srs_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
+ push8(srs_pdu->num_ant_ports, ppWritePackedMsg, end) &&
+ push8(srs_pdu->num_symbols, ppWritePackedMsg, end) &&
+ push8(srs_pdu->num_repetitions, ppWritePackedMsg, end) &&
+ push8(srs_pdu->time_start_position, ppWritePackedMsg, end) &&
+ push8(srs_pdu->config_index, ppWritePackedMsg, end) &&
+ push16(srs_pdu->sequence_id, ppWritePackedMsg, end) &&
+ push8(srs_pdu->bandwidth_index, ppWritePackedMsg, end) &&
+ push8(srs_pdu->comb_size, ppWritePackedMsg, end) &&
+ push8(srs_pdu->comb_offset, ppWritePackedMsg, end) &&
+ push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) &&
+ push8(srs_pdu->frequency_position, ppWritePackedMsg, end) &&
+ push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) &&
+ push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) &&
+ push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) &&
+ push8(srs_pdu->resource_type, ppWritePackedMsg, end) &&
+ push16(srs_pdu->t_srs, ppWritePackedMsg, end) &&
+ push16(srs_pdu->t_offset, ppWritePackedMsg, end)
+
+ // TODO: ignoring beamforming tlv for now
+ );
+
+}
+
+static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
+
+ return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
+
+ if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end)))
+ {
+ return 0;
+ }
+
+ switch(cqi_ri_info_rel9->report_type)
+ {
+ case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+ {
+ if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) &&
+ push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end)))
+ {
+ return 0;
+ }
+ }
+ break;
+ case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+ {
+ if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint8_t i;
+ for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
+ {
+ if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint8_t j;
+ for(j = 0; j < 8; ++j)
+ {
+ if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0)
+ return 0;
+ }
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
+ }
+ break;
+ };
+
+ return 1;
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
+
+ switch(cqi_ri_info_rel13->report_type)
+ {
+ case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+ {
+ if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0)
+ return 0;
+ }
+ break;
+ case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+ {
+ // No parameters
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type );
+ }
+ break;
+ };
+
+ return 1;
+}
+
+static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
+
+ return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) &&
+ push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value);
+}
+
+static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
+
+ return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) &&
+ push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) &&
+ push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
+
+ return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
+
+ return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) &&
+ push16(ue_info_rel8->rnti, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
+
+ return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) &&
+ push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
+
+ return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) &&
+ push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) &&
+ push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) &&
+ push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value));
+}
+
+static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
+
+ return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) &&
+ push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) &&
+ push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
+ push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+ push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) &&
+ push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) &&
+ push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
+
+ return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+ push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
+
+ return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) &&
+ push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) &&
+ push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) &&
+ push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) &&
+ push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) &&
+ push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) &&
+ push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
+
+ return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) &&
+ push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) &&
+ push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) &&
+ push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) &&
+ push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
+
+ return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) &&
+ push8(harq_info_rel13->n_srs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
+
+ return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
+
+ return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) &&
+ push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
+}
+static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
+
+ return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) &&
+ push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) &&
+ push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value));
+
+}
+
+static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
+ return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end);
+}
+static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
+
+ return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) &&
+ push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value));
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
+
+ return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) &&
+ push16(srs_pdu_rel8->size, ppWritePackedMsg, end) &&
+ push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) &&
+ push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
+ return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end);
+}
+
+static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
+
+ return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
+
+ return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
+
+ return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) &&
+ push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) &&
+ push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) &&
+ push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
+ push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) &&
+ push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) &&
+ push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) &&
+ pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value));
+}
+static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
+
+ return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) &&
+ push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) &&
+ push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end));
+
+}
+
+static uint8_t pack_ul_tti_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_ul_tti_request_number_of_pdus_t* value = (nfapi_nr_ul_tti_request_number_of_pdus_t*)tlv;
+
+ if(!(push16(value->pdu_size, ppWritePackedMsg, end) &&
+ push16(value->pdu_type, ppWritePackedMsg, end) ))
+ return 0;
+
+
+ // first match the pdu type, then call the respective function
+ switch(value->pdu_type)
+ {
+ case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
+ {
+ if(!pack_ul_tti_request_prach_pdu(&value->prach_pdu, ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
+ {
+ if(!pack_ul_tti_request_pucch_pdu(&value->pucch_pdu, ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
+ {
+ if(!pack_ul_tti_request_pusch_pdu(&value->pusch_pdu, ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
+ {
+ if(!pack_ul_tti_request_srs_pdu(&value->srs_pdu, ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", value->pdu_type );
+ }
+ break;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_ul_tti_groups_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_ul_tti_request_number_of_groups_t* value = (nfapi_nr_ul_tti_request_number_of_groups_t*)tlv;
+
+ if(!push8(value->n_ue, ppWritePackedMsg, end))
+ return 0;
+ for(int i=0; in_ue;i++)
+ {
+ if(!push8(value->ue_list[i].pdu_idx, ppWritePackedMsg, end))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
+
+ if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) &&
+ push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) &&
+ push8(value->srs_present, ppWritePackedMsg, end)))
+ return 0;
+
+ uint16_t i = 0;
+ for(i = 0; i < value->number_of_pdus; ++i)
+ {
+ nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
+
+ if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+ if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
+ {
+ if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
+ {
+ if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) &&
+ pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) &&
+ pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value)))
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+
+ }
+ return 1;
+}
+
+static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg;
+
+ if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->n_pdus , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->n_group, ppWritePackedMsg, end) ))
+ return 0;
+
+ for(int i=0; in_pdus; i++)
+ {
+ if(!pack_ul_tti_pdu_list_value(&pNfapiMsg->pdus_list[i], ppWritePackedMsg, end))
+ return 0;
+ }
+
+ for(int i=0; in_group; i++)
+ {
+ if(!pack_ul_tti_groups_list_value(&pNfapiMsg->groups_list[i], ppWritePackedMsg, end))
+ return 0;
+
+ }
+
+ return 1;
+}
+
+static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ;
+}
+
+static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
+
+ return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+ push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+ push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) &&
+ push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) &&
+ push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
+
+ return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) &&
+ push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
+
+ return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) &&
+ push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) &&
+ push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) &&
+ push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
+
+ return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) &&
+ push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
+
+ return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) &&
+ push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
+
+ return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) &&
+ push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) &&
+ push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) &&
+ push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) &&
+ push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) &&
+ push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) &&
+ push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) &&
+ pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end));
+
+}
+
+static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
+
+ return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) &&
+ push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) &&
+ push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
+
+ if(!(push16(value->sfnsf, ppWritePackedMsg, end) &&
+ push8(value->number_of_dci, ppWritePackedMsg, end) &&
+ push8(value->number_of_hi, ppWritePackedMsg, end)))
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
+
+ if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+ if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_HI_DCI0_HI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_HI_DCI0_DCI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value)))
+ return 0;
+ }
+ break;
+ case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
+ {
+ if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value)))
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+
+ }
+
+ return 1;
+}
+
+static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv;
+
+ for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
+ {
+ if(!(push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, ppWritePackedMsg, end) &&
+
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) &&
+
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
+
+ pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
+
+ return 0;
+ }
+
+ return (push16(value->PDUType, ppWritePackedMsg, end) &&
+ push16(value->PDUSize, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, ppWritePackedMsg, end) &&
+
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, ppWritePackedMsg, end) &&
+ pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, ppWritePackedMsg, end) &&
+
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, ppWritePackedMsg, end) &&
+ push8(value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, ppWritePackedMsg, end) &&
+ push16(value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, ppWritePackedMsg, end));
+
+}
+
+static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg;
+
+ if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->numPdus, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; inumPdus; i++)
+ {
+ if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end))
+ return 0;
+ }
+ return 1;
+
+
+}
+
+static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+//pack_tx_data_pdu_list_value
+static uint8_t pack_tx_data_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_pdu_t* value = (nfapi_nr_pdu_t*)tlv;
+
+ if(!(push32(value->num_TLV, ppWritePackedMsg, end) &&
+ push16(value->PDU_index, ppWritePackedMsg, end) &&
+ push16(value->PDU_length, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_tlvs = value->num_TLV;
+ for(; i < total_number_of_tlvs; ++i)
+ {
+
+ if (!(push16(value->TLVs[i].length, ppWritePackedMsg, end) &&
+ push16(value->TLVs[i].tag, ppWritePackedMsg, end)))
+ return 0;
+
+ switch(value->TLVs[i].tag)
+ {
+ case 0:
+ {
+ if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end))
+ return 0;
+ break;
+
+ }
+
+ case 1:
+ {
+ if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length , value->TLVs[i].length, ppWritePackedMsg, end))
+ return 0;
+ break;
+
+ }
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", value->TLVs[i].tag );
+ break;
+ }
+
+ }
+ }
+ return 1;
+}
+
+static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv;
+
+ if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]);
+
+ if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) &&
+ push16(pdu->pdu_index, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t j;
+ for(j = 0; j < pdu->num_segments; ++j)
+ {
+ // Use -1 as it is unbounded
+ // DJP - does not handle -1
+ // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
+ int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
+
+ if (pdu->segments[j].segment_length == 3)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
+ pdu->segments[j].segment_data[0],
+ pdu->segments[j].segment_data[1],
+ pdu->segments[j].segment_data[2]
+ );
+ }
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret);
+
+ if (push_ret == 0)
+ {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg;
+
+ if (!(
+ push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->Number_of_PDUs, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; iNumber_of_PDUs; i++)
+ {
+ if(!pack_tx_data_pdu_list_value(&pNfapiMsg->pdu_list[i], ppWritePackedMsg, end))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
+
+ int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+ int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value);
+ int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z);
+
+ return x && y && z;
+}
+
+static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
+ if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
+ return 0;
+ }
+
+ uint8_t j;
+ uint16_t num = value->number_of_TLVs;
+ for(j = 0; j < num; ++j){
+ if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
+ int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
+ int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
+ int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+ return x && y && z;
+}
+
+static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+
+ nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
+
+ int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
+ int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
+ return x && z;
+}
+
+static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) );
+}
+
+static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
+
+ return ( pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(data->value_0, ppWritePackedMsg, end) &&
+ push8(data->value_1, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(data->value_0, ppWritePackedMsg, end) &&
+ push8(data->value_1, ppWritePackedMsg, end) &&
+ push8(data->value_2, ppWritePackedMsg, end) &&
+ push8(data->value_3, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(data->value_0, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ return ( push8(data->value_0, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv;
+
+ if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) &&
+ push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t result = 0;
+ switch(harq_indication_tdd_rel8->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = 1;
+ break;
+ default:
+ // err....
+ break;
+ }
+
+ return result;
+
+}
+
+static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv;
+
+ if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) &&
+ push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t idx;
+ for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx)
+ {
+ uint8_t result = 0;
+
+ switch(harq_indication_tdd_rel9->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end);
+ break;
+ default:
+ // err....
+ break;
+ }
+
+ if(result == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv;
+
+ if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) &&
+ push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t idx;
+ for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx)
+ {
+ uint8_t result = 0;
+ switch(harq_indication_tdd_rel13->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
+ result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end);
+ break;
+ default:
+ // err....
+ break;
+ }
+
+ if(result == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv;
+
+ return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) &&
+ push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv;
+
+ return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) &&
+ push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) &&
+ pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv;
+
+ return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) &&
+ push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) &&
+ pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
+
+ return ( push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push8(value->channel, ppWritePackedMsg, end));
+
+}
+
+static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
+
+ if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_harqs;
+ assert(total_number_of_pdus <= NFAPI_HARQ_IND_MAX_PDU);
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) &&
+ pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
+
+ return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
+
+ if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_crcs;
+ assert(total_number_of_pdus <= NFAPI_CRC_IND_MAX_PDU);
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+ return 1;
+}
+
+static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
+
+ return ( push16(value->length, ppWritePackedMsg, end) &&
+ push16(value->offset, ppWritePackedMsg, end) &&
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end));
+}
+static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
+
+ return ( push16(value->timing_advance_r9, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
+
+ //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "RX ULSCH BODY\n");
+
+ if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // need to calculate the data offset's.
+ uint16_t i = 0;
+ uint16_t offset = 2; // taking into account the number_of_pdus
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "ULSCH:pdus:%d\n", total_number_of_pdus);
+
+ assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+ if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_UE_INFORMATION_TAG\n");
+ offset += 4 + 6;
+ }
+
+ if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_INDICATION_REL8_TAG\n");
+ offset += 4 + 7;
+ }
+
+ if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_INDICATION_REL9_TAG\n");
+ offset += 4 + 2;
+ }
+ }
+
+ // Now update the structure to include the offset
+ assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
+ for(i =0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+
+ if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ if(pdu->rx_indication_rel8.offset == 1)
+ {
+ pdu->rx_indication_rel8.offset = offset;
+ offset += pdu->rx_indication_rel8.length;
+ }
+ }
+ }
+
+ // Write out the pdu
+ assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) &&
+ pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value)))
+ return 0;
+ }
+
+ // Write out the pdu data
+ assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ uint16_t length = 0;
+ nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
+
+ if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ length = pdu->rx_indication_rel8.length;
+ }
+
+ if( pusharray8(value->rx_pdu_list[i].rx_ind_data, NFAPI_RX_IND_DATA_MAX, length, ppWritePackedMsg, end) == 0)
+ return 0;
+ }
+ return 1;
+}
+
+
+static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
+
+ return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) &&
+ push8(preamble_rel8->preamble, ppWritePackedMsg, end) &&
+ push16(preamble_rel8->timing_advance, ppWritePackedMsg, end));
+}
+static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
+
+ return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) );
+}
+static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
+
+ return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
+
+ if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_preambles;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) &&
+ pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) &&
+ pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
+
+ return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) &&
+ push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) &&
+ push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) &&
+ pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
+
+ return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
+
+ return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) );
+
+}
+
+static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
+
+ return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ;
+}
+
+static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
+
+ if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) &&
+ push8(value->number_of_subbands, ppWritePackedMsg, end) &&
+ push8(value->num_atennas, ppWritePackedMsg, end)))
+ return 0;
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_subbands; ++idx)
+ {
+ if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) &&
+ pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end)))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv;
+
+ if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_ues;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) &&
+ pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) &&
+ pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) &&
+ pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) &&
+ pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
+
+ if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_srs;
+ assert(total_number_of_pdus <= NFAPI_SR_IND_MAX_PDU);
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+ return 1;
+}
+
+static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
+
+ return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) &&
+ push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) &&
+ push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
+
+ return ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) &&
+ push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) &&
+ push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
+ pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) &&
+ push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
+
+ if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // need to calculate the data offset's. This very bittle due the hardcoding
+ // of the sizes. can not use the sizeof as we have an array for the Rel9
+ // info
+ uint16_t i = 0;
+ uint16_t offset = 2; // taking into account the number_of_cqis
+ uint16_t total_number_of_pdus = value->number_of_cqis;
+ assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+ offset += 2; // for the instance length
+
+ if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG)
+ {
+ offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t)
+ }
+
+ if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+ {
+ offset += 4 + 8;
+ }
+
+ if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+ {
+ offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported;
+ }
+
+ if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG)
+ {
+ offset += 4 + 2;
+ }
+ }
+
+ // Now update the structure to include the offset
+ assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
+ for(i =0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+ if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+ {
+ if(pdu->cqi_indication_rel8.data_offset == 1)
+ {
+ pdu->cqi_indication_rel8.data_offset = offset;
+ offset += pdu->cqi_indication_rel8.length;
+ }
+ }
+
+ if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+ {
+ if(pdu->cqi_indication_rel9.data_offset == 1)
+ {
+ pdu->cqi_indication_rel9.data_offset = offset;
+ offset += pdu->cqi_indication_rel9.length;
+ }
+ }
+
+ }
+
+ // Write out the cqi information
+ assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) &&
+ pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) &&
+ pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+
+ }
+
+ // Write out the cqi raw data
+ assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ uint16_t length = 0;
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+
+ if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+ {
+ length = pdu->cqi_indication_rel8.length;
+ }
+
+ if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+ {
+ length = pdu->cqi_indication_rel9.length;
+ }
+
+ if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+
+}
+
+static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push32(value->mp_cca, ppWritePackedMsg, end) &&
+ push32(value->n_cca, ppWritePackedMsg, end) &&
+ push32(value->offset, ppWritePackedMsg, end) &&
+ push32(value->lte_txop_sf, ppWritePackedMsg, end) &&
+ push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) &&
+ push32(value->lbt_mode, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push32(value->offset, ppWritePackedMsg, end) &&
+ push16(value->sfn_sf_end, ppWritePackedMsg, end) &&
+ push32(value->lbt_mode, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
+
+ if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
+
+ if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+ if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
+ {
+ if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0)
+ return 0;
+ }
+ break;
+ case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
+ {
+ if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0)
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push32(value->result, ppWritePackedMsg, end) &&
+ push32(value->lte_txop_symbols, ppWritePackedMsg, end) &&
+ push32(value->initial_partial_sf, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
+
+ return ( push32(value->handle, ppWritePackedMsg, end) &&
+ push32(value->result, ppWritePackedMsg, end));
+}
+
+static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
+
+ if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(; i < total_number_of_pdus; ++i)
+ {
+ nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
+
+ if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ // Put a 0 size in and then determine the size after the pdu
+ // has been writen and write the calculated size
+ uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg;
+ pdu->pdu_size = 0;
+
+ if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
+ {
+ if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0)
+ return 0;
+ }
+ break;
+ case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
+ {
+ if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0)
+ return 0;
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+
+ // add 1 for the pdu_type. The delta will include the pdu_size
+ pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize);
+ push8(pdu->pdu_size, &pWritePackedMsgPduSize, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
+
+ return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) );
+}
+
+static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
+
+ if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_harqs = value->number_of_harqs;
+ for(; i < total_number_of_harqs; ++i)
+ {
+ nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
+
+ uint8_t* instance_length_p = *ppWritePackedMsg;
+ if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ return 0;
+
+ if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) &&
+ pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) &&
+ pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+
+static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
+
+ return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) &&
+ push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) &&
+ push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) &&
+ push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end));
+}
+
+
+static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
+
+ if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected;
+ for(; i < total_number_of_initial_scs_detected; ++i)
+ {
+ nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
+
+ //uint8_t* instance_length_p = *ppWritePackedMsg;
+ //if(!push16(pdu->instance_length, ppWritePackedMsg, end))
+ // return 0;
+
+ if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value)))
+ return 0;
+
+ // calculate the instance length subtracting the size of the instance
+ // length feild
+ //uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2;
+ //push16(instance_length, &instance_length_p, end);
+ }
+
+ return 1;
+}
+
+static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
+
+ return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
+ pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg;
+
+ return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
+
+ return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg;
+
+ return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
+
+ return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->t2, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->t3, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
+
+ return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg;
+
+ return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) &&
+ push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) &&
+ pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) &&
+ pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config));
+}
+
+
+//NR UPLINK indication function packing
+
+//RX DATA INDICATION
+
+static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_rx_data_pdu_t* value = (nfapi_nr_rx_data_pdu_t*)tlv;
+
+ if(!(push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->harq_id, ppWritePackedMsg, end) &&
+ push16(value->pdu_length, ppWritePackedMsg, end) &&
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push16(value->rssi, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ if(pusharray8(value->pdu, value->pdu_length, value->pdu_length, ppWritePackedMsg, end) == 0)
+ return 0;
+
+ return 1;
+}
+
+static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
+
+ if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
+ {
+ if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
+ return 0;
+ }
+
+ return 1;
+}
+
+//NR CRC INDICATION
+
+static uint8_t pack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+
+ if(!(push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->harq_id, ppWritePackedMsg, end) &&
+ push8(value->tb_crc_status, ppWritePackedMsg, end) &&
+ push16(value->num_cb, ppWritePackedMsg, end) &&
+ //pusharray8(value->cb_crc_status, (int)(value->num_cb / 8) + 1, (int)(value->num_cb / 8) + 1, ppWritePackedMsg, end) && //length is ceil(NumCb/8)
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push16(value->rssi, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ return 1;
+}
+
+static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
+
+ if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->number_crcs, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for (int i = 0; i < pNfapiMsg->number_crcs; i++)
+ {
+ if(!pack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppWritePackedMsg, end))
+ return 0;
+ }
+
+return 1;
+}
+
+//SRS INDICATION
+
+static uint8_t pack_nr_srs_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_srs_indication_pdu_t* value = (nfapi_nr_srs_indication_pdu_t*)tlv;
+
+ if(!(push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push8(value->num_symbols, ppWritePackedMsg, end) &&
+ push8(value->wide_band_snr, ppWritePackedMsg, end) &&
+ push8(value->num_reported_symbols, ppWritePackedMsg, end) &&
+ push8(value->reported_symbol_list->num_rbs, ppWritePackedMsg, end)
+ ))
+ return 0;
+ for(int i = 0; i < value->reported_symbol_list->num_rbs; i++)
+ {
+ if(!(push8(value->reported_symbol_list->rb_list->rb_snr, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
+
+ if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; inumber_of_pdus;i++)
+ {
+ if(!pack_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+//RACH INDICATION
+
+static uint8_t pack_nr_rach_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
+
+ if(!(push16(value->phy_cell_id, ppWritePackedMsg, end) &&
+ push8(value->symbol_index, ppWritePackedMsg, end) &&
+ push8(value->slot_index, ppWritePackedMsg, end) &&
+ push8(value->freq_index, ppWritePackedMsg, end) &&
+ push8(value->avg_rssi, ppWritePackedMsg, end) &&
+ push8(value->avg_snr, ppWritePackedMsg, end) &&
+ push8(value->num_preamble, ppWritePackedMsg, end)
+ ))
+ return 0;
+ for(int i = 0; i < value->num_preamble; i++)
+ {
+ if(!(push8(value->preamble_list[i].preamble_index, ppWritePackedMsg, end) &&
+ push16(value->preamble_list[i].timing_advance, ppWritePackedMsg, end) &&
+ push32(value->preamble_list[i].preamble_pwr, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
+
+ if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
+ push8(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for(int i=0; inumber_of_pdus;i++)
+ {
+ if(!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+
+//UCI INDICATION
+
+static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
+
+ if(!(push8(value->pduBitmap, ppWritePackedMsg, end) &&
+ push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->pucch_format, ppWritePackedMsg, end) &&
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push16(value->rssi, ppWritePackedMsg, end)
+ ))
+ return 0;
+ if (value->pduBitmap & 0x01) { //SR
+ if (!(push8(value->sr->sr_indication, ppWritePackedMsg, end) &&
+ push8(value->sr->sr_confidence_level, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
+ if (!(push8(value->harq->num_harq, ppWritePackedMsg, end) &&
+ push8(value->harq->harq_confidence_level, ppWritePackedMsg, end)
+ ))
+ return 0;
+ for (int i = 0; i < value->harq->num_harq; i++)
+ {
+ if (!(push8(value->harq->harq_list[i].harq_value, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
+ nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
+
+ if(!(push8(value->pduBitmap, ppWritePackedMsg, end) &&
+ push32(value->handle, ppWritePackedMsg, end) &&
+ push16(value->rnti, ppWritePackedMsg, end) &&
+ push8(value->pucch_format, ppWritePackedMsg, end) &&
+ push8(value->ul_cqi, ppWritePackedMsg, end) &&
+ push16(value->timing_advance, ppWritePackedMsg, end) &&
+ push16(value->rssi, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ if (value->pduBitmap & 0x01) { //SR
+ if(!(push8(value->sr.sr_bit_len, ppWritePackedMsg, end) &&
+ pusharray8(value->sr.sr_payload, (int)(value->sr.sr_bit_len / 8) + 1, (int)(value->sr.sr_bit_len / 8) + 1, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
+ if(!(push8(value->harq.harq_crc, ppWritePackedMsg, end) &&
+ push8(value->harq.harq_bit_len, ppWritePackedMsg, end) &&
+ pusharray8(value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8) + 1, (int)(value->harq.harq_bit_len / 8) + 1, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
+ if(!(push8(value->csi_part1.csi_part1_crc, ppWritePackedMsg, end) &&
+ push8(value->csi_part1.csi_part1_bit_len, ppWritePackedMsg, end) &&
+ pusharray8(value->csi_part1.csi_part1_payload, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
+ if(!(push8(value->csi_part2.csi_part2_crc, ppWritePackedMsg, end) &&
+ push8(value->csi_part2.csi_part2_bit_len, ppWritePackedMsg, end) &&
+ pusharray8(value->csi_part2.csi_part2_payload, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, ppWritePackedMsg, end)
+ ))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
+{
+ nfapi_nr_uci_t* value = (nfapi_nr_uci_t*)tlv;
+
+ if(!(push16(value->pdu_type, ppWritePackedMsg, end) &&
+ push16(value->pdu_size, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ switch (value->pdu_type) {
+ case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
+ NFAPI_TRACE(NFAPI_TRACE_WARN, "Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
+ break;
+
+ case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
+ nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &value->pucch_pdu_format_0_1;
+ if (!pack_nr_uci_pucch_0_1(uci_pdu, ppWritePackedMsg, end))
+ return 0;
+ break;
+ }
+ case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
+ nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
+ if (!pack_nr_uci_pucch_2_3_4(uci_pdu, ppWritePackedMsg, end))
+ return 0;
+ break;
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
+
+ if (!(push16(pNfapiMsg->sfn , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
+ push16(pNfapiMsg->num_ucis, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ for (int i = 0; i < pNfapiMsg->num_ucis; i++)
+ {
+ if (!pack_nr_uci_indication_body(&(pNfapiMsg->uci_list[i]), ppWritePackedMsg, end))
+ return 0;
+ }
+
+return 1;
+}
+
+// Main pack function - public
+
+int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
+{
+ nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
+ uint8_t *pWritePackedMessage = pPackedBuf;
+ uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+ uint8_t *end = pPackedBuf + packedBufLen;
+
+ if (pMessageBuf == NULL || pPackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
+ return -1;
+ }
+ // process the header
+ if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
+ push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
+ push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
+ push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
+ push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
+ push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
+ return -1;
+ }
+
+ if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
+ }
+ // look for the specific message
+ uint8_t result = 0;
+ switch (pMessageHeader->message_id)
+ {
+ case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
+ result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
+ result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+ case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
+ result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+ case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
+ result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
+ result = pack_nr_rx_data_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
+ result = pack_nr_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
+ result = pack_nr_uci_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
+ result = pack_nr_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
+ result = pack_nr_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
+ result = pack_nr_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
+ result = pack_nr_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_TIMING_INFO:
+ result = pack_nr_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ default:
+ {
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+ {
+ if(config && config->pack_p7_vendor_extension)
+ {
+ result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ break;
+ }
+
+ if(result == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
+ return -1;
+ }
+
+ // check for a valid message length
+ uintptr_t msgHead = (uintptr_t)pPackedBuf;
+ uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
+ uint32_t packedMsgLen = msgEnd - msgHead;
+ uint16_t packedMsgLen16;
+ if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
+ return -1;
+ }
+ else
+ {
+ packedMsgLen16 = (uint16_t)packedMsgLen;
+ }
+
+ // Update the message length in the header
+ pMessageHeader->message_length = packedMsgLen16;
+
+ if(!push16(packedMsgLen16, &pPackedLengthField, end))
+ return -1;
+
+ if(1)
+ {
+ //quick test
+ if(pMessageHeader->message_length != packedMsgLen)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
+ }
+ }
+
+ return (packedMsgLen);
+}
+
+int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config)
+{
+ nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
+ uint8_t *pWritePackedMessage = pPackedBuf;
+ uint8_t *pPackedLengthField = &pWritePackedMessage[4];
+ uint8_t *end = pPackedBuf + packedBufLen;
+
+ if (pMessageBuf == NULL || pPackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
+ return -1;
+ }
+ // process the header
+ if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
+ push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
+ push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) &&
+ push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) &&
+ push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) &&
+ push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end)))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n");
+ return -1;
+ }
+
+ if (pMessageHeader->message_id != NFAPI_TIMING_INFO)
+ {
+ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp);
+ }
+ // look for the specific message
+ uint8_t result = 0;
+ switch (pMessageHeader->message_id)
+ {
+ case NFAPI_DL_CONFIG_REQUEST:
+ result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UL_CONFIG_REQUEST:
+ result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+ case NFAPI_TX_REQUEST:
+ result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+ case NFAPI_HI_DCI0_REQUEST:
+ result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_DL_NODE_SYNC:
+ result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_UL_NODE_SYNC:
+ result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ case NFAPI_TIMING_INFO:
+ result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
+ break;
+
+ default:
+ {
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+ {
+ if(config && config->pack_p7_vendor_extension)
+ {
+ result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config);
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ break;
+ }
+
+ if(result == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n");
+ return -1;
+ }
+
+ // check for a valid message length
+ uintptr_t msgHead = (uintptr_t)pPackedBuf;
+ uintptr_t msgEnd = (uintptr_t)pWritePackedMessage;
+ uint32_t packedMsgLen = msgEnd - msgHead;
+ uint16_t packedMsgLen16;
+ if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen);
+ return -1;
+ }
+ else
+ {
+ packedMsgLen16 = (uint16_t)packedMsgLen;
+ }
+
+ // Update the message length in the header
+ pMessageHeader->message_length = packedMsgLen16;
+
+ if(!push16(packedMsgLen16, &pPackedLengthField, end))
+ return -1;
+
+ if(1)
+ {
+ //quick test
+ if(pMessageHeader->message_length != packedMsgLen)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id);
+ }
+ }
+
+ return (packedMsgLen);
+}
+
+// Unpack routines
+// NR:
+static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &value->bwp_size, end) &&
+ pull16(ppReadPackedMsg, &value->bwp_start, end) &&
+
+ pull8(ppReadPackedMsg, &value->subcarrier_spacing, end) &&
+ pull8(ppReadPackedMsg, &value->cyclic_prefix, end) &&
+
+ pull16(ppReadPackedMsg, &value->start_rb, end) &&
+ pull16(ppReadPackedMsg, &value->nr_of_rbs, end) &&
+
+ pull8(ppReadPackedMsg, &value->csi_type, end) &&
+ pull8(ppReadPackedMsg, &value->row, end) &&
+
+ pull16(ppReadPackedMsg, &value->freq_domain, end) &&
+ pull8(ppReadPackedMsg, &value->symb_l0, end) &&
+
+ pull8(ppReadPackedMsg, &value->symb_l1, end) &&
+ pull8(ppReadPackedMsg, &value->cdm_type, end) &&
+
+ pull8(ppReadPackedMsg, &value->freq_density, end) &&
+ pull16(ppReadPackedMsg, &value->scramb_id, end) &&
+
+ pull8(ppReadPackedMsg, &value->power_control_offset, end) &&
+ pull8(ppReadPackedMsg, &value->power_control_offset_ss, end)
+ );
+
+}
+
+
+static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
+
+ for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
+ {
+ if(!(pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) &&
+ pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingId, end) &&
+
+ pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingRNTI, end) &&
+ pull8(ppReadPackedMsg, &value->dci_pdu[i].CceIndex, end) &&
+ pull8(ppReadPackedMsg, &value->dci_pdu[i].AggregationLevel, end) &&
+ pull8(ppReadPackedMsg, &value->dci_pdu[i].beta_PDCCH_1_0, end) &&
+
+ pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) &&
+ pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) &&
+
+ pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, end)))
+
+ return 0;
+ }
+
+ // TODO: resolve the packaging of array (currently sending a single element)
+ return(
+ pull16(ppReadPackedMsg, &value->BWPSize, end) &&
+ pull16(ppReadPackedMsg, &value->BWPStart, end) &&
+ pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) &&
+ pull8(ppReadPackedMsg, &value->CyclicPrefix, end) &&
+
+ pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) &&
+ pull8(ppReadPackedMsg, &value->DurationSymbols, end) &&
+ pullarray8(ppReadPackedMsg, value->FreqDomainResource, 6, 6, end) &&
+ pull8(ppReadPackedMsg, &value->CceRegMappingType, end) &&
+
+ pull8(ppReadPackedMsg, &value->RegBundleSize, end) &&
+ pull8(ppReadPackedMsg, &value->InterleaverSize, end) &&
+ pull8(ppReadPackedMsg, &value->CoreSetType, end) &&
+ pull16(ppReadPackedMsg, &value->ShiftIndex, end) &&
+
+ pull8(ppReadPackedMsg, &value->precoderGranularity, end) &&
+ pull16(ppReadPackedMsg, &value->numDlDci, end));
+
+}
+
+
+static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
+
+ // TODO: resolve the packaging of array (currently sending a single element)
+ return(
+ pull16(ppReadPackedMsg, &value->pduBitmap, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull16(ppReadPackedMsg, &value->pduIndex, end) &&
+ pull16(ppReadPackedMsg, &value->BWPSize, end) &&
+
+ pull16(ppReadPackedMsg, &value->BWPStart, end) &&
+ pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) &&
+ pull8(ppReadPackedMsg, &value->CyclicPrefix, end) &&
+ pull8(ppReadPackedMsg, &value->NrOfCodewords, end) &&
+
+ pullarray16(ppReadPackedMsg, value->targetCodeRate, 2, 1, end) &&
+ pullarray8(ppReadPackedMsg, value->qamModOrder, 2, 1, end) &&
+ pullarray8(ppReadPackedMsg, value->mcsIndex, 2, 1, end) &&
+ pullarray8(ppReadPackedMsg, value->mcsTable, 2, 1, end) &&
+
+ pullarray8(ppReadPackedMsg, value->rvIndex, 2, 1, end) &&
+ pullarray32(ppReadPackedMsg, value->TBSize, 2, 1, end) &&
+ pull16(ppReadPackedMsg, &value->dataScramblingId, end) &&
+ pull8(ppReadPackedMsg, &value->nrOfLayers, end) &&
+
+ pull8(ppReadPackedMsg, &value->transmissionScheme, end) &&
+ pull8(ppReadPackedMsg, &value->refPoint, end) &&
+ pull16(ppReadPackedMsg, &value->dlDmrsSymbPos, end) &&
+ pull8(ppReadPackedMsg, &value->dmrsConfigType, end) &&
+
+ pull16(ppReadPackedMsg, &value->dlDmrsScramblingId, end) &&
+ pull8(ppReadPackedMsg, &value->SCID, end) &&
+ pull8(ppReadPackedMsg, &value->numDmrsCdmGrpsNoData, end) &&
+ pull16(ppReadPackedMsg, &value->dmrsPorts, end) &&
+
+ pull8(ppReadPackedMsg, &value->resourceAlloc, end) &&
+ pull16(ppReadPackedMsg, &value->rbStart, end) &&
+ pull16(ppReadPackedMsg, &value->rbSize, end) &&
+
+ pull8(ppReadPackedMsg, &value->VRBtoPRBMapping, end) &&
+ pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) &&
+ pull8(ppReadPackedMsg, &value->NrOfSymbols, end) &&
+ pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) &&
+
+ pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) &&
+ pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) &&
+ pull8(ppReadPackedMsg, &value->PTRSReOffset, end)
+ );
+
+}
+
+
+static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &value->PhysCellId, end) &&
+ pull8(ppReadPackedMsg, &value->BetaPss, end) &&
+ pull8(ppReadPackedMsg, &value->SsbBlockIndex, end) &&
+ pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) &&
+ pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) &&
+ pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) &&
+ pull32(ppReadPackedMsg, &value->bchPayload, end) &&
+ pull8(ppReadPackedMsg, &value->ssbRsrp, end)
+ // TODO: pack precoding_and_beamforming too
+ );
+
+}
+
+
+// LTE:
+static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) &&
+ pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+ pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end));
+
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end));
+}
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) &&
+ pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end));
+}
+
+static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end)
+{
+ if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
+ pull8(ppReadPackedMsg, &value->num_antennas, end)))
+ return 0;
+
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_subbands; ++idx)
+ {
+ nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]);
+
+ if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) &&
+ pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end)))
+ return 0;
+
+ uint8_t antenna_idx = 0;
+ uint8_t scheduled_ue_idx = 0;
+
+ for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx)
+ {
+ for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx)
+ {
+ if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end))
+ return 0;
+ }
+ }
+
+ }
+
+
+ return 1;
+
+}
+
+
+static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv;
+
+ // If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been
+ // added
+ uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5;
+ dci_dl_pdu_rel13->tpm_struct_flag = 0;
+
+ return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) &&
+ pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) &&
+ ( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) &&
+ ( (tpm_struct_flag_present == 1 && dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1));
+
+}
+
+static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) &&
+ pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) &&
+ pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) &&
+ pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end));
+}
+
+static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv;
+
+ if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+ pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) &&
+ pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end)))
+ return 0;
+
+ uint16_t j = 0;
+ for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j)
+ {
+ if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) &&
+ pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end)))
+ return 0;
+ }
+ return 1;
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv;
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) );
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
+ pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ;
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end));
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end));
+}
+static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) &&
+ pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) &&
+ pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end));
+}
+
+static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) &&
+ pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) &&
+ pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) &&
+ pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end));
+}
+static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) &&
+ pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end));
+}
+
+static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) &&
+ pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) &&
+ pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) &&
+ pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end));
+}
+
+static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) &&
+ pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) &&
+ pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) &&
+ pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) &&
+ pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) &&
+ pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end));
+}
+
+static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv;
+
+ if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) &&
+ pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) &&
+ pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end)))
+ return 0;
+
+
+ uint16_t idx =0;
+ for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx)
+ {
+ if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end)))
+ return 0;
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n");
+ //pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??);
+ }
+ return 1;
+}
+
+static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) &&
+ pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) &&
+ pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) &&
+ pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end));
+}
+
+static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) &&
+ pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end));
+}
+
+static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv;
+
+
+ return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) &&
+ pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) &&
+ pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) &&
+ pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end));
+}
+
+
+static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) &&
+ pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) &&
+ pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end));
+}
+
+static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) &&
+ pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end));
+}
+
+static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) &&
+ pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) &&
+ pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) &&
+ pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) &&
+ pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end));
+}
+
+
+static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)msg;
+
+ if(!(pull32(ppReadPackedMsg, &value->PDUSize, end) &&
+ pull16(ppReadPackedMsg, &value->PDUType, end) ))
+ return 0;
+
+
+ // first match the pdu type, then call the respective function
+ switch(value->PDUType)
+ {
+ case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
+ {
+ if(!(unpack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppReadPackedMsg,end)))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
+ {
+ if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end)))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
+ {
+ if(!(unpack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppReadPackedMsg,end)))
+ return 0;
+ }
+ break;
+ case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
+ {
+ if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end)))
+ return 0;
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType );
+ }
+ break;
+ }
+
+ return 1;
+}
+
+
+
+
+static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) &&
+ pull8(ppReadPackedMsg, &value->number_dci, end) &&
+ pull16(ppReadPackedMsg, &value->number_pdu, end) &&
+ pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) &&
+ pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end)))
+ return 0;
+
+ if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_pdu)
+ {
+ value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config);
+ if(value->dl_config_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu);
+ return 0;
+ }
+ }
+ else
+ {
+ value->dl_config_pdu_list = 0;
+ }
+
+ uint16_t i;
+ uint16_t total_number_of_pdus = value->number_pdu;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ {
+ // pdu end of beyond buffer end
+ return 0;
+ }
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
+ { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value},
+ { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value},
+ { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value},
+ { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value},
+ { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+
+ }
+ break;
+ case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+
+ }
+ break;
+ default:
+ // Need to log an error
+ break;
+ }
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_dl_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg,&pNfapiMsg->SFN, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nGroup, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nPDUs, end) &&
+ pullarray8(ppReadPackedMsg,pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, end)
+ //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
+ ))
+ return 0;
+
+ int arr[12];
+ for(int i=0;idl_tti_request_body.nGroup;i++)
+ {
+ for(int j=0;jdl_tti_request_body.nUe[i];j++)
+ {
+ arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
+ }
+ if(!(pullarrays32(ppReadPackedMsg,arr,12,pNfapiMsg->dl_tti_request_body.nUe[i], end)))
+ return 0;
+ }
+
+ for(int i=0;idl_tti_request_body.nPDUs;i++)
+ {
+ if(!unpack_dl_tti_request_body_value(ppReadPackedMsg, end, &pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i]))
+ return 0;
+ }
+
+return 1;
+}
+
+
+static uint8_t unpack_ul_tti_request_prach_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_prach_pdu_t* prach_pdu = (nfapi_nr_prach_pdu_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &prach_pdu->phys_cell_id, end) &&
+ pull8(ppReadPackedMsg, &prach_pdu->num_prach_ocas, end) &&
+ pull8(ppReadPackedMsg, &prach_pdu->prach_format, end) &&
+ pull8(ppReadPackedMsg, &prach_pdu->num_ra, end) &&
+ pull8(ppReadPackedMsg, &prach_pdu->prach_start_symbol, end) &&
+ pull16(ppReadPackedMsg, &prach_pdu->num_cs, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+}
+
+
+static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_pucch_pdu_t* pucch_pdu = (nfapi_nr_pucch_pdu_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &pucch_pdu->rnti, end) &&
+ pull32(ppReadPackedMsg, &pucch_pdu->handle, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->bwp_size, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->bwp_start, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->subcarrier_spacing, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->nr_of_symbols, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->freq_hop_flag, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->second_hop_prb, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->group_hop_flag, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->sequence_hop_flag, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->hopping_id, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->initial_cyclic_shift, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->data_scrambling_id, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->time_domain_occ_idx, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_idx, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_len, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->add_dmrs_flag, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->dmrs_scrambling_id, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->dmrs_cyclic_shift, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->sr_flag, end) &&
+ pull8(ppReadPackedMsg, &pucch_pdu->bit_len_harq, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part1, end) &&
+ pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part2, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+}
+
+
+static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_pusch_pdu_t* pusch_pdu = (nfapi_nr_pusch_pdu_t*)tlv;
+
+ if (!(
+ pull16(ppReadPackedMsg, &pusch_pdu->pdu_bit_map, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->rnti, end) &&
+ pull32(ppReadPackedMsg, &pusch_pdu->handle, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->bwp_size, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->bwp_start, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->subcarrier_spacing, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->cyclic_prefix, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->target_code_rate, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->scid, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->num_dmrs_cdm_grps_no_data, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc,end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->rb_start, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->rb_size, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->vrb_to_prb_mapping, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->frequency_hopping, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->tx_direct_current_location, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->uplink_frequency_shift_7p5khz, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->start_symbol_index, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->nr_of_symbols, end)
+ // TODO: ignoring beamforming tlv for now
+ ))
+ return 0;
+
+
+ //Pack Optional Data only included if indicated in pduBitmap
+ switch(pusch_pdu->pdu_bit_map){
+ case PUSCH_PDU_BITMAP_PUSCH_DATA:
+ {
+ // pack optional TLVs
+ return(
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.rv_index, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.harq_process_id, end) &&
+ pull32(ppReadPackedMsg, &pusch_pdu->pusch_data.tb_size, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_data.num_cb, end) &&
+ pullarray8(ppReadPackedMsg, pusch_pdu->pusch_data.cb_present_and_position,1,1,end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_PUSCH_UCI:
+ {
+ return(
+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.harq_ack_bit_length, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part1_bit_length, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part2_bit_length, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.alpha_scaling, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_harq_ack, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi1, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi2, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_PUSCH_PTRS:
+ {
+ return(
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.num_ptrs_ports, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, end) &&
++ pull16(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, end) &&
++ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_time_density, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_freq_density, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ul_ptrs_power, end)
+ );
+ }
+ break;
+
+ case PUSCH_PDU_BITMAP_DFTS_OFDM:
+ {
+ return(
+ pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_group_number, end) &&
+ pull16(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_sequence_number, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, end) &&
+ pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, end)
+ );
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map );
+ }
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_srs_pdu_t* srs_pdu = (nfapi_nr_srs_pdu_t*)tlv;
+
+ return(
+ pull16(ppReadPackedMsg, &srs_pdu->rnti, end) &&
+ pull32(ppReadPackedMsg, &srs_pdu->handle, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->bwp_size, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->bwp_start, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->subcarrier_spacing, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->cyclic_prefix, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->num_ant_ports, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->num_symbols, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->num_repetitions, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->time_start_position, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->config_index, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->sequence_id, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->bandwidth_index, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->comb_size, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->t_srs, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu->t_offset, end)
+ // TODO: ignoring beamforming tlv for now
+ );
+}
+
+
+static uint8_t unpack_ul_tti_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_ul_tti_request_number_of_pdus_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_pdus_t*)msg;
+
+ if(!(pull16(ppReadPackedMsg, &pNfapiMsg->pdu_size, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->pdu_type, end) ))
+ return 0;
+
+
+ // first natch the pdu type, then call the respective function
+ switch(pNfapiMsg->pdu_type)
+ {
+
+ case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
+ {
+ if(!unpack_ul_tti_request_prach_pdu(&pNfapiMsg->prach_pdu, ppReadPackedMsg, end))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
+ {
+ if(!unpack_ul_tti_request_pucch_pdu(&pNfapiMsg->pucch_pdu, ppReadPackedMsg, end))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
+ {
+ if(!unpack_ul_tti_request_pusch_pdu(&pNfapiMsg->pusch_pdu, ppReadPackedMsg, end))
+ return 0;
+ }
+ break;
+
+ case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
+ {
+ if(!unpack_ul_tti_request_srs_pdu(&pNfapiMsg->srs_pdu, ppReadPackedMsg, end))
+ return 0;
+ }
+ break;
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", pNfapiMsg->pdu_type );
+ }
+ break;
+
+
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_ul_tti_request_number_of_groups_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_groups_t*)msg;
+
+ if(!pull8(ppReadPackedMsg, &pNfapiMsg->n_ue, end))
+ return 0;
+ for (int i = 0; i < pNfapiMsg->n_ue; i++)
+ {
+ if(!pull8(ppReadPackedMsg, &pNfapiMsg->ue_list[i].pdu_idx ,end) )
+ return 0;
+ }
+ return 1;
+}
+
+
+static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg;
+
+ if (!(
+ pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) ))
+ return 0;
+
+ for(int i=0; i< pNfapiMsg->n_pdus; i++)
+ {
+ if (!unpack_ul_tti_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdus_list[i]))
+ return 0;
+ }
+
+ for(int i=0; i< pNfapiMsg->n_group; i++)
+ {
+ if (!unpack_ul_tti_groups_list_value(ppReadPackedMsg, end, &pNfapiMsg->groups_list[i]))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value},
+ };
+
+ return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end ));
+}
+
+static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) &&
+ pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) &
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end));
+}
+static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel11->dmrs_config_flag, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end));
+}
+static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &ulsch_pdu_rel13->ue_type, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) &&
+ pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) &&
+ pull8(ppReadPackedMsg, &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end));
+}
+static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end));
+}
+
+static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end)))
+ return 0;
+
+ switch(cqi_ri_info_rel9->report_type)
+ {
+ case NFAPI_CSI_REPORT_TYPE_PERIODIC:
+ {
+ if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) &&
+ pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end)))
+ return 0;
+ }
+ break;
+ case NFAPI_CSI_REPORT_TYPE_APERIODIC:
+ {
+ if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0)
+ return 0;
+
+ uint8_t i;
+ for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i)
+ {
+ if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0)
+ return 0;
+
+ uint8_t j;
+ for(j = 0; j < 8; ++j)
+ {
+ if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0)
+ return 0;
+ }
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type );
+ return 0;
+ }
+ break;
+ };
+ return 1;
+}
+
+// NOTE : This function is a little unconventional as we uese the side to
+// determine the report type
+static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv;
+ if(cqi_ri_info_rel13->tl.length == 0)
+ {
+ cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC;
+ }
+ else
+ {
+ cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC;
+ if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0)
+ return 0;
+ }
+ return 1;
+}
+static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) &&
+ pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end));
+}
+static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end));
+}
+
+static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end));
+}
+
+static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) &&
+ pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end));
+}
+static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) &&
+ pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end));
+}
+static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) &&
+ pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) &&
+ pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) &&
+ pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end));
+}
+
+static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end));
+}
+static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) &&
+ pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end));
+}
+static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) &&
+ pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) &&
+ pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end));
+}
+
+static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv;
+
+ return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end));
+}
+
+static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) &&
+ pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) &&
+ pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) &&
+ pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) &&
+ pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) &&
+ pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) &&
+ pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) &&
+ pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) &&
+ pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) &&
+ pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) &&
+ pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) &&
+ pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) &&
+ pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) &&
+ pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) &&
+ pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) &&
+ pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) &&
+ pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) &&
+ pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) &&
+ pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end));
+}
+
+static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) &&
+ pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end));
+}
+
+
+static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end));
+}
+
+static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv;
+ return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end);
+}
+
+static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end));
+}
+
+static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end));
+}
+
+static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) &&
+ pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) &&
+ pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) &&
+ pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) &&
+ pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) &&
+ pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) &&
+ pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end)))
+ return 0;
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value},
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value},
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
+ { NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value},
+ };
+
+ return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0);
+}
+
+static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) &&
+ pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) &&
+ pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end));
+}
+
+
+static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ #define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value},
+
+ #define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value},
+
+ #define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\
+ { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value},
+
+ #define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value},
+
+ #define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value},
+
+ #define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value},
+
+ #define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value},
+
+ #define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value},
+
+ #define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \
+ { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value},
+
+ #define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value},
+
+ #define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \
+ { NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value},
+
+
+ nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) &&
+ pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) &&
+ pull8(ppReadPackedMsg, &value->srs_present, end)))
+ return 0;
+
+ if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_pdus > 0)
+ {
+ value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config);
+
+ if(value->ul_config_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->ul_config_pdu_list = 0;
+ }
+
+
+ uint16_t i;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ {
+ // pdu end is past buffer end
+ return 0;
+ }
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+
+ case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu)
+ UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information)
+ UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu)
+ UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information)
+ UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu)
+ UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information)
+ UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information)
+ UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information)
+ UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information)
+ UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information)
+ UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information)
+ UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu)
+ UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information)
+ UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu)
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ }
+ }
+ return 1;
+}
+
+
+static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv;
+
+ return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) &&
+ pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+ pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) &&
+ pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) &&
+ pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) &&
+ pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) &&
+ pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) &&
+ pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) &&
+ pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) &&
+ pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end));
+}
+
+static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv;
+
+ return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) &&
+ pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end));
+}
+
+static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) &&
+ pull8(ppReadPackedMsg, &value->resource_block_assignment, end) &&
+ pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) &&
+ pull8(ppReadPackedMsg, &value->start_symbol, end) &&
+ pull8(ppReadPackedMsg, &value->ecce_index, end) &&
+ pull8(ppReadPackedMsg, &value->aggreagation_level, end) &&
+ pull8(ppReadPackedMsg, &value->rnti_type, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->ce_mode, end) &&
+ pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) &&
+ pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) &&
+ pull16(ppReadPackedMsg, &value->transmission_power, end) &&
+ pull8(ppReadPackedMsg, &value->dci_format, end) &&
+ pull8(ppReadPackedMsg, &value->resource_block_start, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) &&
+ pull8(ppReadPackedMsg, &value->mcs, end) &&
+ pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) &&
+ pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) &&
+ pull8(ppReadPackedMsg, &value->new_data_indication, end) &&
+ pull8(ppReadPackedMsg, &value->harq_process, end) &&
+ pull8(ppReadPackedMsg, &value->redudency_version, end) &&
+ pull8(ppReadPackedMsg, &value->tpc, end) &&
+ pull8(ppReadPackedMsg, &value->csi_request, end) &&
+ pull8(ppReadPackedMsg, &value->ul_inex, end) &&
+ pull8(ppReadPackedMsg, &value->dai_presence_flag, end) &&
+ pull8(ppReadPackedMsg, &value->dl_assignment_index, end) &&
+ pull8(ppReadPackedMsg, &value->srs_request, end) &&
+ pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) &&
+ pull32(ppReadPackedMsg, &value->tcp_bitmap, end) &&
+ pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) &&
+ pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end));
+}
+
+static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->ncce_index, end) &&
+ pull8(ppReadPackedMsg, &value->aggregation_level, end) &&
+ pull8(ppReadPackedMsg, &value->start_symbol, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) &&
+ pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) &&
+ pull8(ppReadPackedMsg, &value->subcarrier_indication, end) &&
+ pull8(ppReadPackedMsg, &value->resource_assignment, end) &&
+ pull8(ppReadPackedMsg, &value->scheduling_delay, end) &&
+ pull8(ppReadPackedMsg, &value->mcs, end) &&
+ pull8(ppReadPackedMsg, &value->redudancy_version, end) &&
+ pull8(ppReadPackedMsg, &value->repetition_number, end) &&
+ pull8(ppReadPackedMsg, &value->new_data_indicator, end) &&
+ pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end));
+}
+
+static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv;
+
+ if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_dci, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_hi, end)))
+ return 0;
+
+ uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci;
+
+ if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU);
+ return 0;
+ }
+
+ if(totalNumPdus > 0)
+ {
+ value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config);
+ if(value->hi_dci0_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->hi_dci0_pdu_list = 0;
+ }
+
+ uint8_t i;
+ for(i = 0; i < totalNumPdus; ++i)
+ {
+ nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ {
+ // pdu end if past buffer end
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size too big %p %p\n", __FUNCTION__, packedPduEnd, end);
+ return 0;
+ }
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_HI_DCI0_HI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value},
+ { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_HI_DCI0_DCI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
+ { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
+ { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value},
+ { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value},
+ { NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type );
+ }
+ break;
+ };
+ }
+
+ return 1;
+}
+
+//unpack_ul_dci_pdu_list_value
+
+static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)msg;
+
+ for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
+ {
+ if(!(pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, end) &&
+
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, end) &&
+
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end) &&
+
+ pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end)))
+
+ return 0;
+ }
+
+ return (pull16(ppReadPackedMsg, &value->PDUType, end) &&
+ pull16(ppReadPackedMsg, &value->PDUSize, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, end) &&
+
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, end) &&
+ pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, end) &&
+
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) &&
+ pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) &&
+ pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end));
+
+}
+
+static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->numPdus, end)
+ ))
+ return 0;
+ for(int i=0; i< pNfapiMsg->numPdus; i++)
+ {
+ if (!unpack_ul_dci_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->ul_dci_pdu_list[i]))
+ return 0;
+ }
+
+ return 1;
+
+}
+
+static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+
+}
+static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg)
+{
+ nfapi_nr_pdu_t* pNfapiMsg = (nfapi_nr_pdu_t*)msg;
+
+ if(!(pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->PDU_length, end)
+ ))
+ return 0;
+
+ uint16_t i = 0;
+ uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV;
+ for(; i < total_number_of_tlvs; ++i)
+ {
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end)))
+ return 0;
+
+ switch(pNfapiMsg->TLVs[i].tag){
+ case 0:
+ {
+ if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end))
+ return 0;
+ break;
+
+ }
+
+ case 1:
+ {
+ if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length , pNfapiMsg->TLVs[i].length, end))
+ return 0;
+ break;
+
+ }
+
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", pNfapiMsg->TLVs[i].tag );
+ break;
+ }
+
+ }
+ }
+
+
+ return 1;
+}
+
+static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg;
+
+ if(!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->Number_of_PDUs, end)))
+ return 0;
+
+ for(int i=0; i< pNfapiMsg->Number_of_PDUs; i++)
+ {
+ if (!unpack_tx_data_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdu_list[i]))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ uint8_t proceed = 1;
+ nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg;
+
+ if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
+ return 0;
+
+ while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
+ {
+ nfapi_tl_t generic_tl;
+ if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ return 0;
+
+ switch(generic_tl.tag)
+ {
+ case NFAPI_TX_REQUEST_BODY_TAG:
+ {
+ pNfapiMsg->tx_request_body.tl = generic_tl;
+
+ if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0)
+ return 0;
+
+ if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU);
+ return 0;
+ }
+
+ if(pNfapiMsg->tx_request_body.number_of_pdus > 0)
+ {
+ pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config);
+ if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ pNfapiMsg->tx_request_body.tx_pdu_list = 0;
+ }
+
+
+ uint16_t i;
+ uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus;
+ for(i = 0; i < totalNumPdus; ++i)
+ {
+ nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
+ if (pdu) {
+ uint16_t length = 0;
+ uint16_t index = 0;
+
+ if(!(pull16(ppReadPackedMsg, &length, end) &&
+ pull16(ppReadPackedMsg, &index, end)))
+ return 0;
+
+ pdu->pdu_length = length;
+ pdu->pdu_index = index;
+
+
+ // TODO : May need to rethink this bit
+ pdu->num_segments = 1;
+ pdu->segments[0].segment_length = pdu->pdu_length;
+ pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
+
+ if(pdu->segments[0].segment_data)
+ {
+ if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
+ return 0;
+ if (pdu->segments[0].segment_length == 3)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
+ pdu->segments[0].segment_data[0],
+ pdu->segments[0].segment_data[1],
+ pdu->segments[0].segment_data[2]
+ );
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
+ }
+ } else {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
+ }
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag );
+ }
+ break;
+ };
+ }
+
+ return 1;
+}
+
+
+//UNPACK NR UPLINK INDICATION FUNCTIONS
+
+//RX DATA INDICATION
+
+static uint8_t unpack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t* value,
+ uint8_t **ppReadPackedMsg,
+ uint8_t *end,
+ nfapi_p7_codec_config_t* config)
+{
+ if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->harq_id, end) &&
+ pull16(ppReadPackedMsg, &value->pdu_length, end) &&
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &value->rssi, end)
+ ))
+ return 0;
+
+ uint16_t length = value->pdu_length;
+ value->pdu = nfapi_p7_allocate(length, config);
+
+ if (pullarray8(ppReadPackedMsg, value->pdu, length, length, end) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
+ return 0;
+ }
+ return 1;
+}
+
+
+static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
+ ))
+ return 0;
+ if (pNfapiMsg->number_of_pdus > 0)
+ {
+ pNfapiMsg->pdu_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->pdu_list) * pNfapiMsg->number_of_pdus, config);
+ }
+
+ for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
+ {
+ if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end, config))
+ return 0;
+ }
+
+return 1;
+}
+
+//NR CRC INDICATION
+
+static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->harq_id, end) &&
+ pull8(ppReadPackedMsg, &value->tb_crc_status, end) &&
+ pull16(ppReadPackedMsg, &value->num_cb, end) &&
+ //pullarray8(ppReadPackedMsg, value->cb_crc_status, (int)(value->num_cb / 8) + 1, (int)(value->num_cb / 8) + 1, end) && //length is ceil(NumCb/8)
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &value->rssi, end)
+ ))
+ return 0;
+
+ return 1;
+}
+
+static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
+ ))
+ return 0;
+
+ if (pNfapiMsg->number_crcs > 0)
+ {
+ pNfapiMsg->crc_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->crc_list) * pNfapiMsg->number_crcs, config);
+ }
+
+ for (int i = 0; i < pNfapiMsg->number_crcs; i++)
+ {
+ if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppReadPackedMsg, end))
+ return 0;
+ }
+
+return 1;
+}
+
+//SRS INDICATION
+
+static uint8_t unpack_nr_srs_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nr_srs_indication_pdu_t* value = (nfapi_nr_srs_indication_pdu_t*)tlv;
+
+ if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull8(ppReadPackedMsg, &value->num_symbols, end) &&
+ pull8(ppReadPackedMsg, &value->wide_band_snr, end) &&
+ pull8(ppReadPackedMsg, &value->num_reported_symbols, end) &&
+ pull16(ppReadPackedMsg, &value->reported_symbol_list->num_rbs, end)
+ ))
+ return 0;
+ for(int i = 0; i < value->reported_symbol_list->num_rbs; i++)
+ {
+ if(!(pull8(ppReadPackedMsg, &value->reported_symbol_list->rb_list->rb_snr, end)
+ ))
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_srs_indication_t *pNfapiMsg = (nfapi_nr_srs_indication_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg,&pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg,&pNfapiMsg->slot , end) &&
+ pull8(ppReadPackedMsg,&pNfapiMsg->number_of_pdus, end)
+ ))
+ return 0;
+
+ for(int i=0; inumber_of_pdus;i++)
+ {
+ if(!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end))
+ return 0;
+ }
+
+return 1;
+}
+
+//NR RACH
+
+static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* value,
+ uint8_t **ppReadPackedMsg,
+ uint8_t *end,
+ nfapi_p7_codec_config_t* config)
+{
+
+ if(!(pull16(ppReadPackedMsg, &value->phy_cell_id, end) &&
+ pull8(ppReadPackedMsg, &value->symbol_index, end) &&
+ pull8(ppReadPackedMsg, &value->slot_index, end) &&
+ pull8(ppReadPackedMsg, &value->freq_index, end) &&
+ pull8(ppReadPackedMsg, &value->avg_rssi, end) &&
+ pull8(ppReadPackedMsg, &value->avg_snr, end) &&
+ pull8(ppReadPackedMsg, &value->num_preamble, end)
+ ))
+ return 0;
+
+ if (value->num_preamble > 0) {
+ value->preamble_list = nfapi_p7_allocate(sizeof(*value->preamble_list) * value->num_preamble, config);
+ for(int i = 0; i < value->num_preamble; i++)
+ {
+ if(!(pull8(ppReadPackedMsg, &value->preamble_list[i].preamble_index, end) &&
+ pull16(ppReadPackedMsg, &value->preamble_list[i].timing_advance, end) &&
+ pull32(ppReadPackedMsg, &value->preamble_list[i].preamble_pwr, end)
+ ))
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) {
+
+ nfapi_nr_rach_indication_t *pNfapiMsg = (nfapi_nr_rach_indication_t*)msg;
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
+ pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
+ ))
+ return 0;
+
+ if (pNfapiMsg->number_of_pdus > 0) {
+ pNfapiMsg->pdu_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->pdu_list) * pNfapiMsg->number_of_pdus, config);
+ for(int i = 0; i < pNfapiMsg->number_of_pdus; i++)
+ {
+ if(!unpack_nr_rach_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end, config))
+ return 0;
+ }
+ }
+ return 1;
+}
+
+//NR UCI
+
+static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t *value,
+ uint8_t **ppReadPackedMsg,
+ uint8_t *end,
+ nfapi_p7_codec_config_t *config) {
+
+ if (!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
+ pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->pucch_format, end) &&
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &value->rssi, end)
+ ))
+ return 0;
+ if (value->pduBitmap & 0x01) { //SR
+ if (!(pull8(ppReadPackedMsg, &value->sr->sr_indication, end) &&
+ pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
+ ))
+ return 0;
+ }
+ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
+
+ value->harq = nfapi_p7_allocate(sizeof(*value->harq), config);
+ if (value->harq == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nr_harq pdu\n", __FUNCTION__);
+ return 0;
+ }
+ if (!(pull8(ppReadPackedMsg, &value->harq->num_harq, end) &&
+ pull8(ppReadPackedMsg, &value->harq->harq_confidence_level, end)
+ ))
+ return 0;
+ value->harq->harq_list = NULL;
+ if (value->harq->num_harq > 0) {
+ value->harq->harq_list = nfapi_p7_allocate(sizeof(*value->harq->harq_list) * value->harq->num_harq, config);
+ if (value->harq->harq_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n",
+ __FUNCTION__, value->harq->num_harq);
+ return 0;
+ }
+ for (int i = 0; i < value->harq->num_harq; i++) {
+ if (!pull8(ppReadPackedMsg, &value->harq->harq_list[i].harq_value, end)) {
+ return 0;
+ }
+ }
+ }
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
+ nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
+ pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->pucch_format, end) &&
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &value->rssi, end)
+ ))
+ return 0;
+ if (value->pduBitmap & 0x01) { //SR
+ if(!(pull16(ppReadPackedMsg, &value->sr.sr_bit_len, end) &&
+ pullarray8(ppReadPackedMsg, value->sr.sr_payload, (int)(value->sr.sr_bit_len / 8) + 1, (int)(value->sr.sr_bit_len / 8) + 1, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
+ if(!(pull8(ppReadPackedMsg, &value->harq.harq_crc, end) &&
+ pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end) &&
+ pullarray8(ppReadPackedMsg, value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8) + 1, (int)(value->harq.harq_bit_len / 8) + 1, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 2) & 0x01)) { //CSI-1
+ if(!(pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end) &&
+ pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, end) &&
+ pullarray8(ppReadPackedMsg, value->csi_part1.csi_part1_payload, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, (int)(value->csi_part1.csi_part1_bit_len / 8) + 1, end)
+ ))
+ return 0;
+ }
+
+ if (((value->pduBitmap >> 3) & 0x01)) { //CSI-2
+ if(!(pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end) &&
+ pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, end) &&
+ pullarray8(ppReadPackedMsg, value->csi_part2.csi_part2_payload, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, (int)(value->csi_part2.csi_part2_bit_len / 8) + 1, end)
+ ))
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t *value,
+ uint8_t **ppReadPackedMsg,
+ uint8_t *end,
+ nfapi_p7_codec_config_t *config)
+{
+ if(!(pull16(ppReadPackedMsg, &value->pdu_type, end) &&
+ pull16(ppReadPackedMsg, &value->pdu_size, end)
+ ))
+ return 0;
+
+ switch (value->pdu_type) {
+ case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
+ NFAPI_TRACE(NFAPI_TRACE_WARN, "Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
+ break;
+
+ case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
+ nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &value->pucch_pdu_format_0_1;
+ if (!unpack_nr_uci_pucch_0_1(uci_pdu, ppReadPackedMsg, end, config))
+ return 0;
+ break;
+ }
+ case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
+ nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
+ if (!unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end))
+ return 0;
+ break;
+ }
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_WARN, "Unexpected pdu type %d\n", value->pdu_type);
+ break;
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t*)msg;
+
+ if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
+ pull16(ppReadPackedMsg, &pNfapiMsg->num_ucis, end)
+ ))
+ return 0;
+
+ pNfapiMsg->uci_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->uci_list) * pNfapiMsg->num_ucis, config);
+ for (int i = 0; i < pNfapiMsg->num_ucis; i++)
+ {
+ if(!unpack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppReadPackedMsg, end, config))
+ return 0;
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ uint8_t proceed = 1;
+ nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
+
+ if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
+ return 0;
+
+ while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
+ {
+ nfapi_tl_t generic_tl;
+ if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ return 0;
+
+ switch(generic_tl.tag)
+ {
+ case NFAPI_UE_RELEASE_BODY_TAG:
+ {
+ pNfapiMsg->ue_release_request_body.tl = generic_tl;
+ if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
+ return 0;
+
+ if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
+ return 0;
+ } else {
+ uint8_t j;
+ uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
+ for(j = 0; j < num; ++j){
+ if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
+ return 0;
+ }
+ }
+ }
+ }
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
+ }
+ break;
+ };
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->value_0, end) &&
+ pull8(ppReadPackedMsg, &value->value_1, end));
+}
+
+static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->value_0, end) &&
+ pull8(ppReadPackedMsg, &value->value_1, end) &&
+ pull8(ppReadPackedMsg, &value->value_2, end) &&
+ pull8(ppReadPackedMsg, &value->value_3, end));
+}
+static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv;
+ return ( pull8(ppReadPackedMsg, &value->value_0, end));
+}
+static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv;
+ return (pull8(ppReadPackedMsg, &value->value_0, end));
+}
+
+static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+ return 0;
+
+ uint8_t result = 0;
+ switch(value->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = 1;
+ break;
+ default:
+ // TODO add error message
+ return 0;
+ break;
+ }
+ return result;
+}
+
+static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+ return 0;
+
+ if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
+ {
+ // TODO : add error message
+ return 0;
+ }
+
+ uint16_t idx = 0;
+ for(idx = 0; idx < value->number_of_ack_nack; ++idx)
+ {
+ uint8_t result = 0;
+ switch(value->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
+ break;
+ default:
+ // TODO add error message
+ return 0;
+ break;
+ }
+
+ if(result == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull16(ppReadPackedMsg, &value->number_of_ack_nack, end)))
+ return 0;
+
+ if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD)
+ {
+ // TODO : add error message
+ return 0;
+ }
+
+ uint16_t idx = 0;
+ for(idx = 0; idx < value->number_of_ack_nack; ++idx)
+ {
+ uint8_t result = 0;
+ switch(value->mode)
+ {
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING:
+ result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end);
+ break;
+ case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5:
+ result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end);
+ break;
+ default:
+ // TODO add error message
+ return 0;
+ break;
+ }
+
+ if(result == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv;
+ return (pull8(ppReadPackedMsg, &value->harq_tb1, end) &&
+ pull8(ppReadPackedMsg, &value->harq_tb2, end));
+}
+
+static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
+ pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end));
+}
+
+static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->mode, end) &&
+ pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) &&
+ pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end));
+}
+
+static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv;
+
+ return (pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull8(ppReadPackedMsg, &value->channel, end));
+}
+
+
+
+static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv;
+ uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(harqBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
+ return 0;
+
+ if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
+ return 0;
+ }
+
+ assert(value->number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
+ value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * NFAPI_HARQ_IND_MAX_PDU, config);
+ if(value->harq_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
+ return 0;
+ }
+
+ assert(value->number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
+ for (size_t i = 0; i < value->number_of_harqs; ++i)
+ {
+ nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value},
+ { NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value},
+ { NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value},
+ { NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value},
+ { NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value},
+ { NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value},
+ { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
+ return 0;
+
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv;
+ return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) );
+}
+
+static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv;
+ uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(crcBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0)
+ return 0;
+
+ if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_crcs > 0)
+ {
+ assert(value->number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
+ value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * NFAPI_CRC_IND_MAX_PDU, config);
+ if(value->crc_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs);
+ return 0;
+ }
+ }
+ else
+ {
+ value->crc_pdu_list = 0;
+ }
+
+ assert(value->number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
+ for (size_t i = 0; i < value->number_of_crcs; ++i)
+ {
+ nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value },
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0)
+ return 0;
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &value->length, end) &&
+ pull16(ppReadPackedMsg, &value->offset, end) &&
+ pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end));
+}
+static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv;
+ return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
+}
+
+static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
+{
+ nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t*)tlv;
+
+ NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s value->tl.length in unpack: %u \n", __FUNCTION__,
+ value->tl.length);
+ uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s rxBodyEnd: %p end: %p\n", __FUNCTION__,
+ rxBodyEnd, end);
+ if (rxBodyEnd > end)
+ {
+ // pdu end is past buffer end
+ return 0;
+ }
+
+ if (pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+ return 0;
+
+ if (value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
+ return 0;
+ }
+
+ if (value->number_of_pdus > 0)
+ {
+ assert(value->number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
+ value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * NFAPI_RX_IND_MAX_PDU, config);
+ if (value->rx_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->rx_pdu_list = 0;
+ }
+
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s number_of_pdus = %u\n", __FUNCTION__, value->number_of_pdus);
+ for (int i = 0; i < value->number_of_pdus; i++)
+ {
+ nfapi_tl_t generic_tl;
+
+ // NFAPI_RX_UE_INFORMATION_TAG
+ if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
+ return 0;
+ }
+
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
+
+ if (generic_tl.tag != NFAPI_RX_UE_INFORMATION_TAG)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
+ return 0;
+ }
+
+ assert(i < NFAPI_RX_IND_MAX_PDU);
+ nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
+
+ pdu->rx_ue_information.tl = generic_tl;
+ if (unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_ue_info failure\n", __FUNCTION__);
+ return 0;
+ }
+
+ // NFAPI_RX_INDICATION_REL8_TAG
+ if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
+ return 0;
+ }
+
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
+
+ if (generic_tl.tag != NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
+ return 0;
+ }
+
+ pdu->rx_indication_rel8.tl = generic_tl;
+ if (unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel8 failure\n", __FUNCTION__);
+ return 0;
+ }
+ //What is offset not stripping 10 bytes
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s pdu->rx_indication_rel8.offset = %u", __FUNCTION__,
+ pdu->rx_indication_rel8.offset);
+
+ // NFAPI_RX_INDICATION_REL9_TAG
+ if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
+ return 0;
+ }
+
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
+
+ if (generic_tl.tag != NFAPI_RX_INDICATION_REL9_TAG)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
+ return 0;
+ }
+
+ pdu->rx_indication_rel9.tl = generic_tl;
+ if (unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel9 failure\n", __FUNCTION__);
+ return 0;
+ }
+ }
+
+ assert(value->number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
+ for (int i = 0; i < value->number_of_pdus; ++i)
+ {
+ nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
+ if (pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
+ {
+ uint32_t length = pdu->rx_indication_rel8.length;
+ if (pullarray8(ppReadPackedMsg, pdu->rx_ind_data, NFAPI_RX_IND_DATA_MAX, length, end) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) &&
+ pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) &&
+ pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end));
+}
+
+static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv;
+ return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end);
+}
+
+static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv;
+ return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end);
+}
+
+static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv;
+ uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(rachBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0)
+ return 0;
+
+ if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_preambles > 0)
+ {
+ value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config);
+ if(value->preamble_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles);
+ return 0;
+ }
+ }
+ else
+ {
+ value->preamble_list = 0;
+ }
+
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_preambles; ++i)
+ {
+ nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]);
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value },
+ { NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value },
+ { NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value },
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv;
+
+ if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) &&
+ pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) &&
+ pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) &&
+ pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end)))
+ return 0;
+ return 1;
+}
+
+static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv;
+ return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end));
+}
+
+static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv;
+ return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end));
+}
+
+static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv;
+ return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end));
+}
+
+static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv;
+
+ if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) &&
+ pull8(ppReadPackedMsg, &value->number_of_subbands, end) &&
+ pull8(ppReadPackedMsg, &value->num_atennas, end)))
+ return 0;
+
+ if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS)
+ {
+ // todo : add error
+ return 0;
+ }
+
+ if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS)
+ {
+ // todo : add error
+ return 0;
+ }
+
+ uint8_t idx = 0;
+ for(idx = 0; idx < value->number_of_subbands; ++idx)
+ {
+ if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) &&
+ pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end)))
+ return 0;
+ }
+
+ return 1;
+}
+
+
+static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv;
+ uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(srsBodyEnd > end)
+ return 0;
+
+ if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0)
+ return 0;
+
+ if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_ues > 0)
+ {
+ value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config);
+ if(value->srs_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues);
+ return 0;
+ }
+ }
+ else
+ {
+ value->srs_pdu_list = 0;
+ }
+
+
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_ues; ++i)
+ {
+ nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]);
+
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value},
+ { NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value},
+ { NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value},
+ { NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value},
+ { NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value},
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0)
+ return 0;
+ }
+ return 1;
+}
+
+static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv;
+ uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(srBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0)
+ return 0;
+
+ if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_srs > 0)
+ {
+ assert(value->number_of_srs <= NFAPI_SR_IND_MAX_PDU);
+ value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
+ if(value->sr_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs);
+ return 0;
+ }
+ }
+ else
+ {
+ value->sr_pdu_list = 0;
+ }
+
+ uint8_t i = 0;
+ assert(value->number_of_srs <= NFAPI_SR_IND_MAX_PDU);
+ for(i = 0; i < value->number_of_srs; ++i)
+ {
+ nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value },
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0)
+ return 0;
+ }
+
+ return 1;
+
+}
+
+static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) &&
+ pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) &&
+ pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end));
+
+}
+
+static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv;
+
+ if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) &&
+ pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) &&
+ pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end)))
+ return 0;
+
+ if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n");
+ return 0;
+ }
+
+ if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) &&
+ pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end)))
+ return 0;
+
+ return 1;
+}
+
+static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv;
+
+ // the cqiBodyEnd points to the end of the cqi PDU's
+ uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ //uint8_t* cqiPduEnd = cqiBodyEnd;
+ //uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
+
+ if(cqiBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0)
+ return 0;
+
+ if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU);
+ return -1;
+ }
+
+ if(value->number_of_cqis > 0)
+ {
+ assert(value->number_of_cqis <= NFAPI_SR_IND_MAX_PDU);
+ value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
+ if(value->cqi_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
+ return 0;
+ }
+ }
+ else
+ {
+ value->cqi_pdu_list = 0;
+ }
+
+ if(value->number_of_cqis > 0)
+ {
+ assert(value->number_of_cqis <= NFAPI_SR_IND_MAX_PDU);
+ value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
+ if(value->cqi_raw_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
+ return 0;
+ }
+ }
+ else
+ {
+ value->cqi_raw_pdu_list = 0;
+ }
+
+ uint8_t i = 0;
+ assert(value->number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
+ for(i = 0; i < value->number_of_cqis; ++i)
+ {
+ nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
+ memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t));
+
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+
+ while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd)
+ {
+ nfapi_tl_t generic_tl;
+ if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
+ return 0;
+
+ switch(generic_tl.tag)
+ {
+ case NFAPI_RX_UE_INFORMATION_TAG:
+ pdu->rx_ue_information.tl = generic_tl;
+ if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
+ return 0;
+ break;
+ case NFAPI_CQI_INDICATION_REL8_TAG:
+ pdu->cqi_indication_rel8.tl = generic_tl;
+ if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0)
+ return 0;
+
+ break;
+ case NFAPI_CQI_INDICATION_REL9_TAG:
+ pdu->cqi_indication_rel9.tl = generic_tl;
+ if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0)
+ return 0;
+
+ break;
+ case NFAPI_UL_CQI_INFORMATION_TAG:
+ pdu->ul_cqi_information.tl = generic_tl;
+ if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0)
+ return 0;
+ break;
+ default:
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag );
+ }
+ break;
+
+ };
+ }
+ }
+
+ uint8_t idx = 0;
+ assert(value->number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
+ for(idx = 0; idx < value->number_of_cqis; ++idx)
+ {
+ if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+ {
+ if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0)
+ return 0;
+ }
+ else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG)
+ {
+ if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0)
+ return 0;
+ }
+ }
+
+
+ return 1;
+
+}
+
+static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull32(ppReadPackedMsg, &value->mp_cca, end) &&
+ pull32(ppReadPackedMsg, &value->n_cca, end) &&
+ pull32(ppReadPackedMsg, &value->offset, end) &&
+ pull32(ppReadPackedMsg, &value->lte_txop_sf, end) &&
+ pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) &&
+ pull32(ppReadPackedMsg, &value->lbt_mode, end));
+}
+
+static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull32(ppReadPackedMsg, &value->offset, end) &&
+ pull16(ppReadPackedMsg, &value->sfn_sf_end, end) &&
+ pull32(ppReadPackedMsg, &value->lbt_mode, end));
+}
+
+
+static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+ return 0;
+
+ if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_pdus)
+ {
+ value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config);
+ if(value->lbt_dl_config_req_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->lbt_dl_config_req_pdu_list = 0;
+ }
+
+
+ uint16_t i;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type);
+ return 0;
+ }
+ }
+
+ return 1;
+}
+static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull32(ppReadPackedMsg, &value->result, end) &&
+ pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) &&
+ pull32(ppReadPackedMsg, &value->initial_partial_sf, end));
+
+}
+static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv;
+
+ return (pull32(ppReadPackedMsg, &value->handle, end) &&
+ pull32(ppReadPackedMsg, &value->result, end));
+}
+
+static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
+ return 0;
+
+ if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU);
+ return 0;
+ }
+
+ if(value->number_of_pdus > 0)
+ {
+ value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config);
+ if(value->lbt_indication_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
+ return 0;
+ }
+ }
+ else
+ {
+ value->lbt_indication_pdu_list = 0;
+ }
+
+ uint16_t i;
+ uint16_t total_number_of_pdus = value->number_of_pdus;
+ for(i = 0; i < total_number_of_pdus; ++i)
+ {
+ nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]);
+
+ if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) &&
+ pull8(ppReadPackedMsg, &pdu->pdu_size, end)))
+ return 0;
+
+ uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2;
+
+ if(packedPduEnd > end)
+ return 0;
+
+ switch(pdu->pdu_type)
+ {
+ case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE:
+ {
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value},
+ };
+
+ unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0);
+ }
+ break;
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type);
+ return 0;
+ }
+ }
+
+ return 1;
+}
+static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv;
+ return (pull8(ppReadPackedMsg, &value->harq_tb1, end));
+}
+
+
+static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv;
+ uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(nbharqBodyEnd > end)
+ return 0;
+
+ if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0)
+ return 0;
+
+ if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU);
+ return 0;
+ }
+
+ value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config);
+ if(value->nb_harq_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
+ return 0;
+ }
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_harqs; ++i)
+ {
+ nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]);
+ if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
+ return 0;
+
+ uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length;
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value },
+ { NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value},
+ { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value}
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0)
+ return 0;
+
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
+{
+ nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv;
+
+ return (pull16(ppReadPackedMsg, &value->rnti, end) &&
+ pull8(ppReadPackedMsg, &value->initial_sc, end) &&
+ pull16(ppReadPackedMsg, &value->timing_advance, end) &&
+ pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
+}
+
+static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
+ if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
+ return 0;
+ }
+ else{
+ NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
+ }
+ return 1;
+}
+
+static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
+ uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length;
+
+ if(nrachBodyEnd > end)
+ return 0;
+
+ if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0)
+ return 0;
+
+ if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU);
+ return 0;
+ }
+
+ value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config);
+ if(value->nrach_pdu_list == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected);
+ return 0;
+ }
+
+ uint8_t i = 0;
+ for(i = 0; i < value->number_of_initial_scs_detected; ++i)
+ {
+ nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]);
+
+ uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6;
+
+ unpack_tlv_t unpack_fns[] =
+ {
+ { NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value},
+ };
+
+ if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0)
+ return 0;
+
+ }
+
+ return 1;
+}
+
+static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ { NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value},
+ };
+
+ return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_nr_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_nr_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
+{
+ nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg;
+
+ unpack_p7_tlv_t unpack_fns[] =
+ {
+ };
+
+ return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) &&
+ pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) &&
+ pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) &&
+ unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
+}
+
+
+
+// unpack length check
+
+static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
+{
+ int retLen = 0;
+
+ switch (msgId)
+ {
+ case NFAPI_DL_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t))
+ retLen = sizeof(nfapi_dl_config_request_t);
+ break;
+
+ case NFAPI_UL_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t))
+ retLen = sizeof(nfapi_ul_config_request_t);
+ break;
+
+ case NFAPI_SUBFRAME_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
+ retLen = sizeof(nfapi_subframe_indication_t);
+ break;
+
+ case NFAPI_HI_DCI0_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t))
+ retLen = sizeof(nfapi_hi_dci0_request_t);
+ break;
+
+ case NFAPI_TX_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_tx_request_t))
+ retLen = sizeof(nfapi_tx_request_t);
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_harq_indication_t))
+ retLen = sizeof(nfapi_harq_indication_t);
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_crc_indication_t))
+ retLen = sizeof(nfapi_crc_indication_t);
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_rx_indication_t))
+ retLen = sizeof(nfapi_rx_indication_t);
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_rach_indication_t))
+ retLen = sizeof(nfapi_rach_indication_t);
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_srs_indication_t))
+ retLen = sizeof(nfapi_srs_indication_t);
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_sr_indication_t))
+ retLen = sizeof(nfapi_sr_indication_t);
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t))
+ retLen = sizeof(nfapi_cqi_indication_t);
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t))
+ retLen = sizeof(nfapi_lbt_dl_config_request_t);
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t))
+ retLen = sizeof(nfapi_lbt_dl_indication_t);
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t))
+ retLen = sizeof(nfapi_nb_harq_indication_t);
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t))
+ retLen = sizeof(nfapi_nrach_indication_t);
+ break;
+
+ case NFAPI_DL_NODE_SYNC:
+ if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t))
+ retLen = sizeof(nfapi_dl_node_sync_t);
+ break;
+
+ case NFAPI_UL_NODE_SYNC:
+ if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t))
+ retLen = sizeof(nfapi_ul_node_sync_t);
+ break;
+
+ case NFAPI_TIMING_INFO:
+ if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
+ retLen = sizeof(nfapi_timing_info_t);
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
+ retLen = sizeof(nfapi_ue_release_request_t);
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
+ retLen = sizeof(nfapi_ue_release_response_t);
+ break;
+
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
+ break;
+ }
+
+ return retLen;
+}
+
+static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen)
+{
+ int retLen = 0;
+
+ switch (msgId)
+ {
+ case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_dl_tti_request_t))
+ retLen = sizeof(nfapi_nr_dl_tti_request_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_ul_tti_request_t))
+ retLen = sizeof(nfapi_nr_ul_tti_request_t);
+ break;
+
+ case NFAPI_SUBFRAME_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t))
+ retLen = sizeof(nfapi_subframe_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_ul_dci_request_t))
+ retLen = sizeof(nfapi_nr_ul_dci_request_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t))
+ retLen = sizeof(nfapi_nr_tx_data_request_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_rx_data_indication_t))
+ retLen = sizeof(nfapi_nr_rx_data_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_crc_indication_t))
+ retLen = sizeof(nfapi_nr_crc_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_rach_indication_t))
+ retLen = sizeof(nfapi_nr_rach_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_uci_indication_t))
+ retLen = sizeof(nfapi_nr_uci_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
+ if (unpackedBufLen >= sizeof(nfapi_nr_srs_indication_t))
+ retLen = sizeof(nfapi_nr_srs_indication_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
+ if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t))
+ retLen = sizeof(nfapi_nr_dl_node_sync_t);
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
+ if (unpackedBufLen >= sizeof(nfapi_nr_ul_node_sync_t))
+ retLen = sizeof(nfapi_nr_ul_node_sync_t);
+ break;
+
+ case NFAPI_TIMING_INFO:
+ if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
+ retLen = sizeof(nfapi_timing_info_t);
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
+ retLen = sizeof(nfapi_ue_release_request_t);
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
+ retLen = sizeof(nfapi_ue_release_response_t);
+ break;
+
+ default:
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
+ break;
+ }
+
+ return retLen;
+}
+
+
+
+// Main unpack functions - public
+
+int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
+{
+ nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+
+ // process the header
+ if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
+ return -1;
+
+ return 0;
+}
+
+int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
+{
+ int result = 0;
+ nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+
+ // clean the supplied buffer for - tag value blanking
+ (void)memset(pUnpackedBuf, 0, unpackedBufLen);
+
+ // process the header
+ if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
+ return -1;
+ }
+
+ if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
+ return -1;
+ }
+
+ /*
+ if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
+ return -1;
+ }
+ */
+
+ // look for the specific message
+ switch (pMessageHeader->message_id)
+ {
+ case NFAPI_DL_CONFIG_REQUEST:
+ if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen))
+ result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UL_CONFIG_REQUEST:
+ if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen))
+ result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+ case NFAPI_TX_REQUEST:
+ if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen))
+ result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_HI_DCI0_REQUEST:
+ if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen))
+ result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
+ result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_HARQ_INDICATION:
+ if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
+ result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_CRC_INDICATION:
+ if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen))
+ result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_ULSCH_INDICATION:
+ if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
+ result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RACH_INDICATION:
+ if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen))
+ result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_SRS_INDICATION:
+ if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen))
+ result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_SR_INDICATION:
+ if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen))
+ result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_RX_CQI_INDICATION:
+ if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen))
+ result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_LBT_DL_CONFIG_REQUEST:
+ if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen))
+ result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_LBT_DL_INDICATION:
+ if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen))
+ result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NB_HARQ_INDICATION:
+ if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen))
+ result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NRACH_INDICATION:
+ if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen))
+ result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_DL_NODE_SYNC:
+ if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen))
+ result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UL_NODE_SYNC:
+ if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen))
+ result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_TIMING_INFO:
+ if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
+ result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
+ result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ default:
+
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+ {
+ if(config && config->unpack_p7_vendor_extension)
+ {
+ result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ break;
+ }
+
+ if(result == 0)
+ return -1;
+ else
+ return 0;
+}
+
+int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config)
+{
+ int result = 0;
+ nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
+ uint8_t *pReadPackedMessage = pMessageBuf;
+ uint8_t *end = pMessageBuf + messageBufLen;
+
+ if (pMessageBuf == NULL || pUnpackedBuf == NULL)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
+ return -1;
+ }
+
+ if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
+ return -1;
+ }
+
+ // clean the supplied buffer for - tag value blanking
+ (void)memset(pUnpackedBuf, 0, unpackedBufLen);
+
+ // process the header
+ if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) &&
+ pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) &&
+ pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end)))
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n");
+ return -1;
+ }
+
+ if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n");
+ return -1;
+ }
+
+ /*
+ if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0)
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n");
+ return -1;
+ }
+ */
+
+ // look for the specific message
+ switch (pMessageHeader->message_id)
+ {
+ case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen))
+ result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen))
+ result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+ case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen))
+ result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+ case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen))
+ result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UE_RELEASE_REQUEST:
+ if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
+ result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION, unpackedBufLen))
+ result = unpack_nr_rx_data_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION, unpackedBufLen))
+ result = unpack_nr_crc_indication(&pReadPackedMessage,end , pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION, unpackedBufLen))
+ result = unpack_nr_uci_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION, unpackedBufLen))
+ result = unpack_nr_srs_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION, unpackedBufLen))
+ result = unpack_nr_rach_indication(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen))
+ result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC:
+ if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen))
+ result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_TIMING_INFO:
+ if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
+ result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ case NFAPI_UE_RELEASE_RESPONSE:
+ if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
+ result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
+ else
+ return -1;
+ break;
+
+ default:
+
+ if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
+ pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
+ {
+ if(config && config->unpack_p7_vendor_extension)
+ {
+ result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ }
+ else
+ {
+ NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
+ }
+ break;
+ }
+
+ if(result == 0)
+ return -1;
+ else
+ return 0;
+}
+
+
diff --git a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
index ca8bc8d9a4..873432c74e 100644
--- a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
+++ b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h
@@ -27,7 +27,6 @@ extern "C" {
#include
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
-
#include
#include "openair1/PHY/defs_gNB.h"
diff --git a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
index 1c2f0bef80..4fe5065cea 100644
--- a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
+++ b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp
@@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) {
if(instance->tick == 1000) {
if(instance->tx_byte_count > 0) {
- printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
+ printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count);
instance->tx_byte_count = 0;
}
@@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) {
millisec = now_ts.tv_nsec / 1e6;
if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) {
- printf("*** missing millisec %d %d\n", last_millisec, millisec);
+ printf("*** missing millisec %u %u\n", last_millisec, millisec);
catchup = millisec - last_millisec - 1;
}
diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c
index 2a7b789650..fffd04ea3c 100644
--- a/openair1/PHY/CODING/3gpplte_sse.c
+++ b/openair1/PHY/CODING/3gpplte_sse.c
@@ -44,8 +44,6 @@
//#define DEBUG_TURBO_ENCODER 1
//#define CALLGRIND 1
-unsigned short threegpplte_interleaver_output;
-unsigned long long threegpplte_interleaver_tmp;
#if defined(__x86_64__) || defined(__i386__)
struct treillis {
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
index e1ca906b55..bc1c0dac56 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
@@ -798,11 +798,11 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
n is the size in bits of the coded block, with the tail */
int n2;
llr_t y8[3*(n+16)] __attribute__((aligned(16)));
- llr_t systematic0[n+16] __attribute__ ((aligned(16)));
- llr_t systematic1[n+16] __attribute__ ((aligned(16)));
- llr_t systematic2[n+16] __attribute__ ((aligned(16)));
- llr_t yparity1[n+16] __attribute__ ((aligned(16)));
- llr_t yparity2[n+16] __attribute__ ((aligned(16)));
+ llr_t systematic0[n+32] __attribute__ ((aligned(16)));
+ llr_t systematic1[n+32] __attribute__ ((aligned(16)));
+ llr_t systematic2[n+32] __attribute__ ((aligned(16)));
+ llr_t yparity1[n+32] __attribute__ ((aligned(16)));
+ llr_t yparity2[n+32] __attribute__ ((aligned(16)));
llr_t ext[n+128] __attribute__((aligned(16)));
llr_t ext2[n+128] __attribute__((aligned(16)));
llr_t alpha[(n+16)*8] __attribute__ ((aligned(16)));
@@ -811,7 +811,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
llr_t m10[n+16] __attribute__ ((aligned(16)));
// int *pi2_p,*pi4_p,*pi5_p,*pi6_p;
int *pi4_p,*pi5_p,*pi6_p;
- llr_t *s,*s1,*s2,*yp1,*yp2,*yp;
+ llr_t *s1,*s2,*yp1,*yp2,*yp;
unsigned int i,j,iind;//,pi;
unsigned char iteration_cnt=0;
unsigned int crc,oldcrc,crc_len;
@@ -927,7 +927,6 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
yp128 = (int8x16_t *)y8;
#endif
- s = systematic0;
s1 = systematic1;
s2 = systematic2;
yp1 = yparity1;
@@ -938,7 +937,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
for (i=0; i<16 ; i++ )
for (j=0; jn) {
/*
- s[n]=0;s[n+1]=0;s[n+2]=0;s[n+3]=0;
- s[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0;
+ systematic0[n]=0;systematic0[n+1]=0;systematic0[n+2]=0;systematic0[n+3]=0;
+ systematic0[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0;
s1[n]=0;s1[n+1]=0;s1[n+2]=0;s1[n+3]=0;
s1[n+4]=0;s1[n+5]=0;s1[n+6]=0;s1[n+7]=0;
s2[n]=0;s2[n+1]=0;s2[n+2]=0;s2[n+3]=0;
@@ -961,26 +960,26 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y,
// Termination
for (i=n2; i= maxlev)
+ qxd = maxlev - 1;
+
+ return ((char) qxd);
+}
+
+
+#endif
+
diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
index b42ac6e4c8..91c5d59611 100644
--- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c
+++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
@@ -26,9 +26,11 @@
#include "assertions.h"
#include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrLDPC_extern.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
+//#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h"
-#define MAX_NUM_DLSCH_SEGMENTS 16
+#include "openair1/PHY/defs_nr_common.h"
+#include "coding_unitary_defs.h"
+
#define MAX_BLOCK_LENGTH 8448
#ifndef malloc16
@@ -81,9 +83,6 @@ typedef struct {
int n_iter_max;
} n_iter_stats_t;
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
nrLDPC_encoderfunc_t encoder_orig;
short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
@@ -116,9 +115,8 @@ int test_ldpc(short No_iteration,
double sigma;
sigma = 1.0/sqrt(2*SNR);
opp_enabled=1;
- cpu_freq_GHz = get_cpu_freq_GHz();
//short test_input[block_length];
- unsigned char *test_input[MAX_NUM_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
+ unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};;
//short *c; //padded codeword
unsigned char *estimated_output[MAX_NUM_DLSCH_SEGMENTS];
unsigned char *estimated_output_bit[MAX_NUM_DLSCH_SEGMENTS];
@@ -144,7 +142,7 @@ int test_ldpc(short No_iteration,
t_nrLDPC_procBuf nrLDPC_procBuf;
t_nrLDPC_procBuf* p_nrLDPC_procBuf = &nrLDPC_procBuf;
- t_nrLDPC_time_stats decoder_profiler;
+ t_nrLDPC_time_stats decoder_profiler = {0};
t_nrLDPC_time_stats* p_decoder_profiler =&decoder_profiler ;
int32_t n_iter = 0;
@@ -614,7 +612,6 @@ int main(int argc, char *argv[])
exit(1);
break;
}
- cpu_freq_GHz = get_cpu_freq_GHz();
//printf("the decoder supports BG2, Kb=10, Z=128 & 256\n");
//printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n");
printf("block length %d: \n", block_length);
@@ -704,25 +701,25 @@ int main(int argc, char *argv[])
printf("SNR %f, Std iterations: %f\n",SNR, dec_iter->n_iter_std);
printf("SNR %f, Max iterations: %d\n",SNR, dec_iter->n_iter_max);
printf("\n");
- printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz);
- printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2)));
- printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/cpu_freq_GHz);
+ printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz());
+ printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2)));
+ printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/get_cpu_freq_GHz());
printf("\n");
- printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz);
- printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2)));
- printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/cpu_freq_GHz);
+ printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz());
+ printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)));
+ printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/get_cpu_freq_GHz());
fprintf(fd,"%f %f %f %f %f %f %f %f %f %f %f %f %d \n",
SNR,
(double)decoded_errors[i]/(double)n_trials ,
(double)errors_bit/(double)n_trials/(double)block_length/(double)n_segments ,
errors_bit_uncoded/(double)n_trials/(double)n_segments ,
- (double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,
- sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2)),
- (double)time_optim->max/1000.0/cpu_freq_GHz,
- (double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,
- sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2)),
- (double)time_decoder->max/1000.0/cpu_freq_GHz,
+ (double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),
+ sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2)),
+ (double)time_optim->max/1000.0/get_cpu_freq_GHz(),
+ (double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),
+ sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)),
+ (double)time_decoder->max/1000.0/get_cpu_freq_GHz(),
dec_iter->n_iter_mean,
dec_iter->n_iter_std,
dec_iter->n_iter_max
diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c
index d9adf3e24f..8e7e377542 100644
--- a/openair1/PHY/CODING/TESTBENCH/polartest.c
+++ b/openair1/PHY/CODING/TESTBENCH/polartest.c
@@ -11,16 +11,12 @@
#include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h"
#include "PHY/CODING/coding_defs.h"
#include "SIMULATION/TOOLS/sim.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
//#include "common/utils/LOG/log.h"
-
+#include "coding_unitary_defs.h"
//#define DEBUG_DCI_POLAR_PARAMS
//#define DEBUG_POLAR_TIMING
//#define DEBUG_POLARTEST
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
int main(int argc, char *argv[])
{
@@ -113,7 +109,6 @@ int main(int argc, char *argv[])
//Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.)
time_stats_t timeEncoder,timeDecoder;
opp_enabled=1;
- cpu_freq_GHz = get_cpu_freq_GHz();
reset_meas(&timeEncoder);
reset_meas(&timeDecoder);
randominit(0);
@@ -324,9 +319,9 @@ if (logFlag){
#endif
//Iteration times are in microseconds.
- timeEncoderCumulative+=(timeEncoder.diff/(cpu_freq_GHz*1000.0));
- timeDecoderCumulative+=(timeDecoder.diff/(cpu_freq_GHz*1000.0));
- if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(cpu_freq_GHz*1000.0)), (timeDecoder.diff/(cpu_freq_GHz*1000.0)));
+ timeEncoderCumulative+=(timeEncoder.diff/(get_cpu_freq_GHz()*1000.0));
+ timeDecoderCumulative+=(timeDecoder.diff/(get_cpu_freq_GHz()*1000.0));
+ if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)), (timeDecoder.diff/(get_cpu_freq_GHz()*1000.0)));
if (nBitError<0) {
blockErrorCumulative++;
@@ -348,7 +343,7 @@ if (logFlag){
printf("[ListSize=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n",
decoderListSize, SNR, ((double)blockErrorCumulative/iterations),
((double)bitErrorCumulative / (iterations*testLength)),
- (double)timeEncoder.diff/timeEncoder.trials/(cpu_freq_GHz*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(cpu_freq_GHz*1000.0));
+ (double)timeEncoder.diff/timeEncoder.trials/(get_cpu_freq_GHz()*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(get_cpu_freq_GHz()*1000.0));
//(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations);
if (blockErrorCumulative==0 && bitErrorCumulative==0) break;
diff --git a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
index 02d5dc64e0..c9ed678a8f 100644
--- a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
+++ b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c
@@ -1,19 +1,15 @@
#include
#include "SIMULATION/TOOLS/sim.h"
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
-#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
+#include "coding_unitary_defs.h"
//#define DEBUG_SMALLBLOCKTEST
-RAN_CONTEXT_t RC;
-PHY_VARS_UE ***PHY_vars_UE_g;
-uint16_t NB_UE_INST = 1;
int main(int argc, char *argv[])
{
time_stats_t timeEncoder,timeDecoder;
opp_enabled=1;
- cpu_freq_GHz = get_cpu_freq_GHz();
reset_meas(&timeEncoder);
reset_meas(&timeDecoder);
randominit(0);
@@ -141,8 +137,8 @@ int main(int argc, char *argv[])
SNR,
((double)bitErrorCumulative / (iterations*messageLength)),
((double)blockErrorCumulative/iterations),
- ((double)timeEncoder.diff/timeEncoder.trials)/(cpu_freq_GHz),
- ((double)timeDecoder.diff/timeDecoder.trials)/(cpu_freq_GHz*1000.0));
+ ((double)timeEncoder.diff/timeEncoder.trials)/(get_cpu_freq_GHz()),
+ ((double)timeDecoder.diff/timeDecoder.trials)/(get_cpu_freq_GHz()*1000.0));
blockErrorCumulative=0;
bitErrorCumulative=0;
diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
index 785b588b9f..3226c97f87 100644
--- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
+++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c
@@ -39,7 +39,7 @@
#include "nrLDPC_bnProc.h"
#define NR_LDPC_ENABLE_PARITY_CHECK
-#define NR_LDPC_PROFILER_DETAIL
+//#define NR_LDPC_PROFILER_DETAIL
#ifdef NR_LDPC_DEBUG_MODE
#include "nrLDPC_tools/nrLDPC_debug.h"
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
index 18db8a01fb..8fe115b23a 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
@@ -40,9 +40,9 @@
#include "assertions.h"
int8_t polar_decoder(double *input,
- uint32_t *out,
- t_nrPolar_params *polarParams,
- uint8_t listSize)
+ uint32_t *out,
+ const t_nrPolar_params *polarParams,
+ uint8_t listSize)
{
//Assumes no a priori knowledge.
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
@@ -299,7 +299,7 @@ int8_t polar_decoder(double *input,
int8_t polar_decoder_dci(double *input,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint8_t listSize,
uint16_t n_RNTI) {
uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize);
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
index a44a08a701..c2e9fd9381 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
@@ -138,22 +138,22 @@ typedef struct nrPolar_params t_nrPolar_params;
void polar_encoder(uint32_t *input,
uint32_t *output,
- t_nrPolar_params *polarParams);
+ const t_nrPolar_params *polarParams);
void polar_encoder_dci(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint16_t n_RNTI);
void polar_encoder_fast(uint64_t *A,
void *out,
int32_t crcmask,
uint8_t ones_flag,
- t_nrPolar_params *polarParams);
+ const t_nrPolar_params *polarParams);
int8_t polar_decoder(double *input,
- uint32_t *output,
- t_nrPolar_params *polarParams,
+ uint32_t *output,
+ const t_nrPolar_params *polarParams,
uint8_t listSize);
uint32_t polar_decoder_int16(int16_t *input,
@@ -163,21 +163,21 @@ uint32_t polar_decoder_int16(int16_t *input,
int8_t polar_decoder_dci(double *input,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint8_t listSize,
uint16_t n_RNTI);
void generic_polar_decoder(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void applyFtoleft(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void applyGtoright(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void computeBeta(const t_nrPolar_params *pp,
- decoder_node_t *node);
+ decoder_node_t *node);
void build_decoder_tree(t_nrPolar_params *pp);
void build_polar_tables(t_nrPolar_params *polarParams);
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
index 27c062c217..e61b3dff9b 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
@@ -43,7 +43,7 @@
void polar_encoder(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams) {
+ const t_nrPolar_params *polarParams) {
if (1) {//polarParams->idx == 0 || polarParams->idx == 1) { //PBCH or PDCCH
/*
uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<payloadBits);
@@ -154,7 +154,7 @@ void polar_encoder(uint32_t *in,
void polar_encoder_dci(uint32_t *in,
uint32_t *out,
- t_nrPolar_params *polarParams,
+ const t_nrPolar_params *polarParams,
uint16_t n_RNTI) {
#ifdef DEBUG_POLAR_ENCODER_DCI
printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]);
@@ -251,9 +251,9 @@ void polar_encoder_dci(uint32_t *in,
#endif
}
-static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
+static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline));
-static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,void *out) {
+static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) {
// handle rate matching with a single 128 bit word using bit shuffling
// can be done with SIMD intrisics if needed
@@ -411,7 +411,7 @@ void polar_encoder_fast(uint64_t *A,
void *out,
int32_t crcmask,
uint8_t ones_flag,
- t_nrPolar_params *polarParams) {
+ const t_nrPolar_params *polarParams) {
// AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
diff --git a/openair1/PHY/CODING/nr_rate_matching.c b/openair1/PHY/CODING/nr_rate_matching.c
index 1afe82497a..b1ce6ab0de 100644
--- a/openair1/PHY/CODING/nr_rate_matching.c
+++ b/openair1/PHY/CODING/nr_rate_matching.c
@@ -493,8 +493,8 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
}
ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z;
- AssertFatal(Foffset <= E,"Foffset %d > E %d\n",Foffset,E);
- AssertFatal(Foffset <= Ncb,"Foffset %d > Ncb %d\n",Foffset,Ncb);
+ AssertFatal(Foffset <= E,"Foffset %d > E %d\n",Foffset,E);
+ AssertFatal(Foffset <= Ncb,"Foffset %d > Ncb %d\n",Foffset,Ncb);
#ifdef RM_DEBUG
printf("nr_rate_matching_ldpc_rx: Clear %d, E %d, k0 %d, Ncb %d, rvidx %d\n", clear, E, ind, Ncb, rvidx);
diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c
index 0990a58266..81fb28cc98 100644
--- a/openair1/PHY/INIT/init_top.c
+++ b/openair1/PHY/INIT/init_top.c
@@ -73,7 +73,6 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) {
init_unscrambling_lut();
init_scrambling_lut();
//set_taus_seed(1328);
- init_sss();
}
void free_lte_top(void) {
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index 05f7de27aa..21a1010cf9 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -35,7 +35,7 @@
#include "assertions.h"
#include
#include "nfapi/oai_integration/vendor_ext.h"
-
+#include
extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
extern int32_t get_uldl_offset(int eutra_bandP);
@@ -46,6 +46,17 @@ uint8_t dmrs1_tab[8] = { 0, 2, 3, 4, 6, 8, 9, 10 };
int N_RB_DL_array[6] = { 6, 15, 25, 50, 75, 100 };
+#include "common/ran_context.h"
+extern RAN_CONTEXT_t RC;
+
+void pdsch_procedures(PHY_VARS_eNB *eNB,
+ L1_rxtx_proc_t *proc,
+ int harq_pid,
+ LTE_eNB_DLSCH_t *dlsch,
+ LTE_eNB_DLSCH_t *dlsch1);
+
+void init_sss(void);
+
int
l1_north_init_eNB () {
int i,j;
@@ -347,6 +358,33 @@ void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx,
lte_gold_mbsfn_khz_1dot25 (fp, RC.eNB[Mod_id][CC_id]->lte_gold_mbsfn_khz_1dot25_table, fp->Nid_cell_mbsfn);
}
+void fill_subframe_mask(PHY_VARS_eNB *eNB) {
+
+ AssertFatal(eNB->subframe_mask!=NULL,"Subframe mask is null\n");
+ int32_t **dummy_tx=eNB->common_vars.txdataF;
+ eNB->common_vars.txdataF = eNB->subframe_mask;
+
+ for (int sf=0;sf<10;sf++) {
+ if (subframe_select(&eNB->frame_parms,sf)==SF_DL) {
+ LTE_DL_eNB_HARQ_t *dlsch_harq=eNB->dlsch[0][0]->harq_processes[0];
+ L1_rxtx_proc_t proc;
+ proc.frame_tx=0;
+ proc.subframe_tx=sf;
+ eNB->dlsch[0][0]->harq_ids[0][sf]=0;
+ eNB->dlsch[0][0]->rnti=0x1234;
+ dlsch_harq->nb_rb=48;
+ dlsch_harq->rb_alloc[0]=(uint32_t)0xffffffff;
+ dlsch_harq->Qm=2;
+ dlsch_harq->Nl=1;
+ dlsch_harq->pdsch_start=1;
+ dlsch_harq->mimo_mode=(eNB->frame_parms.nb_antenna_ports_eNB>1) ? ALAMOUTI : SISO;
+ dlsch_harq->dl_power_off = 1;
+ computeRhoB_eNB(4,eNB->frame_parms.pdsch_config_common.p_b,eNB->frame_parms.nb_antenna_ports_eNB,eNB->dlsch[0][0],dlsch_harq->dl_power_off);
+ pdsch_procedures(eNB,&proc,0,eNB->dlsch[0][0],NULL);
+ }
+ }
+ eNB->common_vars.txdataF = dummy_tx;
+}
int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
unsigned char is_secondary_eNB,
@@ -385,7 +423,9 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
lte_gold (fp, eNB->lte_gold_table, fp->Nid_cell);
generate_pcfich_reg_mapping (fp);
generate_phich_reg_mapping (fp);
+ init_sss();
+ init_fde();
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
eNB->first_run_timing_advance[UE_id] =
1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
@@ -397,9 +437,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
eNB->first_run_I0_measurements =
1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
+ eNB->use_DTX=1;
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
common_vars->rxdata = (int32_t **)NULL;
common_vars->txdataF = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t *));
+ if (eNB->use_DTX==0) {
+ eNB->subframe_mask = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t *));
+ }
common_vars->rxdataF = (int32_t **)malloc16(64*sizeof(int32_t *));
LOG_I(PHY,"[INIT] NB_ANTENNA_PORTS_ENB:%d fp->nb_antenna_ports_eNB:%d\n", NB_ANTENNA_PORTS_ENB, fp->nb_antenna_ports_eNB);
@@ -409,17 +453,19 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LOG_I(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
i,common_vars->txdataF[i],
fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t));
+ if (eNB->use_DTX==0 && inb_antenna_ports_eNB) eNB->subframe_mask[i] = malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
}
}
+ LOG_I(PHY,"[INIT]SRS allocation\n");
// Channel estimates for SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
- srs_vars[UE_id].srs_ch_estimates = (int32_t **) malloc16 (64 * sizeof (int32_t *));
- srs_vars[UE_id].srs_ch_estimates_time = (int32_t **) malloc16 (64 * sizeof (int32_t *));
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
+ srs_vars[srs_id].srs_ch_estimates = (int32_t **) malloc16 (64 * sizeof (int32_t *));
+ srs_vars[srs_id].srs_ch_estimates_time = (int32_t **) malloc16 (64 * sizeof (int32_t *));
for (i = 0; i < 64; i++) {
- srs_vars[UE_id].srs_ch_estimates[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size);
- srs_vars[UE_id].srs_ch_estimates_time[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size * 2);
+ srs_vars[srs_id].srs_ch_estimates[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size);
+ srs_vars[srs_id].srs_ch_estimates_time[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size * 2);
}
} //UE_id
@@ -427,10 +473,11 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
init_ulsch_power_LUT ();
// SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
- srs_vars[UE_id].srs = (int32_t *) malloc16_clear (2 * fp->ofdm_symbol_size * sizeof (int32_t));
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
+ srs_vars[srs_id].srs = (int32_t *) malloc16_clear (2 * fp->ofdm_symbol_size * sizeof (int32_t));
}
+ LOG_I(PHY,"PRACH allocation\n");
// PRACH
prach_vars->prachF = (int16_t *) malloc16_clear (1024 * 2 * sizeof (int16_t));
// assume maximum of 64 RX antennas for PRACH receiver
@@ -461,34 +508,33 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]);
}*/
- for (UE_id=0; UE_idrxdataF_ext = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->rxdataF_ext2 = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->drs_ch_estimates = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->drs_ch_estimates_time = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->rxdataF_comp = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->ul_ch_mag = (int32_t **) malloc16 (2 * sizeof (int32_t *));
- pusch_vars[UE_id]->ul_ch_magb = (int32_t **) malloc16 (2 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id] = (LTE_eNB_PUSCH *) malloc16_clear (NUMBER_OF_ULSCH_MAX * sizeof (LTE_eNB_PUSCH));
+ pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->drs_ch_estimates = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->drs_ch_estimates_time = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->rxdataF_comp = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->ul_ch_mag = (int32_t **) malloc16 (4 * sizeof (int32_t *));
+ pusch_vars[ULSCH_id]->ul_ch_magb = (int32_t **) malloc16 (4 * sizeof (int32_t *));
AssertFatal (fp->ofdm_symbol_size > 127, "fp->ofdm_symbol_size %d<128\n", fp->ofdm_symbol_size);
AssertFatal (fp->symbols_per_tti > 11, "fp->symbols_per_tti %d < 12\n", fp->symbols_per_tti);
AssertFatal (fp->N_RB_UL > 5, "fp->N_RB_UL %d < 6\n", fp->N_RB_UL);
-
- for (i = 0; i < 2; i++) {
- // RK 2 times because of output format of FFT!
+ AssertFatal (fp->nb_antennas_rx > 0,"fp->nb_antennas_rx = %d\n",fp->nb_antennas_rx);
+ for (i = 0; i < fp->nb_antennas_rx; i++) {
// FIXME We should get rid of this
- pusch_vars[UE_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size );
- pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
- pusch_vars[UE_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
- pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
+ pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 4*sizeof(int32_t)*fp->ofdm_symbol_size );
+ pusch_vars[ULSCH_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti );
+ pusch_vars[ULSCH_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
+ pusch_vars[ULSCH_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 );
}
- pusch_vars[UE_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
- } //UE_id
+ pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+ } //ULSCH_id
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++)
eNB->UE_stats_ptr[UE_id] = &eNB->UE_stats[UE_id];
@@ -520,21 +566,19 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) {
free_and_zero(common_vars->rxdataF);
// Channel estimates for SRS
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
+ for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) {
for (i=0; i<64; i++) {
- if (srs_vars[UE_id].srs_ch_estimates)
- free_and_zero(srs_vars[UE_id].srs_ch_estimates[i]);
- if (srs_vars[UE_id].srs_ch_estimates_time)
- free_and_zero(srs_vars[UE_id].srs_ch_estimates_time[i]);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates[i]);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates_time[i]);
}
- free_and_zero(srs_vars[UE_id].srs_ch_estimates);
- free_and_zero(srs_vars[UE_id].srs_ch_estimates_time);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates);
+ free_and_zero(srs_vars[srs_id].srs_ch_estimates_time);
} //UE_id
free_ul_ref_sigs();
- for (UE_id=0; UE_idprachF);
@@ -558,37 +602,27 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) {
free_and_zero(prach_vars_br->prachF);
free_and_zero(prach_vars->rxsigF[0]);
- if (pusch_vars[UE_id]) {
- LTE_eNB_PUSCH *pv = pusch_vars[UE_id];
- for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
- for (i = 0; i < 2; i++) {
- if (pv->rxdataF_ext)
- free_and_zero(pv->rxdataF_ext[i]);
- if (pv->rxdataF_ext2)
- free_and_zero(pv->rxdataF_ext2[i]);
- if (pv->drs_ch_estimates)
- free_and_zero(pv->drs_ch_estimates[i]);
- if (pv->drs_ch_estimates_time)
- free_and_zero(pv->drs_ch_estimates_time[i]);
- if (pv->rxdataF_comp)
- free_and_zero(pv->rxdataF_comp[i]);
- if (pv->ul_ch_mag)
- free_and_zero(pv->ul_ch_mag[i]);
- if (pv->ul_ch_magb)
- free_and_zero(pv->ul_ch_magb[i]);
- }
-
- free_and_zero(pv->rxdataF_ext);
- free_and_zero(pv->rxdataF_ext2);
- free_and_zero(pv->drs_ch_estimates);
- free_and_zero(pv->drs_ch_estimates_time);
- free_and_zero(pv->rxdataF_comp);
- free_and_zero(pv->ul_ch_mag);
- free_and_zero(pv->ul_ch_magb);
- free_and_zero(pv->llr);
- free_and_zero(pv);
+ for (int ULSCH_id=0; ULSCH_idnb_antennas_rx; i++) {
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates_time[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag[i]);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb[i]);
}
- }
+
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates);
+ free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates_time);
+ free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag);
+ free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb);
+ free_and_zero(pusch_vars[ULSCH_id]->llr);
+ free_and_zero(pusch_vars[ULSCH_id]);
+ } //UE_id
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) eNB->UE_stats_ptr[UE_id] = NULL;
}
diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c
index 8ad928f8a0..a856c33999 100644
--- a/openair1/PHY/INIT/lte_init_ru.c
+++ b/openair1/PHY/INIT/lte_init_ru.c
@@ -21,9 +21,8 @@
#include "phy_init.h"
#include "SCHED/sched_eNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
-#include "SIMULATION/TOOLS/sim.h"
+//#include "SIMULATION/TOOLS/sim.h"
#include "LTE_RadioResourceConfigCommonSIB.h"
#include "LTE_RadioResourceConfigDedicated.h"
#include "LTE_TDD-Config.h"
@@ -34,6 +33,8 @@
void init_7_5KHz(void);
+extern const char ru_if_types[MAX_RU_IF_TYPES][20];
+
int phy_init_RU(RU_t *ru) {
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
RU_CALIBRATION *calibration = &ru->calibration;
@@ -44,6 +45,7 @@ int phy_init_RU(RU_t *ru) {
if (ru->is_slave == 1) {
generate_ul_ref_sigs_rx();
}
+ else generate_ul_ref_sigs();
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals
// Time-domain signals
@@ -135,14 +137,14 @@ int phy_init_RU(RU_t *ru) {
}
}
- AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
- RC.nb_L1_inst,NUMBER_OF_eNB_MAX);
- LOG_D(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst);
+ AssertFatal(ru->num_eNB <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n",
+ ru->num_eNB,NUMBER_OF_eNB_MAX);
+ LOG_D(PHY,"[INIT] %s() ru->num_eNB:%d \n", __FUNCTION__, ru->num_eNB);
int starting_antenna_index=0;
for (i=0; iidx; i++) starting_antenna_index+=ru->nb_tx;
- for (i=0; inum_eNB; i++) {
for (p=0; p<15; p++) {
LOG_D(PHY,"[INIT] %s() nb_antenna_ports_eNB:%d \n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB);
@@ -240,7 +242,7 @@ void phy_free_RU(RU_t *ru) {
free_and_zero(ru->prach_rxsigF[0]);
/* ru->prach_rxsigF_br is not allocated -> don't free */
- for (i = 0; i < RC.nb_L1_inst; i++) {
+ for (i = 0; i < ru->num_eNB; i++) {
for (p = 0; p < 15; p++) {
if (p < ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p == 5) {
for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c
index 2255005b2a..c3f09fa78c 100644
--- a/openair1/PHY/INIT/lte_init_ue.c
+++ b/openair1/PHY/INIT/lte_init_ue.c
@@ -39,6 +39,7 @@ void init_7_5KHz(void);
uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
+void init_sss(void);
void phy_config_sib1_ue(module_id_t Mod_id,int CC_id,
uint8_t eNB_id,
@@ -629,6 +630,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
init_frame_parms(&ue->frame_parms,1);
lte_sync_time_init(&ue->frame_parms);
init_lte_top(&ue->frame_parms);
+ init_sss();
init_7_5KHz();
init_ul_hopping(&ue->frame_parms);
// many memory allocation sizes are hard coded
diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c
index 1505ee018e..504c8fa80a 100644
--- a/openair1/PHY/INIT/lte_param_init.c
+++ b/openair1/PHY/INIT/lte_param_init.c
@@ -25,7 +25,6 @@
#include
#include
-#include "SIMULATION/TOOLS/sim.h"
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
#include "PHY/defs_UE.h"
@@ -33,7 +32,9 @@
#include "phy_init.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
-#include "targets/RT/USER/lte-softmodem.h"
+#include "executables/softmodem-common.h"
+#include "SIMULATION/TOOLS/sim.h"
+
extern PHY_VARS_eNB *eNB;
extern PHY_VARS_UE *UE;
extern RU_t *ru;
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index a05b58de6c..45338ef622 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -20,6 +20,7 @@
*/
#include "executables/nr-softmodem-common.h"
+#include "common/utils/nr/nr_common.h"
#include "PHY/defs_gNB.h"
#include "PHY/phy_extern.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
@@ -45,10 +46,42 @@
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
-/*
-extern uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn);
-extern openair0_config_t openair0_cfg[MAX_CARDS];
-*/
+static
+uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex)
+{
+ const uint64_t dl_freq_khz = downlink_frequency / 1000;
+ const int32_t delta_duplex_khz = delta_duplex / 1000;
+
+ uint64_t center_freq_diff_khz = 999999999999999999; // 2^64
+ uint16_t current_band = 0;
+
+ for (int ind = 0; ind < nr_bandtable_size; ind++) {
+
+ LOG_D(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min, nr_bandtable[ind].ul_min);
+
+ if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max)
+ continue;
+
+ int32_t current_offset_khz = nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min;
+
+ if (current_offset_khz != delta_duplex_khz)
+ continue;
+
+ uint64_t center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min) / 2;
+
+ if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){
+ current_band = nr_bandtable[ind].band;
+ center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz);
+ }
+ }
+
+ LOG_I(PHY, "DL frequency %"PRIu64": band %d, UL frequency %"PRIu64"\n",
+ downlink_frequency, current_band, downlink_frequency+delta_duplex);
+
+ AssertFatal(current_band != 0, "Can't find EUTRA band for frequency %"PRIu64" and duplex_spacing %u\n", downlink_frequency, delta_duplex);
+
+ return current_band;
+}
int l1_north_init_gNB() {
@@ -77,7 +110,7 @@ int l1_north_init_gNB() {
int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
unsigned char is_secondary_gNB,
- unsigned char abstraction_flag) {
+ unsigned char lowmem_flag) {
// shortcuts
NR_DL_FRAME_PARMS *const fp = &gNB->frame_parms;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
@@ -95,6 +128,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
while(gNB->configured == 0) usleep(10000);
+ if (lowmem_flag == 1) {
+ gNB->number_of_nr_dlsch_max = 2;
+ gNB->number_of_nr_ulsch_max = 2;
+ }
+ else {
+ gNB->number_of_nr_dlsch_max = NUMBER_OF_NR_DLSCH_MAX;
+ gNB->number_of_nr_ulsch_max = NUMBER_OF_NR_ULSCH_MAX;
+ }
+
load_dftslib();
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id);
@@ -109,6 +151,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n");
+ gNB->bad_pucch = 0;
+
for (int slot=0; slotslots_per_frame; slot++) {
pdcch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot);
@@ -183,28 +227,28 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
}
}
+ nr_init_csi_rs(gNB, cfg->cell_config.phy_cell_id.value);
+
/* Generate low PAPR type 1 sequences for PUSCH DMRS, these are used if transform precoding is enabled. */
generate_lowpapr_typ1_refsig_sequences(SHRT_MAX);
-
-
- nr_init_csi_rs(gNB, 0); // TODO scramblingID currently hardcoded to 0, to be taken from higher layer parameter scramblingID when implemented
/// Transport init necessary for NR synchro
init_nr_transport(gNB);
-
gNB->first_run_I0_measurements = 1;
common_vars->rxdata = (int32_t **)malloc16(Prx*sizeof(int32_t*));
common_vars->txdataF = (int32_t **)malloc16(Ptx*sizeof(int32_t*));
common_vars->rxdataF = (int32_t **)malloc16(Prx*sizeof(int32_t*));
+ common_vars->beam_id = (uint8_t **)malloc16(Ptx*sizeof(uint8_t*));
for (i=0;itxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP
LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
i,common_vars->txdataF[i],
fp->samples_per_frame_wCP*sizeof(int32_t));
-
+ common_vars->beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
+ memset(common_vars->beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame);
}
for (i=0;irxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t));
@@ -250,7 +294,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
- for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) {
pusch_vars[ULSCH_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) );
pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **)malloc16(Prx*sizeof(int32_t *) );
@@ -335,7 +379,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
free_and_zero(prach_vars->prach_ifft[0]);
free_and_zero(prach_vars->rxsigF[0]);
*/
- for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) {
for (int i = 0; i < 2; i++) {
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]);
free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]);
@@ -431,8 +475,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
gNB->mac_enabled = 1;
if (mu==1) {
- fp->dl_CarrierFreq = 3500000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
- fp->ul_CarrierFreq = 3500000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
+ fp->dl_CarrierFreq = 3600000000;//from_nrarfcn(gNB_config->nfapi_config.rf_bands.rf_band[0],gNB_config->nfapi_config.nrarfcn.value);
+ fp->ul_CarrierFreq = 3600000000;//fp->dl_CarrierFreq - (get_uldl_offset(gNB_config->nfapi_config.rf_bands.rf_band[0])*100000);
fp->nr_band = 78;
// fp->threequarter_fs= 0;
} else if (mu==3) {
@@ -441,7 +485,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,
fp->nr_band = 261;
// fp->threequarter_fs= 0;
}
-
+
+ fp->threequarter_fs = 0;
gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band);
nr_init_frame_parms(gNB_config, fp);
@@ -455,7 +500,6 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
uint8_t short_sequence, num_sequences, rootSequenceIndex, fd_occasion;
NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms;
nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config;
- int32_t dlul_offset = 0;
memcpy((void*)gNB_config,phy_config->cfg,sizeof(*phy_config->cfg));
RC.gNB[Mod_id]->mac_enabled = 1;
@@ -466,16 +510,9 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<ssb_config.scs_common.value);
fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ;
- //fp->nr_band = *RC.nrmac[Mod_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
- lte_frame_type_t frame_type = 0; // FDD
-
- get_band(fp->dl_CarrierFreq,&fp->nr_band,&dlul_offset,&frame_type); //RC.nrmac[Mod_id] cannot be accessed in NFAPI
+ int32_t dlul_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq;
+ fp->nr_band = get_band(fp->dl_CarrierFreq, dlul_offset);
- get_delta_duplex(fp->nr_band, gNB_config->ssb_config.scs_common.value, &dlul_offset);
- dlul_offset *= 1000;
-
- AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + dlul_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + dlul_offset);
-
LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset);
fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
@@ -504,7 +541,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
// }
RC.gNB[Mod_id]->configured = 1;
- init_symbol_rotation(fp,fp->dl_CarrierFreq);
+ init_symbol_rotation(fp);
LOG_I(PHY,"gNB %d configured\n",Mod_id);
}
@@ -533,9 +570,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i);
}
- for (i=0; inumber_of_nr_dlsch_max; i++) {
- LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,NUMBER_OF_NR_DLSCH_MAX);
+ LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max);
for (j=0; j<2; j++) {
gNB->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
@@ -543,9 +580,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
}
}
- for (i=0; inumber_of_nr_ulsch_max; i++) {
- LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
+ LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max);
for (j=0; j<2; j++) {
// ULSCH for data
@@ -556,27 +593,6 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
exit(-1);
}
- /*
- LOG_I(PHY,"Initializing nFAPI for ULSCH, UE %d\n",i);
- // [hna] added here for RT implementation
- uint8_t harq_pid = 0;
- nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &gNB->ulsch[i+1][j]->harq_processes[harq_pid]->ulsch_pdu;
-
- // --------- setting rel15_ul parameters ----------
- rel15_ul->rnti = 0x1234;
- rel15_ul->ulsch_pdu_rel15.start_rb = 0;
- rel15_ul->ulsch_pdu_rel15.number_rbs = 50;
- rel15_ul->ulsch_pdu_rel15.start_symbol = 2;
- rel15_ul->ulsch_pdu_rel15.number_symbols = 12;
- rel15_ul->ulsch_pdu_rel15.length_dmrs = gNB->dmrs_UplinkConfig.pusch_maxLength;
- rel15_ul->ulsch_pdu_rel15.Qm = 2;
- rel15_ul->ulsch_pdu_rel15.R = 679;
- rel15_ul->ulsch_pdu_rel15.mcs = 9;
- rel15_ul->ulsch_pdu_rel15.rv = 0;
- rel15_ul->ulsch_pdu_rel15.n_layers = 1;
- ///////////////////////////////////////////////////
- */
-
}
}
diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c
index 648b820f07..097c2b3ad2 100644
--- a/openair1/PHY/INIT/nr_init_ru.c
+++ b/openair1/PHY/INIT/nr_init_ru.c
@@ -21,9 +21,6 @@
#include "phy_init.h"
#include "SCHED/sched_common.h"
-#include "PHY/phy_extern.h"
-#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
-#include "SIMULATION/TOOLS/sim.h"
/*#include "RadioResourceConfigCommonSIB.h"
#include "RadioResourceConfigDedicated.h"
#include "TDD-Config.h"
@@ -33,6 +30,10 @@
#include
#include "openair1/PHY/defs_RU.h"
+void init_prach_ru_list(RU_t *ru);
+
+extern const char ru_if_types[MAX_RU_IF_TYPES][20];
+
int nr_phy_init_RU(RU_t *ru) {
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
@@ -44,7 +45,7 @@ int nr_phy_init_RU(RU_t *ru) {
nfapi_nr_config_request_scf_t *cfg;
ru->nb_log_antennas=0;
- for (int n=0;nnum_gNB;n++) {
cfg = &ru->config;
if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value;
}
@@ -117,34 +118,43 @@ int nr_phy_init_RU(RU_t *ru) {
}
}
- AssertFatal(RC.nb_nr_L1_inst <= NUMBER_OF_eNB_MAX,"gNB instances %d > %d\n",
- RC.nb_nr_L1_inst,NUMBER_OF_gNB_MAX);
+ AssertFatal(ru->num_gNB <= NUMBER_OF_gNB_MAX,"gNB instances %d > %d\n",
+ ru->num_gNB,NUMBER_OF_gNB_MAX);
- LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst);
-
- int beam_count = 0;
- if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1
- for (p=0;pnb_log_antennas;p++) {
- if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
- beam_count++;
- }
- AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
-
- int l_ind = 0;
- for (i=0; inum_gNB:%d \n", __FUNCTION__, ru->num_gNB);
+
+ if (ru->do_precoding == 1) {
+ int beam_count = 0;
+ if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1
for (p=0;pnb_log_antennas;p++) {
- if ((fp->L_ssb >> (63-p)) & 0x01) {
- ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
- for (j=0; jnb_tx; j++) {
- ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
- for (re=0; reofdm_symbol_size; re++)
- ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind];
- //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j);
- l_ind++;
- } // for j
- } // for p
+ //if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
+ beam_count++;
}
+ AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
+
+ for (i=0; inum_gNB; i++) {
+ int l_ind = 0;
+ for (p=0;pnb_log_antennas;p++) {
+ //if ((fp->L_ssb >> (63-p)) & 0x01) {
+ ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
+ for (j=0; jnb_tx; j++) {
+ ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
+ AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i);
+ for (re=0; reofdm_symbol_size; re++)
+ ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind];
+ //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j);
+ l_ind++;
+ } // for j
+ //}
+ } // for p
} //for i
+ }
+
+ ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*));
+ for(i=0; i< ru->nb_tx; ++i) {
+ ru->common.beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
+ memset(ru->common.beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame);
+ }
}
} // !=IF5
@@ -193,8 +203,7 @@ void nr_phy_free_RU(RU_t *ru)
free_and_zero(ru->prach_rxsigF[j][i]);
}
}
-
- for (i = 0; i < RC.nb_nr_L1_inst; i++) {
+ for (i = 0; i < ru->num_gNB; i++) {
for (p = 0; p < 15; p++) {
for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
free_and_zero(ru->beam_weights[i][p]);
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index 8bcc58160f..5d568e266f 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -28,6 +28,7 @@
#include "TDD-Config.h"
#include "MBSFN-SubframeConfigList.h"*/
#include "openair1/PHY/defs_RU.h"
+#include "openair1/PHY/impl_defs_nr.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "assertions.h"
#include
@@ -71,33 +72,39 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch,
pdsch->llr128 = (int16_t **)malloc16_clear( sizeof(int16_t *) );
// FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV
// FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there
- pdsch->rxdataF_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
- pdsch->dl_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
+ pdsch->rxdataF_ext = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->rho = (int32_t ***)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t **) );
+ pdsch->dl_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
//pdsch->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
//pdsch->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
- pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->ptrs_phase_per_slot = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->ptrs_re_per_slot = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
- pdsch->dl_ch_ptrs_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
+ pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->ptrs_phase_per_slot = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->ptrs_re_per_slot = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pdsch->dl_ch_ptrs_estimates_ext = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
// the allocated memory size is fixed:
- AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
+ AssertFatal( fp->nb_antennas_rx <= 4, "nb_antennas_rx > 4" );//Extend the max number of UE Rx antennas to 4
+ const size_t num = 7*2*fp->N_RB_DL*12;
for (int i=0; inb_antennas_rx; i++) {
- pdsch->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
+ pdsch->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
+ pdsch->rxdataF_uespec_pilots[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12);
+ pdsch->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14 );
+ pdsch->ptrs_re_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14);
+ pdsch->dl_ch_ptrs_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * num);
+ pdsch->rho[i] = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*NR_MAX_NB_LAYERS*sizeof(int32_t *) );
- for (int j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
- const int idx = (j<<1)+i;
- const size_t num = 7*2*fp->N_RB_DL*12;
- pdsch->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
- pdsch->rxdataF_uespec_pilots[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12);
+ for (int j=0; jnb_antennas_rx)+i;
+ for (int k=0; krho[i][j*NR_MAX_NB_LAYERS+k] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
+ }
pdsch->rxdataF_comp0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2);
pdsch->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
@@ -108,9 +115,6 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch,
pdsch->dl_ch_mag0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_magb0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
pdsch->dl_ch_magr0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
- pdsch->ptrs_re_per_slot[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * 14);
- pdsch->ptrs_phase_per_slot[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14 );
- pdsch->dl_ch_ptrs_estimates_ext[idx]= (int32_t *)malloc16_clear( sizeof(int32_t) * num);
}
}
}
@@ -139,16 +143,12 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
int n_scid;
abstraction_flag = 0;
- fp->nb_antennas_tx = 1;
- fp->nb_antennas_rx=1;
- // dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig;
- // ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig;
LOG_I(PHY, "Initializing UE vars (abstraction %u) for gNB TXant %u, UE RXant %u\n", abstraction_flag, fp->nb_antennas_tx, fp->nb_antennas_rx);
- //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
+ //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_gNB_INST);
phy_init_nr_top(ue);
// many memory allocation sizes are hard coded
- AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
- AssertFatal(nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" );
+ AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
+ AssertFatal( nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" );
// init phy_vars_ue
for (i=0; i<4; i++) {
@@ -186,29 +186,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
/////////////////////////PUSCH DMRS init/////////////////////////
///////////
-
- // default values until overwritten by RRCConnectionReconfiguration
-
- for (i=0; ipusch_config.pusch_TimeDomainResourceAllocation[i] = (PUSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(PUSCH_TimeDomainResourceAllocation_t));
- ue->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeB;
- }
-
- for (i=0;iPDSCH_Config.pdsch_TimeDomainResourceAllocation[i] = (NR_PDSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
- ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[i]->mappingType = typeA;
- }
-
- //------------- config DMRS parameters--------------//
- // dmrs_Uplink_Config->pusch_dmrs_type = pusch_dmrs_type1;
- // dmrs_Uplink_Config->pusch_dmrs_AdditionalPosition = pusch_dmrs_pos0;
- // dmrs_Uplink_Config->pusch_maxLength = pusch_len1;
- //-------------------------------------------------//
- ue->dmrs_DownlinkConfig.pdsch_dmrs_type = pdsch_dmrs_type1;
- ue->dmrs_DownlinkConfig.pdsch_dmrs_AdditionalPosition = pdsch_dmrs_pos0;
- ue->dmrs_DownlinkConfig.pdsch_maxLength = pdsch_len1;
- //-------------------------------------------------//
-
ue->nr_gold_pusch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
pusch_dmrs = ue->nr_gold_pusch_dmrs;
n_scid = 0; // This quantity is indicated by higher layer parameter dmrs-SeqInitialization
@@ -276,7 +253,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
- //PDCCH DMRS init (eNB offset = 0)
+ //PDCCH DMRS init (gNB offset = 0)
ue->nr_gold_pdcch[0] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
uint32_t ***pdcch_dmrs = ue->nr_gold_pdcch[0];
AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n");
@@ -291,6 +268,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
+ ue->scramblingID_pdcch = fp->Nid_cell;
+ nr_gold_pdcch(ue,fp->Nid_cell);
+
//PDSCH DMRS init (eNB offset = 0)
ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***));
uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0];
@@ -310,6 +290,12 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
}
+ // initializing the scrambling IDs for PDSCH DMRS
+ for (int i=0; i<2; i++)
+ ue->scramblingID[i]=fp->Nid_cell;
+
+ nr_gold_pdsch(ue,ue->scramblingID);
+
// DLSCH
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
- ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
- ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
- ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
- ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear(sizeof(int16_t *));
- ue->pdsch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16_clear(fp->nb_antennas_rx*sizeof(int32_t *));
+ ue->pdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
+ ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
+ ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
+ ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
+ ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
}
- for (int i=0; inb_antennas_rx; i++) {
- for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
- }
- }
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
}
for (i=0; inb_antennas_rx; i++)
for (j=0; j<4; j++) {
- const int idx = (j<<1)+i;
+ const int idx = (j*fp->nb_antennas_rx)+i;
const size_t num = 7*2*fp->N_RB_DL*12+4;
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
}
}
@@ -361,15 +341,15 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
for (k=0; k<8; k++) { //harq_pid
for (l=0; l<8; l++) { //round
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
+ ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
}
for (int i=0; inb_antennas_rx; i++)
for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
- const int idx = (j<<1)+i;
+ const int idx = (j*fp->nb_antennas_rx)+i;
for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
@@ -383,26 +363,26 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
for (th_id=0; th_idpdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
- ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
- ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
- ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear(4*2*100*12 );
- ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
+ ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
+ ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 );
+ ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
// Channel estimates
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *));
for (i=0; inb_antennas_rx; i++) {
ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4));
for (j=0; j<4; j++) {
- int idx = (j<<1) + i;
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH));
- ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->ofdm_symbol_size*2);
+ int idx = (j*fp->nb_antennas_rx)+i;
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
+ ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
// size_t num = 7*2*fp->N_RB_DL*12;
size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
@@ -414,24 +394,24 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
}
// PBCH
- pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *));
- pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
- pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear(1920); //
- prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)));
- prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)));
+ pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
+ pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
+ prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
+ prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
for (i=0; inb_antennas_rx; i++) {
pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
- int idx = (j<<1)+i;
- pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4);
- pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size));
- pbch_vars[gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size));
- pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4);
+ int idx = (j*fp->nb_antennas_rx)+i;
+ pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
+ pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
+ pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
+ pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
}
}
}
@@ -463,9 +443,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
else
ue->pdsch_config_dedicated->p_a = dB0;
- // set channel estimation to do linear interpolation in time
- ue->high_speed_flag = 1;
- ue->ch_est_alpha = 24576;
// enable MIB/SIB decoding by default
ue->decode_MIB = 1;
ue->decode_SIB = 1;
@@ -507,50 +484,36 @@ void init_N_TA_offset(PHY_VARS_NR_UE *ue){
if (fp->frame_type == FDD) {
ue->N_TA_offset = 0;
} else {
- int N_RB = fp->N_RB_DL;
int N_TA_offset = fp->ul_CarrierFreq < 6e9 ? 400 : 431; // reference samples for 25600Tc @ 30.72 Ms/s for FR1, same @ 61.44 Ms/s for FR2
- double factor = 1;
+
+ double factor = 1.0;
switch (fp->numerology_index) {
case 0: //15 kHz scs
AssertFatal(N_TA_offset == 400, "scs_common 15kHz only for FR1\n");
- if (N_RB <= 25) factor = .25; // 7.68 Ms/s
- else if (N_RB <=50) factor = .5; // 15.36 Ms/s
- else if (N_RB <=75) factor = 1.0; // 30.72 Ms/s
- else if (N_RB <=100) factor = 1.0; // 30.72 Ms/s
- else AssertFatal(1==0, "Too many PRBS for mu=0\n");
+ factor = fp->samples_per_subframe / 30720.0;
break;
case 1: //30 kHz sc
AssertFatal(N_TA_offset == 400, "scs_common 30kHz only for FR1\n");
- if (N_RB <= 106) factor = 2.0; // 61.44 Ms/s
- else if (N_RB <= 275) factor = 4.0; // 122.88 Ms/s
+ factor = fp->samples_per_subframe / 30720.0;
break;
case 2: //60 kHz scs
AssertFatal(1==0, "scs_common should not be 60 kHz\n");
break;
case 3: //120 kHz scs
AssertFatal(N_TA_offset == 431, "scs_common 120kHz only for FR2\n");
+ factor = fp->samples_per_subframe / 61440.0;
break;
case 4: //240 kHz scs
- AssertFatal(1==0, "scs_common should not be 60 kHz\n");
- if (N_RB <= 32) factor = 1.0; // 61.44 Ms/s
- else if (N_RB <= 66) factor = 2.0; // 122.88 Ms/s
- else AssertFatal(1==0, "N_RB %d is too big for curretn FR2 implementation\n", N_RB);
+ AssertFatal(N_TA_offset == 431, "scs_common 240kHz only for FR2\n");
+ factor = fp->samples_per_subframe / 61440.0;
break;
-
- if (N_RB == 100)
- ue->N_TA_offset = 624;
- else if (N_RB == 50)
- ue->N_TA_offset = 624/2;
- else if (N_RB == 25)
- ue->N_TA_offset = 624/4;
+ default:
+ AssertFatal(1==0, "Invalid scs_common!\n");
}
- if (fp->threequarter_fs == 1)
- factor = factor*.75;
-
ue->N_TA_offset = (int)(N_TA_offset * factor);
- LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d)\n", ue->Mod_id, ue->N_TA_offset, factor, fp->ul_CarrierFreq, N_RB);
+ LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d, mu %d)\n", ue->Mod_id, ue->N_TA_offset, factor, fp->ul_CarrierFreq, fp->N_RB_DL, fp->numerology_index);
}
}
diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c
index ba4147e5cd..3a9d8a6c18 100644
--- a/openair1/PHY/INIT/nr_parms.c
+++ b/openair1/PHY/INIT/nr_parms.c
@@ -27,12 +27,9 @@
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16};
-int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
-{
+int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb) {
int mu = fp->numerology_index;
- uint8_t half_frame_index = fp->half_frame_bit;
- uint8_t i_ssb = fp->ssb_index;
int symbol = 0;
uint8_t n, n_temp;
nr_ssb_type_e type = fp->ssb_type;
@@ -69,15 +66,11 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp)
AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu);
}
- if (half_frame_index)
- symbol += (5 * fp->symbols_per_slot * fp->slots_per_subframe);
-
return symbol;
}
-void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw)
+void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL)
{
-
switch(mu) {
case NR_MU_0: //15kHz scs
@@ -99,108 +92,17 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw)
else
AssertFatal(1==0,"NR Operating Band n%d not available for SS block SCS with mu=%d\n", fp->nr_band, mu);
}
-
- switch(bw){
- case 5:
- case 15:
- case 20:
- case 25:
- case 30:
- case 40: //40 MHz
- if (fp->threequarter_fs) {
- fp->ofdm_symbol_size = 1536;
- fp->first_carrier_offset = 900; //1536 - ( (106*12) / 2 )
- fp->nb_prefix_samples0 = 132;
- fp->nb_prefix_samples = 108;
- }
- else {
- fp->ofdm_symbol_size = 2048;
- fp->first_carrier_offset = 1412; //2048 - ( (106*12) / 2 )
- fp->nb_prefix_samples0 = 176;
- fp->nb_prefix_samples = 144;
- }
- break;
-
- case 50:
- case 60:
- case 70:
-
- case 80: //80 MHz
- if (fp->threequarter_fs) {
- fp->ofdm_symbol_size = 3072;
- fp->first_carrier_offset = 1770; //3072 - ( (217*12) / 2 )
- fp->nb_prefix_samples0 = 264;
- fp->nb_prefix_samples = 216;
- }
- else {
- fp->ofdm_symbol_size = 4096;
- fp->first_carrier_offset = 2794; //4096 - ( (217*12) / 2 )
- fp->nb_prefix_samples0 = 352;
- fp->nb_prefix_samples = 288;
- }
- break;
-
- case 90:
- AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for %d MHz band and MU %d\n",bw,mu);
- fp->ofdm_symbol_size = 4096;
- fp->first_carrier_offset = 2626; //4096 - ( (245*12) / 2 )
- fp->nb_prefix_samples0 = 352;
- fp->nb_prefix_samples = 288;
- break;
- case 100:
- AssertFatal(fp->threequarter_fs==0,"3/4 sampling impossible for %d MHz band and MU %d\n",bw,mu);
- fp->ofdm_symbol_size = 4096;
- fp->first_carrier_offset = 2458; //4096 - ( (273*12) / 2 )
- fp->nb_prefix_samples0 = 352;
- fp->nb_prefix_samples = 288;
- break;
- default:
- AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp);
- }
break;
case NR_MU_2: //60kHz scs
fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2];
fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_2];
-
- switch(bw){ //FR1 bands only
- case 10:
- case 15:
- case 20:
- case 25:
- case 30:
- case 40:
- case 50:
- case 60:
- case 70:
- case 80:
- case 90:
- case 100:
- default:
- AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp);
- }
break;
case NR_MU_3:
fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_3];
fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_3];
fp->ssb_type = nr_ssb_type_D;
- switch(bw){
- case 100:
- fp->ofdm_symbol_size = 1024;
- fp->first_carrier_offset = 628; //1024 - ( (66*12) / 2 )
- fp->nb_prefix_samples0 = 136;
- fp->nb_prefix_samples = 72;
- break;
- case 50:
- fp->ofdm_symbol_size = 512;
- fp->first_carrier_offset = 320; //1024 - ( (66*12) / 2 )
- fp->nb_prefix_samples0 = 68;
- fp->nb_prefix_samples = 36;
- break;
- default:
- AssertFatal(1==0,"%d MHz band undefined for mu %d, frame parms = %p\n", bw, mu, fp);
- }
break;
case NR_MU_4:
@@ -209,9 +111,21 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, uint16_t bw)
fp->ssb_type = nr_ssb_type_E;
break;
- default:
- AssertFatal(1==0,"Invalid numerology index %d", mu);
+ default:
+ AssertFatal(1==0,"Invalid numerology index %d", mu);
}
+
+ if(fp->threequarter_fs)
+ fp->ofdm_symbol_size = 3 * 128;
+ else
+ fp->ofdm_symbol_size = 4 * 128;
+
+ while(fp->ofdm_symbol_size < N_RB_DL * 12)
+ fp->ofdm_symbol_size <<= 1;
+
+ fp->first_carrier_offset = fp->ofdm_symbol_size - (N_RB_DL * 12 / 2);
+ fp->nb_prefix_samples = fp->ofdm_symbol_size / 128 * 9;
+ fp->nb_prefix_samples0 = fp->ofdm_symbol_size / 128 * (9 + (1 << mu));
}
uint32_t get_samples_per_slot(int slot, NR_DL_FRAME_PARMS* fp)
@@ -280,13 +194,13 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
fp->half_frame_bit = 0; // half frame bit initialized to 0 here
fp->numerology_index = mu;
- set_scs_parameters(fp, mu, cfg->carrier_config.dl_bandwidth.value);
+ set_scs_parameters(fp, mu, fp->N_RB_DL);
fp->slots_per_frame = 10* fp->slots_per_subframe;
- fp->nb_antenna_ports_gNB = cfg->carrier_config.num_tx_ant.value;// It corresponds to pdsch_AntennaPorts
+ fp->nb_antenna_ports_gNB = 1; // It corresponds to the number of common antenna ports
fp->nb_antennas_rx = cfg->carrier_config.num_rx_ant.value; // It denotes the number of rx antennas at gNB
- fp->nb_antennas_tx = 1; // It corresponds to the number of UE Tx antennas
+ fp->nb_antennas_tx = cfg->carrier_config.num_tx_ant.value; // It corresponds to pdsch_AntennaPorts
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe;
@@ -334,6 +248,11 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
uint8_t Nid_cell = 0;
int Ncp = NORMAL;
+ if(fp->nb_antennas_rx == 0)
+ fp->nb_antennas_rx = 1;
+ if(fp->nb_antennas_tx == 0)
+ fp->nb_antennas_tx = 1;
+
// default values until overwritten by RRCConnectionReconfiguration
fp->nb_antenna_ports_gNB = nb_ant_ports_gNB;
fp->tdd_config = tdd_cfg;
@@ -345,6 +264,9 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
uint64_t dl_bw_khz = (12*config->carrier_config.dl_grid_size[config->ssb_config.scs_common])*(15<ssb_config.scs_common);
fp->dl_CarrierFreq = ((dl_bw_khz>>1) + config->carrier_config.dl_frequency)*1000 ;
+ LOG_D(PHY,"dl_bw_kHz %lu\n",dl_bw_khz);
+ LOG_D(PHY,"dl_CarrierFreq %lu\n",fp->dl_CarrierFreq);
+
uint64_t ul_bw_khz = (12*config->carrier_config.ul_grid_size[config->ssb_config.scs_common])*(15<ssb_config.scs_common);
fp->ul_CarrierFreq = ((ul_bw_khz>>1) + config->carrier_config.uplink_frequency)*1000 ;
@@ -352,14 +274,13 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
fp->N_RB_UL = config->carrier_config.ul_grid_size[fp->numerology_index];
fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index];
- int32_t uplink_frequency_offset = 0;
- get_delta_duplex(fp->nr_band, fp->numerology_index, &uplink_frequency_offset);
- get_frame_type(fp->nr_band, fp->numerology_index, &fp->frame_type);
+ fp->frame_type = get_frame_type(fp->nr_band, fp->numerology_index);
+ int32_t uplink_frequency_offset = get_delta_duplex(fp->nr_band, fp->numerology_index);
uplink_frequency_offset *= 1000;
LOG_I(PHY, "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, uplink_frequency_offset);
- AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type in config request file for band %d\n", fp->nr_band);
+ AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type (frame_type %d,cell_config.frame_duplex_type %d) in config request file for band %d\n", fp->frame_type,config->cell_config.frame_duplex_type,fp->nr_band);
AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + uplink_frequency_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + uplink_frequency_offset);
@@ -374,7 +295,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
fp->Ncp = Ncp;
- set_scs_parameters(fp,fp->numerology_index,config->carrier_config.dl_bandwidth);
+ set_scs_parameters(fp, fp->numerology_index, fp->N_RB_DL);
fp->slots_per_frame = 10* fp->slots_per_subframe;
fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h
index 9c474264c8..2ab610739d 100644
--- a/openair1/PHY/INIT/phy_init.h
+++ b/openair1/PHY/INIT/phy_init.h
@@ -392,14 +392,14 @@ void phy_config_update_sib13_request(PHY_Config_t *phy_config);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
-int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp);
+int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb);
int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band);
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
void init_N_TA_offset(PHY_VARS_NR_UE *ue);
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
-int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag);
+int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag);
void nr_phy_config_request(NR_PHY_Config_t *gNB);
void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst);
void phy_free_nr_gNB(PHY_VARS_gNB *gNB);
@@ -408,6 +408,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB);
void init_dfts(void);
+void fill_subframe_mask(PHY_VARS_eNB *eNB);
/** @} */
#endif
diff --git a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
index 3fd58a4989..6d382bdd63 100644
--- a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
+++ b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c
@@ -20,11 +20,11 @@
*/
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "PHY/sse_intrin.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
-// This is 512/(1:256) in __m128i format
-int16_t inv_ch[256*8] = {512,512,512,512,512,512,512,512,
+// This is 4096/(1:4096) in __m128i format
+__m128i inv_ch[4096];/* = {512,512,512,512,512,512,512,512,
256,256,256,256,256,256,256,256,
170,170,170,170,170,170,170,170,
128,128,128,128,128,128,128,128,
@@ -280,7 +280,11 @@ int16_t inv_ch[256*8] = {512,512,512,512,512,512,512,512,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,
- };
+ };*/
+
+void init_fde() {
+ for (int i=1;i<4096;i++) inv_ch[i] = _mm_set1_epi16(4096/i);
+}
void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
@@ -313,12 +317,12 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
amp=(*((int16_t*)&ul_ch_mag128[re]));
- if (amp>255)
- amp=255;
+ if (amp>4095)
+ amp=4095;
- // printf("freq_eq: symbol %d re %d => %d,%d,%d, (%d) (%d,%d) => ",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,inv_ch[8*amp],*((int16_t*)(&ul_ch_mag128[re]))*inv_ch[8*amp],*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
+ //printf("freq_eq: symbol %d re %d => mag %d,amp %d,inv %d, prod %d (%d,%d)\n",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,_mm_extract_epi16(inv_ch[amp],0),(*((int16_t*)(&ul_ch_mag128[re]))*_mm_extract_epi16(inv_ch[amp],0))>>3,*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re])));
#if defined(__x86_64__) || defined(__i386__)
- rxdataF_comp128[re] = _mm_mullo_epi16(rxdataF_comp128[re],*((__m128i *)&inv_ch[8*amp]));
+ rxdataF_comp128[re] = _mm_srai_epi16(_mm_mullo_epi16(rxdataF_comp128[re],inv_ch[amp]),3);
if (Qm==4)
ul_ch_mag128[re] = _mm_set1_epi16(324); // this is 512*2/sqrt(10)
@@ -327,7 +331,7 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
ul_ch_magb128[re] = _mm_set1_epi16(158); // this is 512*2/sqrt(42)
}
#elif defined(__arm__)
- rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],*((int16x8_t *)&inv_ch[8*amp]));
+ rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],inv_ch[amp]);
if (Qm==4)
ul_ch_mag128[re] = vdupq_n_s16(324); // this is 512*2/sqrt(10)
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
index f85162e095..aac8e71828 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c
@@ -21,7 +21,6 @@
#include "PHY/types.h"
#include "PHY/defs_eNB.h"
-#include "PHY/phy_extern.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
@@ -118,12 +117,12 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
int temp, i, aa, max_pos=0, max_val=0;
short Re,Im;
- uint8_t cyclic_shift = 0;
- int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
+ // uint8_t cyclic_shift = 0;
+ int sync_pos = 0;//(frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size);
AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size);
- AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n",
- frame_parms->nb_antennas_rx);
+ AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<=4,"frame_parms->nb_antennas_rx %d not in [1...%d]\n",
+ frame_parms->nb_antennas_rx,4);
for (i = 0; i < frame_parms->ofdm_symbol_size; i++) {
temp = 0;
@@ -142,9 +141,5 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms,
if (max_pos>frame_parms->ofdm_symbol_size/2)
max_pos = max_pos-frame_parms->ofdm_symbol_size;
- //#ifdef DEBUG_PHY
- LOG_D(PHY,"max_pos = %d, sync_pos=%d\n",max_pos,sync_pos);
- //#endif //DEBUG_PHY
-
return max_pos - sync_pos;
}
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
index 2d79158920..7eeeb998ba 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
@@ -32,6 +32,30 @@
int32_t rx_power_avg_eNB[3];
+void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB) {
+
+
+ int min_I0=1000,max_I0=0;
+ int amin=0,amax=0;
+ for (int i=0; iframe_parms.N_RB_UL; i++) {
+ if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
+
+ if (eNB->measurements.n0_subband_power_tot_dB[i]measurements.n0_subband_power_tot_dB[i]; amin=i;}
+
+ if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amax=i;}
+ }
+
+ for (int i=0; iframe_parms.N_RB_UL; i++) {
+ fprintf(fd,"%2d.",eNB->measurements.n0_subband_power_tot_dB[i]-eNB->measurements.n0_subband_power_avg_dB);
+ if (i%25 == 24) fprintf(fd,"\n");
+ }
+
+ fprintf(fd,"\nmax_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB);
+
+ fprintf(fd,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
+
+
+}
void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
int subframe,
module_id_t eNB_id,
@@ -87,46 +111,45 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
nb_rb++;
for (aarx=0; aarxnb_antennas_rx; aarx++) {
measurements->n0_subband_power[aarx][rb] = 0;
- for (int s=0;s<14-(frame_parms->Ncp<<1);s++) {
- // select the 7th symbol in an uplink subframe
- offset = offset0 + (s*frame_parms->ofdm_symbol_size);
- ul_ch = &common_vars->rxdataF[aarx][offset];
- len = 12;
+ for (int s=0;s<(14-(frame_parms->Ncp<<1));s++) {
+ offset = offset0 + (s*frame_parms->ofdm_symbol_size);
+ ul_ch = &common_vars->rxdataF[aarx][offset];
+ len = 12;
// just do first half of middle PRB for odd number of PRBs
- if (((frame_parms->N_RB_UL&1) == 1) &&
- (rb==(frame_parms->N_RB_UL>>1))) {
- len=6;
- }
+ if (((frame_parms->N_RB_UL&1) == 1) &&
+ (rb==(frame_parms->N_RB_UL>>1))) {
+ len=6;
+ }
- AssertFatal(ul_ch, "RX signal buffer (freq) problem");
+ AssertFatal(ul_ch, "RX signal buffer (freq) problem");
- measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
+ measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len);
- }
+ } // symbol
measurements->n0_subband_power[aarx][rb]/=(14-(frame_parms->Ncp<<1));
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
n0_power_tot += measurements->n0_subband_power[aarx][rb];
- }
+ } //antenna
n0_power_tot/=frame_parms->nb_antennas_rx;
n0_power_tot2 += n0_power_tot;
- measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot/frame_parms->nb_antennas_rx);
+ measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot);
measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - eNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL);
- }
- }
+ } //rb not used in subframe
+ } //rb
if (nb_rb>0) measurements->n0_subband_power_avg_dB = dB_fixed(n0_power_tot2/nb_rb);
}
void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
module_id_t eNB_id,
- module_id_t UE_id,
+ module_id_t srs_id,
unsigned char init_averaging)
{
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
PHY_MEASUREMENTS_eNB *measurements = &eNB->measurements;
- LTE_eNB_SRS *srs_vars = &eNB->srs_vars[UE_id];
+ LTE_eNB_SRS *srs_vars = &eNB->srs_vars[srs_id];
int32_t aarx,rx_power_correction;
int32_t rx_power;
@@ -136,7 +159,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
//printf("Running eNB_srs_measurements for eNB_id %d\n",eNB_id);
if (init_averaging == 1)
- rx_power_avg_eNB[UE_id] = 0;
+ rx_power_avg_eNB[srs_id] = 0;
rx_power = 0;
@@ -152,24 +175,24 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
for (aarx=0; aarxnb_antennas_rx; aarx++) {
- measurements->rx_spatial_power[UE_id][0][aarx] =
+ measurements->rx_spatial_power[srs_id][0][aarx] =
((signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][frame_parms->first_carrier_offset],
(frame_parms->N_RB_DL*6)) +
signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][1],
(frame_parms->N_RB_DL*6)))*rx_power_correction) -
measurements->n0_power[aarx];
- measurements->rx_spatial_power[UE_id][0][aarx]<<=1; // because of noise only in odd samples
+ measurements->rx_spatial_power[srs_id][0][aarx]<<=1; // because of noise only in odd samples
- measurements->rx_spatial_power_dB[UE_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[UE_id][0][aarx]);
+ measurements->rx_spatial_power_dB[srs_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[srs_id][0][aarx]);
- measurements->wideband_cqi[UE_id][aarx] = measurements->rx_spatial_power[UE_id][0][aarx];
+ measurements->wideband_cqi[srs_id][aarx] = measurements->rx_spatial_power[srs_id][0][aarx];
// measurements->rx_power[UE_id][aarx]/=frame_parms->nb_antennas_tx;
- measurements->wideband_cqi_dB[UE_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[UE_id][aarx]);
- rx_power += measurements->wideband_cqi[UE_id][aarx];
+ measurements->wideband_cqi_dB[srs_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[srs_id][aarx]);
+ rx_power += measurements->wideband_cqi[srs_id][aarx];
// measurements->rx_avg_power_dB[UE_id] += measurements->rx_power_dB[UE_id][aarx];
}
@@ -177,14 +200,14 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
// measurements->rx_avg_power_dB[UE_id]/=frame_parms->nb_antennas_rx;
if (init_averaging == 0)
- rx_power_avg_eNB[UE_id] = ((k1*rx_power_avg_eNB[UE_id]) + (k2*rx_power))>>10;
+ rx_power_avg_eNB[srs_id] = ((k1*rx_power_avg_eNB[srs_id]) + (k2*rx_power))>>10;
else
- rx_power_avg_eNB[UE_id] = rx_power;
+ rx_power_avg_eNB[srs_id] = rx_power;
- measurements->wideband_cqi_tot[UE_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot);
+ measurements->wideband_cqi_tot[srs_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot);
// times 2 since we have noise only in the odd carriers of the srs comb
- measurements->rx_rssi_dBm[UE_id] = (int32_t)dB_fixed(rx_power_avg_eNB[UE_id])-eNB->rx_total_gain_dB;
+ measurements->rx_rssi_dBm[srs_id] = (int32_t)dB_fixed(rx_power_avg_eNB[srs_id])-eNB->rx_total_gain_dB;
@@ -200,21 +223,21 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
else if (rb>12)
ul_ch = &srs_vars->srs_ch_estimates[aarx][6 + (rb-13)*12];
else {
- measurements->subband_cqi_dB[UE_id][aarx][rb] = 0;
+ measurements->subband_cqi_dB[srs_id][aarx][rb] = 0;
continue;
}
// cqi
if (aarx==0)
- measurements->subband_cqi_tot[UE_id][rb]=0;
+ measurements->subband_cqi_tot[srs_id][rb]=0;
- measurements->subband_cqi[UE_id][aarx][rb] = (signal_energy_nodc(ul_ch,12))*rx_power_correction - measurements->n0_power[aarx];
+ measurements->subband_cqi[srs_id][aarx][rb] = (signal_energy_nodc(ul_ch,12))*rx_power_correction - measurements->n0_power[aarx];
- if (measurements->subband_cqi[UE_id][aarx][rb] < 0)
- measurements->subband_cqi[UE_id][aarx][rb]=0;
+ if (measurements->subband_cqi[srs_id][aarx][rb] < 0)
+ measurements->subband_cqi[srs_id][aarx][rb]=0;
- measurements->subband_cqi_tot[UE_id][rb] += measurements->subband_cqi[UE_id][aarx][rb];
- measurements->subband_cqi_dB[UE_id][aarx][rb] = dB_fixed2(measurements->subband_cqi[UE_id][aarx][rb],
+ measurements->subband_cqi_tot[srs_id][rb] += measurements->subband_cqi[srs_id][aarx][rb];
+ measurements->subband_cqi_dB[srs_id][aarx][rb] = dB_fixed2(measurements->subband_cqi[srs_id][aarx][rb],
2*measurements->n0_power[aarx]);
// 2*n0_power since we have noise from the odd carriers in the comb of the srs
@@ -225,7 +248,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
for (rb=0; rbN_RB_DL; rb++) {
- measurements->subband_cqi_tot_dB[UE_id][rb] = dB_fixed2(measurements->subband_cqi_tot[UE_id][rb],
+ measurements->subband_cqi_tot_dB[srs_id][rb] = dB_fixed2(measurements->subband_cqi_tot[srs_id][rb],
measurements->n0_power_tot);
/*
if (measurements->subband_cqi_tot_dB[UE_id][rb] == 65)
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
index fc40280853..6ba901e29f 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
+++ b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h
@@ -288,6 +288,8 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms,
unsigned short Msc_RS,
unsigned char Qm);
+void init_fde(void);
+void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB);
/** @} */
#endif
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index 0d765a18b3..1fbc8b7ef2 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -27,276 +27,89 @@
//#include
#include
-#include "LAYER2/MAC/mac.h"
#include "PHY/defs_UE.h"
#include "PHY/phy_extern_ue.h"
-#include "PHY_INTERFACE/phy_interface.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
-#include "RRC/LTE/rrc_extern.h"
// Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs)
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
-int* sync_corr_ue0 = NULL;
-int* sync_corr_ue1 = NULL;
-int* sync_corr_ue2 = NULL;
-int sync_tmp[2048*4] __attribute__((aligned(32)));
-short syncF_tmp[2048*2] __attribute__((aligned(32)));
+static struct complex16 *primary_synch0_time __attribute__((aligned(32)));
+static struct complex16 *primary_synch1_time __attribute__((aligned(32)));
+static struct complex16 *primary_synch2_time __attribute__((aligned(32)));
+static void doIdft(int size, short *in, short *out) {
+ switch (size) {
+ case 6:
+ idft(IDFT_128,in,out,1);
+ break;
-int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *common_vars
-{
- int i,k;
+ case 25:
+ idft(IDFT_512,in,out,1);
+ break;
- sync_corr_ue0 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
- sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
- sync_corr_ue2 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
+ case 50:
+ idft(IDFT_1024,in,out,1);
+ break;
+
+ case 75:
+ idft(IDFT_1536,in,out,1);
+ break;
- if (sync_corr_ue0) {
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue0);
-#endif
- //common_vars->sync_corr = sync_corr;
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue0 not allocated\n");
- return(-1);
+ case 100:
+ idft(IDFT_2048,in,out,1);
+ break;
+
+ default:
+ LOG_E(PHY,"Unsupported N_RB_DL %d\n",size);
+ abort();
+ break;
+ }
}
- if (sync_corr_ue1) {
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue1);
-#endif
- //common_vars->sync_corr = sync_corr;
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue1 not allocated\n");
- return(-1);
+static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) {
+ int k=ofdmSize-36;
+
+ for (int i=0; i<72; i++) {
+ out[k].r = in[i].r>>1; //we need to shift input to avoid overflow in fft
+ out[k].i = in[i].i>>1;
+ k++;
+
+ if (k >= ofdmSize) {
+ k++; // skip DC carrier
+ k-=ofdmSize;
+ }
+ }
}
- if (sync_corr_ue2) {
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue2);
-#endif
- //common_vars->sync_corr = sync_corr;
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue2 not allocated\n");
- return(-1);
- }
-
- // primary_synch0_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- primary_synch0_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-
- if (primary_synch0_time) {
- // bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time allocated at %p\n", primary_synch0_time);
-#endif
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time not allocated\n");
- return(-1);
- }
-
- // primary_synch1_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- primary_synch1_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-
- if (primary_synch1_time) {
- // bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time allocated at %p\n", primary_synch1_time);
-#endif
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time not allocated\n");
- return(-1);
- }
-
- // primary_synch2_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- primary_synch2_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-
- if (primary_synch2_time) {
- // bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int));
- bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2);
-#ifdef DEBUG_PHY
- LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time allocated at %p\n", primary_synch2_time);
-#endif
- } else {
- LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time not allocated\n");
- return(-1);
- }
-
-
+int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars
+ struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {{0}};
+ int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time);
+ AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),"");
+ bzero(primary_synch0_time,sz);
+ AssertFatal( NULL != (primary_synch1_time = (struct complex16 *)malloc16(sz)),"");
+ bzero(primary_synch1_time,sz);
+ AssertFatal( NULL != (primary_synch2_time = (struct complex16 *)malloc16(sz)),"");
+ bzero(primary_synch2_time,sz);
// generate oversampled sync_time sequences
- k=frame_parms->ofdm_symbol_size-36;
-
- for (i=0; i<72; i++) {
- syncF_tmp[2*k] = primary_synch0[2*i]>>2; //we need to shift input to avoid overflow in fft
- syncF_tmp[2*k+1] = primary_synch0[2*i+1]>>2;
- k++;
-
- if (k >= frame_parms->ofdm_symbol_size) {
- k++; // skip DC carrier
- k-=frame_parms->ofdm_symbol_size;
- }
- }
-
- switch (frame_parms->N_RB_DL) {
- case 6:
- idft(IDFT_128,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 25:
- idft(IDFT_512,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 50:
- idft(IDFT_1024,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
-
- case 75:
- idft(IDFT_1536,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp,
- 1); /// complex output
- break;
- case 100:
- idft(IDFT_2048,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- default:
- LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
- break;
- }
-
- for (i=0; iofdm_symbol_size; i++)
- ((int32_t*)primary_synch0_time)[i] = sync_tmp[i];
-
- k=frame_parms->ofdm_symbol_size-36;
-
- for (i=0; i<72; i++) {
- syncF_tmp[2*k] = primary_synch1[2*i]>>2; //we need to shift input to avoid overflow in fft
- syncF_tmp[2*k+1] = primary_synch1[2*i+1]>>2;
- k++;
-
- if (k >= frame_parms->ofdm_symbol_size) {
- k++; // skip DC carrier
- k-=frame_parms->ofdm_symbol_size;
- }
- }
-
- switch (frame_parms->N_RB_DL) {
- case 6:
- idft(IDFT_128,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 25:
- idft(IDFT_512,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 50:
- idft(IDFT_1024,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
-
- case 75:
- idft(IDFT_1536,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- case 100:
- idft(IDFT_2048,(short*)syncF_tmp, /// complex input
- (short*)sync_tmp, /// complex output
- 1);
- break;
- default:
- LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
- break;
- }
-
- for (i=0; i