Commit fbc45b35 authored by rmagueta's avatar rmagueta

Merge remote-tracking branch 'origin/develop' into develop-SRS

# Conflicts:
#	nfapi/open-nFAPI/nfapi/src/nfapi_p7.c
parents 03393ddc a9c03e32
......@@ -76,7 +76,7 @@ class Module_UE:
logging.debug('Starting ' + self.Process['Name'])
mySSH = sshconnection.SSHConnection()
mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword)
mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S ' + self.Process['Cmd'] + ' ' + self.Process['Apn'][CNType] + ' &','\$',5)
mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S ' + self.Process['Cmd'] + ' ' + self.Process['Apn'][CNType] + ' > /dev/null 2>&1 &','\$',5)
mySSH.close()
#checking the process
time.sleep(5)
......@@ -165,7 +165,7 @@ class Module_UE:
#delete old artifacts
mySSH.command('echo ' + self.HostPassword + ' | sudo -S rm -rf ci_qlog','\$',5)
#start Trace, artifact is created in home dir
mySSH.command('echo $USER; nohup sudo -E QLog/QLog -s ci_qlog -f NR5G.cfg &','\$', 5)
mySSH.command('echo $USER; nohup sudo -E QLog/QLog -s ci_qlog -f NR5G.cfg > /dev/null 2>&1 &','\$', 5)
mySSH.close()
def DisableTrace(self):
......@@ -192,7 +192,7 @@ class Module_UE:
source='ci_qlog'
destination= self.LogStore + '/ci_qlog_'+now_string+'.zip'
#qlog artifact is zipped into the target folder
mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S zip -r '+destination+' '+source+' &','\$', 10)
mySSH.command('echo $USER; echo ' + self.HostPassword + ' | nohup sudo -S zip -r '+destination+' '+source+' > /dev/null 2>&1 &','\$', 10)
mySSH.close()
#post action : log cleaning to make sure enough space is reserved for the next run
Log_Mgt=cls_log_mgt.Log_Mgt(self.HostUsername,self.HostIPAddress, self.HostPassword, self.LogStore)
......
......@@ -37,6 +37,7 @@ import html
import os
import re
import time
import subprocess
import sys
import constants as CONST
import helpreadme as HELP
......@@ -115,7 +116,7 @@ class PhySim:
else:
imageTag = "develop"
# Check if image is exist on the Red Hat server, before pushing it to OC cluster
mySSH.command("sudo podman image inspect --format='Size = {{.Size}} bytes' oai-physim:" + imageTag, '\$', 60)
mySSH.command('sudo podman image inspect --format="Size = {{.Size}} bytes" oai-physim:' + imageTag, '\$', 60)
if mySSH.getBefore().count('no such image') != 0:
logging.error('\u001B[1m No such image oai-physim\u001B[0m')
mySSH.close()
......@@ -264,6 +265,23 @@ class PhySim:
for podName in podNames:
mySSH.command(f'oc logs {podName} >> cmake_targets/log/physim_test.txt 2>&1', '\$', 15, resync=True)
time.sleep(30)
mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/log/physim_test.txt', '.')
try:
listLogFiles = subprocess.check_output('egrep --colour=never "Execution Log file|Linux oai-" physim_test.txt', shell=True, universal_newlines=True)
for line in listLogFiles.split('\n'):
res1 = re.search('Linux (?P<pod>oai-[a-zA-Z0-9\-]+) ', str(line))
res2 = re.search('Execution Log file = (?P<name>[a-zA-Z0-9\-\/\.\_]+)', str(line))
if res1 is not None:
podName = res1.group('pod')
if res2 is not None:
logFileInPod = res2.group('name')
folderName = re.sub('/opt/oai-physim/cmake_targets/autotests/log/', '', logFileInPod)
folderName = re.sub('/test.*', '', folderName)
fileName = re.sub('/opt/oai-physim/cmake_targets/autotests/log/' + folderName + '/', '', logFileInPod)
mySSH.command('mkdir -p cmake_targets/log/' + folderName, '\$', 5, silent=True)
mySSH.command('oc cp ' + podName + ':' + logFileInPod + ' cmake_targets/log/' + folderName + '/' + fileName, '\$', 20, silent=True)
except Exception as e:
pass
# UnDeploy the physical simulator pods
mySSH.command('helm uninstall physim | tee -a cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 6)
......@@ -305,6 +323,7 @@ class PhySim:
mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5)
mySSH.command('mkdir -p physim_test_log_' + self.testCase_id, '\$', 5)
mySSH.command('cp log/physim_* ' + 'physim_test_log_' + self.testCase_id, '\$', 5)
mySSH.command('tar cvf physim_test_log_' + self.testCase_id + '/physim_log.tar log/015*', '\$', 180)
if not os.path.exists(f'./physim_test_logs_{self.testCase_id}'):
os.mkdir(f'./physim_test_logs_{self.testCase_id}')
mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/physim_test_log_' + self.testCase_id + '/*', './physim_test_logs_' + self.testCase_id)
......
......@@ -108,6 +108,14 @@ class EPCManagement():
logging.debug('Using the ltebox 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)
result = re.search('hss_sim s6as diam_hss', mySSH.getBefore())
if result is not None:
mySSH.command('echo ' + self.Password + ' | sudo -S killall hss_sim', '\$', 5)
mySSH.command('ps aux | grep --colour=never xGw | grep -v grep', '\$', 5, silent=True)
result = re.search('root.*xGw', mySSH.getBefore())
if result is not None:
mySSH.command('cd /opt/ltebox/tools', '\$', 5)
mySSH.command('echo ' + self.Password + ' | sudo -S ./stop_ltebox', '\$', 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_hss ./starthss"', '\$', 5)
......@@ -420,6 +428,11 @@ class EPCManagement():
mySSH.command('cd scripts', '\$', 5)
time.sleep(1)
mySSH.command('echo ' + self.Password + ' | sudo -S screen -S simulated_hss -X quit', '\$', 5)
time.sleep(5)
mySSH.command('ps aux | grep --colour=never hss_sim | grep -v grep', '\$', 5, silent=True)
result = re.search('hss_sim s6as diam_hss', mySSH.getBefore())
if result is not None:
mySSH.command('echo ' + self.Password + ' | sudo -S killall hss_sim', '\$', 5)
else:
logging.error('This should not happen!')
mySSH.close()
......@@ -446,6 +459,7 @@ class EPCManagement():
elif re.match('ltebox', self.Type, re.IGNORECASE):
mySSH.command('cd /opt/ltebox/tools', '\$', 5)
mySSH.command('echo ' + self.Password + ' | sudo -S ./stop_mme', '\$', 5)
time.sleep(5)
else:
logging.error('This should not happen!')
mySSH.close()
......
......@@ -374,7 +374,7 @@ class RANManagement():
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.command('echo $USER; nohup sudo -E tshark -i ' + eth_interface + ' -w /tmp/' + pcapfile + ' > /dev/null 2>&1 &','\$', 5)
mySSH.close()
......
......@@ -73,7 +73,7 @@
<testCase id="040000">
<class>Initialize_eNB</class>
<desc>Initialize gNB</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q</Initialize_eNB_args>
<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q --usrp-args "serial=30C51D4"</Initialize_eNB_args>
<eNB_instance>1</eNB_instance>
<eNB_serverId>1</eNB_serverId>
<air_interface>nr</air_interface>
......
......@@ -26,7 +26,7 @@ services:
FLEXRAN_INTERFACE_NAME: eth0
FLEXRAN_IPV4_ADDRESS: 192.168.18.210
THREAD_PARALLEL_CONFIG: PARALLEL_RU_L1_TRX_SPLIT
USE_ADDITIONAL_OPTIONS: '-E -q'
USE_ADDITIONAL_OPTIONS: '-E -q --usrp-args "serial=30C51D4"'
volumes:
- /dev:/dev
networks:
......
......@@ -60,6 +60,13 @@ elseif (${RF_BOARD} STREQUAL "OAI_IRIS")
LINK_DIRECTORIES("/usr/local/lib")
set(option_HW_lib "-lSoapySDR -rdynamic -ldl")
elseif (${RF_BOARD} STREQUAL "OAI_AW2SORI")
include_directories("${OPENAIR_TARGETS}/ARCH/AW2SORI")
set(HW_SOURCE ${HW_SOURCE}
${OPENAIR_TARGETS}/ARCH/AW2SORI/ARCH/AW2SORI/oaiori.c)
LINK_DIRECTORIES("/usr/local/lib")
set(openair_HW_lib "-shared -fPIC -msse4 -g -ggdb -lori")
endif (${RF_BOARD} STREQUAL "OAI_USRP")
message("RU=${RU}")
......@@ -894,6 +901,7 @@ add_library(oai_lmssdrdevif MODULE ${HWLIB_LMSSDR_SOURCE} )
target_include_directories(oai_lmssdrdevif PRIVATE /usr/local/include/lime)
target_link_libraries(oai_lmssdrdevif LimeSuite )
include_directories("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/")
set(TPLIB_ETHERNET_SOURCE
${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
......@@ -902,6 +910,15 @@ set(TPLIB_ETHERNET_SOURCE
)
add_library(oai_eth_transpro MODULE ${TPLIB_ETHERNET_SOURCE} )
include_directories("${OPENAIR_TARGETS}/ARCH/AW2SORI/")
link_directories("/usr/local/lib")
set(HWLIB_AW2SORI_SOURCE
${OPENAIR_TARGETS}/ARCH/AW2SORI/oaiori.c
)
add_library(aw2sori_transpro MODULE ${HWLIB_AW2SORI_SOURCE})
target_compile_options(aw2sori_transpro PRIVATE -shared -fPIC -msse4 -g -ggdb -DLITE_COMPILATION)
target_link_libraries(aw2sori_transpro libori.so)
include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/")
set(option_HWIRISLIB_lib "-l SoapySDR")
set(HWLIB_IRIS_SOURCE
......
......@@ -118,7 +118,7 @@ Options
-a | --agent
Enables agent for software-defined control of the eNB
-w | --hardware
EXMIMO, USRP, BLADERF, LMSSDR, IRIS, ADRV9371_ZC706, SIMU, None (Default)
EXMIMO, USRP, BLADERF, LMSSDR, IRIS, ADRV9371_ZC706, SIMU, AW2SORI, None (Default)
Adds this RF board support (in external packages installation and in compilation)
-P | --phy_simulators
Makes the unitary tests Layer 1 simulators
......@@ -293,7 +293,7 @@ function main() {
"EXMIMO")
HW="EXMIMO"
;;
"USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "ADRV9371_ZC706" | "SIMU")
"USRP" | "BLADERF" | "LMSSDR" | "IRIS" | "ADRV9371_ZC706" | "SIMU" | "AW2SORI")
HW="OAI_"$2
;;
"None")
......@@ -931,6 +931,14 @@ function main() {
echo_error "== FAILED == Unexpected Kernel $SYRIQ_KMAJ.$SYRIQ_KMIN"
fi
echo_info "liboai_device.so is linked to ADRV9371_ZC706 device library for Kernel $SYRIQ_KMAJ.$SYRIQ_KMIN"
elif [ "$HW" == "OAI_AW2SORI" ] ; then
compilations \
$build_dir aw2sori_transpro \
libaw2sori_transpro.so $dbin/libaw2sori_transpro.so.$REL
ln -sf libaw2sori_transpro.so libthirdparty_transpro.so
ln -sf $dbin/libaw2sori_transpro.so.$REL $dbin/libaw2sori_transpro.so
echo_info "build libthirdparty_transpro.so for AW2SORI fronthaul"
else
echo_info "liboai_device.so is not linked to any device library"
fi
......
/*
* 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 <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <pthread.h>
#include <syslog.h>
#include <debug.h>
#define MAX_MSG_LENGTH 2096
#define TRACE_HEADER_LENGTH 44
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
// initialize the trace function to 0
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
void nfapi_set_trace_level(nfapi_trace_level_t new_level)
{
nfapi_trace_level_g = new_level;
}
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
{
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
uint32_t num_chars;
va_list p_args;
struct timeval tv;
pthread_t tid = pthread_self();
(void)gettimeofday(&tv, NULL);
num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
if (num_chars > TRACE_HEADER_LENGTH)
{
printf("trace_dbg: Error, num_chars is too large: %d", num_chars);
return;
}
va_start(p_args, format);
if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
{
if (level <= NFAPI_TRACE_WARN)
{
printf("%s", trace_buff);
}
printf("%s", trace_buff);
}
va_end(p_args);
}
/*
* 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 <stdio.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <pthread.h>
#include <syslog.h>
#include <debug.h>
#define MAX_MSG_LENGTH 2096
#define TRACE_HEADER_LENGTH 44
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
// initialize the trace function to 0
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
void nfapi_set_trace_level(nfapi_trace_level_t new_level)
{
nfapi_trace_level_g = new_level;
}
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
{
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
uint32_t num_chars;
va_list p_args;
struct timeval tv;
pthread_t tid = pthread_self();
(void)gettimeofday(&tv, NULL);
num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
if (num_chars > TRACE_HEADER_LENGTH)
{
printf("trace_dbg: Error, num_chars is too large: %d", num_chars);
return;
}
va_start(p_args, format);
if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
{
if (level <= NFAPI_TRACE_WARN)
{
printf("%s", trace_buff);
}
printf("%s", trace_buff);
}
va_end(p_args);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -223,7 +223,7 @@ static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void *tlv, uint8_t **ppWritePa
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) &&
......@@ -236,7 +236,7 @@ static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePac
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(
......@@ -1803,7 +1803,7 @@ static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePacke
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) &&
......@@ -1816,7 +1816,7 @@ static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg,
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;
......@@ -2994,7 +2994,7 @@ static uint8_t pack_nr_slot_indication(void *msg, uint8_t **ppWritePackedMsg, ui
return 1;
}
//RX DATA INDICATION
//RX DATA INDICATION
static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
......@@ -3005,8 +3005,8 @@ static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePacke
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)
push16(value->timing_advance, ppWritePackedMsg, end) &&
push16(value->rssi, ppWritePackedMsg, end)
))
return 0;
......@@ -3024,7 +3024,7 @@ static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg,
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!pack_nr_rx_data_indication_body(pNfapiMsg->pdu_list,ppWritePackedMsg,end))
return 0;
......@@ -3045,7 +3045,7 @@ static uint8_t pack_nr_crc_indication_body(void* tlv, uint8_t **ppWritePackedMsg
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) &&
push8(value->ul_cqi, ppWritePackedMsg, end) &&
push16(value->timing_advance, ppWritePackedMsg, end) &&
push16(value->rssi, ppWritePackedMsg, end)
))
......@@ -3064,7 +3064,7 @@ static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uin
))
return 0;
for(int i=0; i<pNfapiMsg->number_crcs;i++)
for(int i=0; i<pNfapiMsg->number_crcs;i++)
{
if(!pack_nr_crc_indication_body(pNfapiMsg->crc_list,ppWritePackedMsg,end))
return 0;
......@@ -3084,7 +3084,7 @@ static uint8_t pack_nr_srs_indication_body(void* tlv, uint8_t **ppWritePackedMsg
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->num_reported_symbols, ppWritePackedMsg, end) &&
push8(value->reported_symbol_list->num_rbs, ppWritePackedMsg, end)
))
return 0;
......@@ -3107,7 +3107,7 @@ static uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uin
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!pack_nr_srs_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
return 0;
......@@ -3127,7 +3127,7 @@ static uint8_t pack_nr_rach_indication_body(void* tlv, uint8_t **ppWritePackedMs
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->avg_snr, ppWritePackedMsg, end) &&
push8(value->num_preamble, ppWritePackedMsg, end)
))
return 0;
......@@ -3152,7 +3152,7 @@ static uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, ui
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!pack_nr_rach_indication_body(&(pNfapiMsg->pdu_list[i]),ppWritePackedMsg,end))
return 0;
......@@ -3172,24 +3172,24 @@ static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint
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->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)
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)
push8(value->harq->harq_confidence_level, ppWritePackedMsg, end)
))
return 0;
for(int i=0; i<value->harq->num_harq;i++)
for(int i=0; i<value->harq->num_harq;i++)
{
if(!(push8(value->harq->harq_list[i].harq_value, ppWritePackedMsg, end)
))
......@@ -3208,14 +3208,14 @@ static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, ui
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->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)
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;
}
......@@ -3223,7 +3223,7 @@ static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, ui
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)
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;
}
......@@ -3231,7 +3231,7 @@ static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, ui
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)
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;
}
......@@ -3239,7 +3239,7 @@ static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, ui
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)
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;
}
......@@ -3255,17 +3255,17 @@ static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg
push16(value->pdu_size, ppWritePackedMsg, end)
))
return 0;
switch (value->pdu_type) {
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
break;
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
pack_nr_uci_pucch_0_1(&value->pucch_pdu_format_0_1, ppWritePackedMsg, end);
break;
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
pack_nr_uci_pucch_2_3_4(&value->pucch_pdu_format_2_3_4, ppWritePackedMsg, end);
break;
}
......@@ -3283,7 +3283,7 @@ static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uin
))
return 0;
for(int i=0; i<pNfapiMsg->num_ucis;i++)
for(int i=0; i<pNfapiMsg->num_ucis;i++)
{
if(!pack_nr_uci_indication_body(pNfapiMsg->uci_list,ppWritePackedMsg,end))
return 0;
......@@ -3333,7 +3333,7 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
// 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;
......@@ -3349,7 +3349,7 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
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;
......@@ -3651,7 +3651,7 @@ static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void *tlv, uint8_t **ppReadP
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) &&
......@@ -3662,9 +3662,9 @@ static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPa
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)
......@@ -5440,9 +5440,9 @@ static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *
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;
}
......@@ -5464,7 +5464,7 @@ static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *
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) {
......@@ -5638,14 +5638,14 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
return 1;
}
//UNPACK NR UPLINK INDICATION FUNCTIONS
//UNPACK NR UPLINK INDICATION FUNCTIONS
//SLOT INDICATION
static uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_slot_indication_scf_t *msg, nfapi_p7_codec_config_t* config)
{
{
nfapi_nr_slot_indication_scf_t *pNfapiMsg = (nfapi_nr_slot_indication_scf_t*)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end)
))
......@@ -5654,7 +5654,7 @@ static uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg, uint8_t *end
return 1;
}
//RX DATA INDICATION
//RX DATA INDICATION
static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
......@@ -5665,8 +5665,8 @@ static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPack
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)
pull16(ppReadPackedMsg, &value->timing_advance, end) &&
pull16(ppReadPackedMsg, &value->rssi, end)
))
return 0;
return 1;
......@@ -5674,16 +5674,16 @@ static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPack
static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_rx_data_indication_t *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;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!unpack_nr_rx_data_indication_body(pNfapiMsg->pdu_list, ppReadPackedMsg, end))
return 0;
......@@ -5695,14 +5695,14 @@ 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) &&
pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
pull16(ppReadPackedMsg, &value->timing_advance, end) &&
pull16(ppReadPackedMsg, &value->rssi, end)
))
......@@ -5718,14 +5718,14 @@ static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end,
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t *) msg;
// pNfapiMsg = (nfapi_nr_crc_indication_t *) malloc(sizeof(nfapi_nr_crc_indication_t));
// pNfapiMsg->crc_list = (nfapi_nr_crc_t *) malloc(sizeof(nfapi_nr_crc_t));
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot, end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
))
return 0;
for(int i=0; i<pNfapiMsg->number_crcs;i++)
for(int i=0; i<pNfapiMsg->number_crcs;i++)
{
if(!unpack_nr_crc_indication_body(pNfapiMsg->crc_list,ppReadPackedMsg,end))
//if(!unpack_nr_crc_indication_body(value,ppReadPackedMsg,end))
......@@ -5746,7 +5746,7 @@ static uint8_t unpack_nr_srs_indication_body(void* tlv, uint8_t **ppReadPackedMs
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) &&
pull8(ppReadPackedMsg, &value->num_reported_symbols, end) &&
pull16(ppReadPackedMsg, &value->reported_symbol_list->num_rbs, end)
))
return 0;
......@@ -5769,7 +5769,7 @@ static uint8_t unpack_nr_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end,
))
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
{
if(!unpack_nr_srs_indication_body(&pNfapiMsg->pdu_list,ppReadPackedMsg,end))
return 0;
......@@ -5789,7 +5789,7 @@ static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* t
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->avg_snr, end) &&
pull8(ppReadPackedMsg, &value->num_preamble, end)
))
return 0;
......@@ -5814,7 +5814,7 @@ static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end
))
return 0;
pNfapiMsg->pdu_list = (nfapi_nr_prach_indication_pdu_t*) malloc(sizeof(nfapi_nr_prach_indication_pdu_t) * pNfapiMsg->number_of_pdus);
for(int i=0; i< pNfapiMsg->number_of_pdus;i++)
for(int i=0; i< pNfapiMsg->number_of_pdus;i++)
{
if(!unpack_nr_rach_indication_body(pNfapiMsg->pdu_list,ppReadPackedMsg,end))
return 0;
......@@ -5823,7 +5823,7 @@ static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end
return 1;
}
//NR UCI
//NR UCI
static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
......@@ -5841,14 +5841,14 @@ static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* tlv,
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->timing_advance, end) &&
pull16(ppReadPackedMsg, &value->rssi, end)
))
return 0;
if (value->pduBitmap & 0x01) { //SR
value->sr = (nfapi_nr_sr_pdu_0_1_t*) malloc(sizeof(nfapi_nr_sr_pdu_0_1_t));
if(!(pull8(ppReadPackedMsg, &value->sr->sr_indication, end) &&
pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
))
return 0;
}
......@@ -5856,13 +5856,13 @@ static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* tlv,
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
value->harq = (nfapi_nr_harq_pdu_0_1_t*) malloc(sizeof(nfapi_nr_harq_pdu_0_1_t));
if(!(pull8(ppReadPackedMsg, &value->harq->num_harq, end) &&
pull8(ppReadPackedMsg, &value->harq->harq_confidence_level, end)
pull8(ppReadPackedMsg, &value->harq->harq_confidence_level, end)
))
return 0;
value->harq->harq_list = (nfapi_nr_harq_t*) malloc(sizeof(nfapi_nr_harq_t*) * value->harq->num_harq);
for(int i=0; i<value->harq->num_harq;i++)
for(int i=0; i<value->harq->num_harq;i++)
{
if(!(pull8(ppReadPackedMsg, &value->harq->harq_list->harq_value, end)
if(!(pull8(ppReadPackedMsg, &value->harq->harq_list->harq_value, end)
))
return 0;
}
......@@ -5880,13 +5880,13 @@ static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t*
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->timing_advance, end) &&
pull16(ppReadPackedMsg, &value->rssi, end)
))
return 0;
if (value->pduBitmap & 0x01) { //SR
if(!(pull16(ppReadPackedMsg, &value->sr.sr_bit_len, end)))
return 0;
return 0;
value->sr.sr_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->sr.sr_bit_len/8)));
......@@ -5897,8 +5897,8 @@ static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t*
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
if(!(pull8(ppReadPackedMsg, &value->harq.harq_crc, end)) &&
(pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end)))
return 0;
return 0;
value->harq.harq_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->harq.harq_bit_len/8 )));
if(!(pullarray8(ppReadPackedMsg, value->harq.harq_payload, (int)(value->harq.harq_bit_len / 8), (int)(value->harq.harq_bit_len / 8), end)))
......@@ -5908,7 +5908,7 @@ static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t*
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)))
return 0;
return 0;
value->csi_part1.csi_part1_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->csi_part1.csi_part1_bit_len/8)));
......@@ -5919,7 +5919,7 @@ static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t*
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)))
return 0;
return 0;
value->csi_part2.csi_part2_payload = (uint8_t*) malloc(sizeof(uint8_t) * ((value->csi_part2.csi_part2_bit_len/8 )));
......@@ -5936,7 +5936,7 @@ static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **pp
pull16(ppReadPackedMsg, &value->pdu_size, end)
))
return 0;
switch (value->pdu_type) {
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
......@@ -5952,9 +5952,9 @@ static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **pp
unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end);
break;
}
}
}
return 1;
return 1;
}
static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
......@@ -5967,7 +5967,7 @@ static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end,
))
return 0;
for(int i=0; i<pNfapiMsg->num_ucis;i++)
for(int i=0; i<pNfapiMsg->num_ucis;i++)
{
if(!unpack_nr_uci_indication_body(pNfapiMsg->uci_list,ppReadPackedMsg,end))
return 0;
......@@ -7414,12 +7414,12 @@ static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBuf
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);
......@@ -7429,17 +7429,17 @@ static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBuf
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);
......@@ -7745,7 +7745,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
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");
......@@ -7757,7 +7757,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
return -1;
}
// uint8_t *ptr = pMessageBuf;
// printf("\n Read P7 message unpack: ");
// while(ptr < end){
......@@ -7797,7 +7797,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
// 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);
......@@ -7823,7 +7823,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
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);
......@@ -7920,7 +7920,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
default:
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
{
if(config && config->unpack_p7_vendor_extension)
......@@ -7941,8 +7941,6 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
if(result == 0)
return -1;
else
else
return 0;
}
......@@ -388,7 +388,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
uint32_t Ncb,ind,k=0,Nref,N;
if (C==0) {
printf("nr_rate_matching: invalid parameters (C %d\n",C);
LOG_E(PHY,"nr_rate_matching: invalid parameters (C %d\n",C);
return -1;
}
......@@ -407,16 +407,15 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
#ifdef RM_DEBUG
printf("nr_rate_matching_ldpc: E %d, F %d, Foffset %d, k0 %d, Ncb %d, rvidx %d\n", E, F, Foffset,ind, Ncb, rvidx);
#endif
AssertFatal(Foffset <= E,
"Foffset %d > E %d "
"(Ilbrm %d, Tbslbrm %d, Z %d, BG %d, C %d)\n",
Foffset, E,
Ilbrm, Tbslbrm, Z, BG, C);
AssertFatal(Foffset <= Ncb,
"Foffset %d > Ncb %d "
"(Ilbrm %d, Tbslbrm %d, Z %d, BG %d, C %d)\n",
Foffset, Ncb,
Ilbrm, Tbslbrm, Z, BG, C);
if (Foffset > E) {
LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > E %d)\n",Foffset,E);
return -1;
}
if (Foffset > Ncb) {
LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > Ncb %d)\n",Foffset,Ncb);
return -1;
}
if (ind >= Foffset && ind < (F+Foffset)) ind = F+Foffset;
......@@ -478,7 +477,7 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
#endif
if (C==0) {
printf("nr_rate_matching: invalid parameters (C %d\n",C);
LOG_E(PHY,"nr_rate_matching: invalid parameters (C %d\n",C);
return -1;
}
......@@ -493,8 +492,14 @@ 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);
if (Foffset > E) {
LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > E %d)\n",Foffset,E);
return -1;
}
if (Foffset > Ncb) {
LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > Ncb %d)\n",Foffset,Ncb);
return -1;
}
#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);
......
......@@ -111,9 +111,9 @@ void nr_pdsch_codeword_scrambling_optim(uint8_t *in,
}
uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
int frame,
int slot) {
void nr_generate_pdsch(processingData_L1tx_t *msgTx,
int frame,
int slot) {
PHY_VARS_gNB *gNB = msgTx->gNB;
NR_gNB_DLSCH_t *dlsch;
......@@ -181,11 +181,12 @@ uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
/// CRC, coding, interleaving and rate matching
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
start_meas(dlsch_encoding_stats);
nr_dlsch_encoding(gNB,
harq->pdu, frame, slot, dlsch, frame_parms,tinput,tprep,tparity,toutput,
dlsch_rate_matching_stats,
dlsch_interleaving_stats,
dlsch_segmentation_stats);
if (nr_dlsch_encoding(gNB,
harq->pdu, frame, slot, dlsch, frame_parms,tinput,tprep,tparity,toutput,
dlsch_rate_matching_stats,
dlsch_interleaving_stats,
dlsch_segmentation_stats) == -1)
return;
stop_meas(dlsch_encoding_stats);
#ifdef DEBUG_DLSCH
printf("PDSCH encoding:\nPayload:\n");
......@@ -522,9 +523,6 @@ uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
LOG_D(PHY,"beam index for PDSCH allocation already taken\n");
}
}// dlsch loop
return 0;
}
void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
......
......@@ -67,9 +67,9 @@ void nr_fill_dlsch(processingData_L1tx_t *msgTx,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
unsigned char *sdu);
uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
int frame,
int slot);
void nr_generate_pdsch(processingData_L1tx_t *msgTx,
int frame,
int slot);
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
......
......@@ -427,17 +427,19 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl);
start_meas(dlsch_rate_matching_stats);
nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
harq->BG,
*Zc,
harq->d[r],
harq->e+r_offset,
harq->C,
F,
Kr-F-2*(*Zc),
rel15->rvIndex[0],
E);
if (nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
harq->BG,
*Zc,
harq->d[r],
harq->e+r_offset,
harq->C,
F,
Kr-F-2*(*Zc),
rel15->rvIndex[0],
E) == -1)
return -1;
stop_meas(dlsch_rate_matching_stats);
#ifdef DEBUG_DLSCH_CODING
for (int i =0; i<16; i++)
......
......@@ -274,7 +274,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
#ifdef DEBUG_ULSCH_CODING
printf("encoding thinks this is a new packet \n");
#endif
harq_process->first_tx = 0;
harq_process->first_tx = 0;
///////////////////////// a---->| add CRC |---->b /////////////////////////
///////////
/*
......@@ -445,17 +445,19 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
start_meas(&ue->ulsch_rate_matching_stats);
nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
harq_process->BG,
*pz,
harq_process->d[r],
harq_process->e+r_offset,
harq_process->C,
F,
Kr-F-2*(*pz),
harq_process->pusch_pdu.pusch_data.rv_index,
E);
if (nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
harq_process->BG,
*pz,
harq_process->d[r],
harq_process->e+r_offset,
harq_process->C,
F,
Kr-F-2*(*pz),
harq_process->pusch_pdu.pusch_data.rv_index,
E) == -1)
return -1;
stop_meas(&ue->ulsch_rate_matching_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_OUT);
......
......@@ -162,7 +162,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl);
nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G);
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1)
return;
///////////
////////////////////////////////////////////////////////////////////
......
......@@ -33,7 +33,7 @@ MESSAGE_DEF(X2AP_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgT
/* eNB application layer -> X2AP messages */
MESSAGE_DEF(X2AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, x2ap_register_enb_req_t , x2ap_register_enb_req)
MESSAGE_DEF(X2AP_SUBFRAME_PROCESS , MESSAGE_PRIORITY_MED, x2ap_subframe_process_t , x2ap_subframe_process)
MESSAGE_DEF(X2AP_RESET_REQ , MESSAGE_PRIORITY_MED, x2ap_reset_req_t , x2ap_reset_req)
/* X2AP -> eNB application layer messages */
MESSAGE_DEF(X2AP_REGISTER_ENB_CNF , MESSAGE_PRIORITY_MED, x2ap_register_enb_cnf_t , x2ap_register_enb_cnf)
MESSAGE_DEF(X2AP_DEREGISTERED_ENB_IND , MESSAGE_PRIORITY_MED, x2ap_deregistered_enb_ind_t , x2ap_deregistered_enb_ind)
......
......@@ -38,6 +38,8 @@ typedef enum {
#define X2AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_req
#define X2AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_setup_req
#define X2AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.x2ap_setup_resp
#define X2AP_RESET_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_reset_req
#define X2AP_RESET_RESP(mSGpTR) (mSGpTR)->ittiMsg.x2ap_reset_resp
#define X2AP_HANDOVER_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_req
#define X2AP_HANDOVER_REQ_ACK(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_req_ack
#define X2AP_REGISTER_ENB_CNF(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_cnf
......@@ -68,6 +70,14 @@ typedef struct x2ap_setup_resp_s {
int num_cc;
} x2ap_setup_resp_t;
typedef struct x2ap_reset_req_s {
uint32_t cause;
} x2ap_reset_req_t;
typedef struct x2ap_reset_resp_s {
int dummy;
} x2ap_reset_resp_t;
/* X2AP UE CONTEXT RELEASE */
typedef struct x2ap_ue_context_release_s {
/* used for X2AP->RRC in source and RRC->X2AP in target */
......
......@@ -2238,7 +2238,8 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in
}
// CSI
if (mac->ra.ra_state == RA_SUCCEEDED)
if (mac->ra.ra_state == RA_SUCCEEDED ||
get_softmodem_params()->phy_test == 1)
O_CSI = nr_get_csi_measurements(mac, frameP, slotP, pucch);
// ACKNACK
......
......@@ -347,7 +347,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if ((slot == 0) && (frame & 127) == 0) {
stats_output[0]='\0';
dump_mac_stats(RC.nrmac[module_idP],stats_output,16384);
dump_mac_stats(RC.nrmac[module_idP],stats_output,16384,true);
LOG_I(NR_MAC,"Frame.Slot %d.%d\n%s\n",frame,slot,stats_output);
}
......
......@@ -1456,7 +1456,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
int n_rb=0;
for (int i=0;i<6;i++)
for (int j=0;j<8;j++) {
n_rb+=((coreset->frequencyDomainResources.buf[i]>>j)&1);
n_rb+=((coreset->frequencyDomainResources.buf[i]>>j)&1);
}
n_rb*=6;
const uint16_t N_cce = n_rb * coreset->duration / NR_NB_REG_PER_CCE;
......@@ -1752,7 +1752,8 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
const int current_harq_pid = ra->harq_pid;
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid];
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
LOG_D(NR_MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid);
......@@ -1764,6 +1765,8 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
nr_clear_ra_proc(module_id, CC_id, frame, ra);
UE_info->active[UE_id] = true;
UE_info->Msg4_ACKed[UE_id] = true;
if(sched_ctrl->retrans_dl_harq.head>=0)
remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid);
}
else {
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti);
......
......@@ -702,7 +702,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
uint8_t diff_rsrp_idx = 0;
uint8_t i, j;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
if (n_dl_bwp < 4)
pdsch_bwp_id = bwp_id;
......@@ -728,9 +727,6 @@ void tci_handling(module_id_t Mod_idP, int UE_id, frame_t frame, slot_t slot) {
//if strongest measured RSRP is configured
strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP);
// including ssb rsrp in mac stats
stats->cumul_rsrp += strongest_ssb_rsrp;
stats->num_rsrp_meas++;
ssb_rsrp[idx * nb_of_csi_ssb_report] = strongest_ssb_rsrp;
LOG_D(NR_MAC,"ssb_rsrp = %d\n",strongest_ssb_rsrp);
......@@ -872,12 +868,12 @@ uint8_t pickandreverse_bits(uint8_t *payload, uint16_t bitlen, uint8_t start_bit
void evaluate_rsrp_report(NR_UE_info_t *UE_info,
NR_UE_sched_ctrl_t *sched_ctrl,
int UE_id,
uint8_t csi_report_id,
uint8_t *payload,
int *cumul_bits,
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){
NR_UE_sched_ctrl_t *sched_ctrl,
int UE_id,
uint8_t csi_report_id,
uint8_t *payload,
int *cumul_bits,
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){
uint8_t cri_ssbri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen;
uint16_t curr_payload;
......@@ -907,14 +903,17 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info,
curr_payload = pickandreverse_bits(payload, cri_ssbri_bitlen, *cumul_bits);
if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type)
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] =
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx] =
*(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]);
else
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] =
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx] =
*(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((curr_payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]);
*cumul_bits += cri_ssbri_bitlen;
LOG_D(MAC,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]);
if(UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type == NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP)
LOG_D(MAC,"CSI-RS Resource Indicator = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx]);
else
LOG_D(MAC,"SSB Resource Indicator = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[csi_ssb_idx]);
}
curr_payload = pickandreverse_bits(payload, 7, *cumul_bits);
......@@ -927,9 +926,14 @@ void evaluate_rsrp_report(NR_UE_info_t *UE_info,
*cumul_bits += 4;
}
UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++;
int strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP);
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
// including ssb rsrp in mac stats
stats->cumul_rsrp += strongest_ssb_rsrp;
stats->num_rsrp_meas++;
LOG_D(MAC,"rsrp_id = %d rsrp = %d\n",
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP,
get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP));
strongest_ssb_rsrp);
}
......@@ -1156,7 +1160,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
}
if ((uci_234->pduBitmap >> 2) & 0x01) {
//API to parse the csi report and store it into sched_ctrl
extract_pucch_csi_report (csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id);
extract_pucch_csi_report(csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id);
//TCI handling function
tci_handling(mod_id, UE_id,frame, slot);
}
......
......@@ -444,5 +444,5 @@ bool nr_find_nb_rb(uint16_t Qm,
void nr_sr_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP);
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen);
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp);
#endif /*__LAYER2_NR_MAC_PROTO_H__*/
......@@ -57,7 +57,7 @@ void *nrmac_stats_thread(void *arg) {
AssertFatal(fd!=NULL,"Cannot open nrMAC_stats.log, error %s\n",strerror(errno));
while (oai_exit == 0) {
dump_mac_stats(gNB,output,MACSTATSSTRLEN);
dump_mac_stats(gNB,output,MACSTATSSTRLEN,false);
fprintf(fd,"%s\n",output);
fflush(fd);
usleep(200000);
......@@ -71,7 +71,7 @@ void clear_mac_stats(gNB_MAC_INST *gNB) {
memset((void*)gNB->UE_info.mac_stats,0,MAX_MOBILES_PER_GNB*sizeof(NR_mac_stats_t));
}
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen)
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp)
{
NR_UE_info_t *UE_info = &gNB->UE_info;
int num = 1;
......@@ -102,9 +102,10 @@ void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen)
stats->pucch0_DTX,
sched_ctrl->dl_bler_stats.bler,
sched_ctrl->dl_bler_stats.mcs);
stats->num_rsrp_meas = 0;
stats->cumul_rsrp = 0 ;
if (reset_rsrp) {
stats->num_rsrp_meas = 0;
stats->cumul_rsrp = 0;
}
stroff+=sprintf(output+stroff,"UE %d: dlsch_total_bytes %"PRIu64"\n", UE_id, stats->dlsch_total_bytes);
stroff+=sprintf(output+stroff,"UE %d: ulsch_rounds %"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64", ulsch_DTX %d, ulsch_errors %"PRIu64"\n",
UE_id,
......
......@@ -3293,6 +3293,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.present = LTE_MTC_SSB_NR_r15__periodicityAndOffset_r15_PR_sf20_r15;
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.choice.sf20_r15 = 0;
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.ssb_Duration_r15 = LTE_MTC_SSB_NR_r15__ssb_Duration_r15_sf4;
if (rrc_inst->nr_scg_ssb_freq > 2016666) //FR2
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.subcarrierSpacingSSB_r15 = LTE_RS_ConfigSSB_NR_r15__subcarrierSpacingSSB_r15_kHz120;
else
......
......@@ -57,6 +57,17 @@ int x2ap_eNB_handle_x2_setup_response (instance_t instance,
uint32_t stream,
X2AP_X2AP_PDU_t *pdu);
static
int x2ap_eNB_handle_x2_reset_request (instance_t instance,
uint32_t assoc_id,
uint32_t stream,
X2AP_X2AP_PDU_t *pdu);
static
int x2ap_eNB_handle_x2_reset_response (instance_t instance,
uint32_t assoc_id,
uint32_t stream,
X2AP_X2AP_PDU_t *pdu);
static
int x2ap_eNB_handle_x2_setup_failure (instance_t instance,
uint32_t assoc_id,
uint32_t stream,
......@@ -166,7 +177,7 @@ x2ap_message_decoded_callback x2ap_messages_callback[][3] = {
{ 0, 0, 0 }, /* snStatusTransfer */
{ x2ap_eNB_handle_ue_context_release, 0, 0 }, /* uEContextRelease */
{ x2ap_eNB_handle_x2_setup_request, x2ap_eNB_handle_x2_setup_response, x2ap_eNB_handle_x2_setup_failure }, /* x2Setup */
{ 0, 0, 0 }, /* reset */
{ x2ap_eNB_handle_x2_reset_request, x2ap_eNB_handle_x2_reset_response, 0 }, /* reset */
{ 0, 0, 0 }, /* eNBConfigurationUpdate */
{ 0, 0, 0 }, /* resourceStatusReportingInitiation */
{ 0, 0, 0 }, /* resourceStatusReporting */
......@@ -501,6 +512,163 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data);
}
const char *X2AP_cause_str1[4]={"radioNetwork","transport","protocol","misc"};
const char *X2AP_case_str_radio[50]={" X2AP_CauseRadioNetwork_handover_desirable_for_radio_reasons",
"X2AP_CauseRadioNetwork_time_critical_handover",
"X2AP_CauseRadioNetwork_resource_optimisation_handover",
"X2AP_CauseRadioNetwork_reduce_load_in_serving_cell",
"X2AP_CauseRadioNetwork_partial_handover",
"X2AP_CauseRadioNetwork_unknown_new_eNB_UE_X2AP_ID",
"X2AP_CauseRadioNetwork_unknown_old_eNB_UE_X2AP_ID",
"X2AP_CauseRadioNetwork_unknown_pair_of_UE_X2AP_ID",
"X2AP_CauseRadioNetwork_ho_target_not_allowed",
"X2AP_CauseRadioNetwork_tx2relocoverall_expiry",
"X2AP_CauseRadioNetwork_trelocprep_expiry",
"X2AP_CauseRadioNetwork_cell_not_available",
"X2AP_CauseRadioNetwork_no_radio_resources_available_in_target_cell",
"X2AP_CauseRadioNetwork_invalid_MME_GroupID",
"X2AP_CauseRadioNetwork_unknown_MME_Code",
"X2AP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported",
"X2AP_CauseRadioNetwork_reportCharacteristicsEmpty",
"X2AP_CauseRadioNetwork_noReportPeriodicity",
"X2AP_CauseRadioNetwork_existingMeasurementID",
"X2AP_CauseRadioNetwork_unknown_eNB_Measurement_ID",
"X2AP_CauseRadioNetwork_measurement_temporarily_not_available",
"X2AP_CauseRadioNetwork_unspecified",
"X2AP_CauseRadioNetwork_load_balancing",
"X2AP_CauseRadioNetwork_handover_optimisation",
"X2AP_CauseRadioNetwork_value_out_of_allowed_range",
"X2AP_CauseRadioNetwork_multiple_E_RAB_ID_instances",
"X2AP_CauseRadioNetwork_switch_off_ongoing",
"X2AP_CauseRadioNetwork_not_supported_QCI_value",
"X2AP_CauseRadioNetwork_measurement_not_supported_for_the_object",
"X2AP_CauseRadioNetwork_tDCoverall_expiry",
"X2AP_CauseRadioNetwork_tDCprep_expiry",
"X2AP_CauseRadioNetwork_action_desirable_for_radio_reasons",
"X2AP_CauseRadioNetwork_reduce_load",
"X2AP_CauseRadioNetwork_resource_optimisation",
"X2AP_CauseRadioNetwork_time_critical_action",
"X2AP_CauseRadioNetwork_target_not_allowed",
"X2AP_CauseRadioNetwork_no_radio_resources_available",
"X2AP_CauseRadioNetwork_invalid_QoS_combination",
"X2AP_CauseRadioNetwork_encryption_algorithms_not_supported",
"X2AP_CauseRadioNetwork_procedure_cancelled",
"X2AP_CauseRadioNetwork_rRM_purpose",
"X2AP_CauseRadioNetwork_improve_user_bit_rate",
"X2AP_CauseRadioNetwork_user_inactivity",
"X2AP_CauseRadioNetwork_radio_connection_with_UE_lost",
"X2AP_CauseRadioNetwork_bearer_option_not_supported",
"X2AP_CauseRadioNetwork_mCG_Mobility",
"X2AP_CauseRadioNetwork_sCG_Mobility",
"X2AP_CauseRadioNetwork_count_reaches_max_value",
"X2AP_CauseRadioNetwork_unknown_old_en_gNB_UE_X2AP_ID",
"X2AP_CauseRadioNetwork_pDCP_Overload"};
const char *X2AP_cause_str_radio[2]={"X2AP_CauseTransport_transport_resource_unavailable",
"X2AP_CauseTransport_unspecified"};
const char *X2AP_cause_str_protocol[7]={" X2AP_CauseProtocol_transfer_syntax_error",
"X2AP_CauseProtocol_abstract_syntax_error_reject",
"X2AP_CauseProtocol_abstract_syntax_error_ignore_and_notify",
"X2AP_CauseProtocol_message_not_compatible_with_receiver_state",
"X2AP_CauseProtocol_semantic_error",
"X2AP_CauseProtocol_unspecified",
"X2AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message"};
const char *X2AP_cause_str_misc[5]={"X2AP_CauseMisc_control_processing_overload",
"X2AP_CauseMisc_hardware_failure",
"X2AP_CauseMisc_om_intervention",
"X2AP_CauseMisc_not_enough_user_plane_processing_resources",
"X2AP_CauseMisc_unspecified"};
int
x2ap_eNB_handle_x2_reset_response(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
X2AP_X2AP_PDU_t *pdu)
{
return (0);
}
int
x2ap_eNB_handle_x2_reset_request(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
X2AP_X2AP_PDU_t *pdu)
{
X2AP_ResetRequest_t *ResetRequest;
X2AP_ResetRequest_IEs_t *ie;
x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *x2ap_eNB_data;
MessageDef *msg;
uint32_t eNB_id = 0;
DevAssert (pdu != NULL);
ResetRequest = &pdu->choice.initiatingMessage.value.choice.ResetRequest;
X2AP_DEBUG("Received a new X2 reset request\n");
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_ResetRequest_IEs_t, ie, ResetRequest,
X2AP_ProtocolIE_ID_id_Cause, true);
if (ie == NULL ) {
X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
return -1;
} else {
AssertFatal(ie->value.present <= X2AP_Cause_PR_misc && ie->value.present > 0,"Cause value %d, is impossible\n",ie->value.present);
LOG_I(X2AP,"Received X2AP Reset Request with Cause Type %s\n",X2AP_cause_str1[ie->value.present-1]);
}
X2AP_DEBUG("Adding eNB to the list of associated eNBs\n");
if ((x2ap_eNB_data = x2ap_is_eNB_id_in_list (eNB_id)) == NULL) {
/*
* eNB has not been found in list of associated eNB,
* * * * Add it to the tail of list and initialize data
*/
if ((x2ap_eNB_data = x2ap_is_eNB_assoc_id_in_list (assoc_id)) == NULL) {
/*
* ??
*/
return -1;
} else {
x2ap_eNB_data->state = X2AP_ENB_STATE_RESETTING;
x2ap_eNB_data->eNB_id = eNB_id;
}
} else {
x2ap_eNB_data->state = X2AP_ENB_STATE_RESETTING;
/*
* eNB has been found in list, consider the x2 setup request as a reset connection,
* * * * reseting any previous UE state if sctp association is != than the previous one
*/
if (x2ap_eNB_data->assoc_id != assoc_id) {
/*
* ??: Send an overload cause...
*/
X2AP_ERROR("Reset Request: eNB id %d is already associated to an active sctp association" "Previous known: %d, new one: %d\n", eNB_id, x2ap_eNB_data->assoc_id, assoc_id);
return -1;
}
/*
* TODO: call the reset procedure
*/
}
msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_RESET_REQ);
X2AP_RESET_REQ(msg).cause = ie->value.present;
instance_p = x2ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data);
}
static
int x2ap_eNB_handle_x2_setup_response(instance_t instance,
......
/*! \file oaiori.c
* \brief AW2S ORI API isolator
* \author Raymond Knopp
* \date 2019
* \version 0.1
* \company Eurecom
* \maintainer: raymond.knopp@eurecom.fr
* \note
* \warning
*/
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/ether.h>
#include <unistd.h>
#include <errno.h>
#include <linux/sysctl.h>
#include <sys/sysctl.h>
#include "common_lib.h"
#include "ethernet_lib.h"
#include "ori.h"
#include "targets/ARCH/COMMON/common_lib.h"
typedef struct eutra_bandentry_s {
int16_t band;
uint32_t ul_min;
uint32_t ul_max;
uint32_t dl_min;
uint32_t dl_max;
uint32_t N_OFFs_DL;
} eutra_bandentry_t;
typedef struct band_info_s {
int nbands;
eutra_bandentry_t band_info[100];
} band_info_t;
static const eutra_bandentry_t eutra_bandtable[] = {
{1, 19200, 19800, 21100, 21700, 0 },
{2, 18500, 19100, 19300, 19900, 6000 },
{3, 17100, 17850, 18050, 18800, 12000 },
{4, 17100, 17550, 21100, 21550, 19500 },
{5, 8240, 8490, 8690, 8940, 24000 },
{6, 8300, 8400, 8750, 8850, 26500 },
{7, 25000, 25700, 26200, 26900, 27500 },
{8, 8800, 9150, 9250, 9600, 34500 },
{9, 17499, 17849, 18449, 18799, 38000 },
{10, 17100, 17700, 21100, 21700, 41500 },
{11, 14279, 14529, 14759, 15009, 47500 },
{12, 6980, 7160, 7280, 7460, 50100 },
{13, 7770, 7870, 7460, 7560, 51800 },
{14, 7880, 7980, 7580, 7680, 52800 },
{17, 7040, 7160, 7340, 7460, 57300 },
{18, 8150, 9650, 8600, 10100, 58500 },
{19, 8300, 8450, 8750, 8900, 60000 },
{20, 8320, 8620, 7910, 8210, 61500 },
{21, 14479, 14629, 14959, 15109, 64500 },
{22, 34100, 34900, 35100, 35900, 66000 },
{23, 20000, 20200, 21800, 22000, 75000 },
{24, 16126, 16605, 15250, 15590, 77000 },
{25, 18500, 19150, 19300, 19950, 80400 },
{26, 8140, 8490, 8590, 8940, 86900 },
{27, 8070, 8240, 8520, 8690, 90400 },
{28, 7030, 7580, 7580, 8130, 92100 },
{29, 0, 0, 7170, 7280, 96600 },
{30, 23050, 23250, 23500, 23600, 97700 },
{31, 45250, 34900, 46250, 35900, 98700 },
{32, 0, 0, 14520, 14960, 99200 },
{33, 19000, 19200, 19000, 19200, 360000},
{34, 20100, 20250, 20100, 20250, 362000},
{35, 18500, 19100, 18500, 19100, 363500},
{36, 19300, 19900, 19300, 19900, 369500},
{37, 19100, 19300, 19100, 19300, 375500},
{38, 25700, 26200, 25700, 26200, 377500},
{39, 18800, 19200, 18800, 19200, 382500},
{40, 23000, 24000, 23000, 24000, 386500},
{41, 24960, 26900, 24960, 26900, 396500},
{42, 34000, 36000, 34000, 36000, 415900},
{43, 36000, 38000, 36000, 38000, 435900},
{44, 7030, 8030, 7030, 8030, 455900},
{45, 14470, 14670, 14470, 14670, 465900},
{46, 51500, 59250, 51500, 59250, 467900},
{65, 19200, 20100, 21100, 22000, 655360},
{66, 17100, 18000, 21100, 22000, 664360},
{67, 0, 0, 7380, 7580, 67336 },
{68, 6980, 7280, 7530, 7830, 67536 }
};
#define BANDTABLE_SIZE (sizeof(eutra_bandtable)/sizeof(eutra_bandentry_t))
uint32_t to_earfcn_DL_aw2s(int eutra_bandP, long long int dl_CarrierFreq, uint32_t bw) {
uint32_t dl_CarrierFreq_by_100k = dl_CarrierFreq / 100000;
int i;
if (eutra_bandP > 68) { printf("eutra_band %d > 68\n", eutra_bandP); exit(-1);}
for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++);
printf("AW2S: band %d, index %d\n",eutra_bandP, i);
if (i >= BANDTABLE_SIZE) { printf(" i = %d , it will trigger out-of-bounds read.\n",i); exit(-1);}
if (dl_CarrierFreq_by_100k < eutra_bandtable[i].dl_min) {
printf("Band %d, bw %u : DL carrier frequency %u .1 MHz < %u\n",
eutra_bandP, bw, dl_CarrierFreq_by_100k,
eutra_bandtable[i].dl_min); exit(-1);}
if(dl_CarrierFreq_by_100k >
(eutra_bandtable[i].dl_max - bw)) {
printf("Band %d, bw %u : DL carrier frequency %u .1MHz > %d\n",
eutra_bandP, bw, dl_CarrierFreq_by_100k,
eutra_bandtable[i].dl_max - bw); exit(-1); }
printf("AW2S: dl_CarrierFreq_by_100k %d, dl_min %d\n",dl_CarrierFreq_by_100k,eutra_bandtable[i].dl_min);
return (dl_CarrierFreq_by_100k - eutra_bandtable[i].dl_min +
(eutra_bandtable[i].N_OFFs_DL / 10));
}
uint32_t to_earfcn_UL_aw2s(int eutra_bandP, long long int ul_CarrierFreq, uint32_t bw) {
uint32_t ul_CarrierFreq_by_100k = ul_CarrierFreq / 100000;
int i;
if(eutra_bandP >= 69) {
printf("eutra_band %d > 68\n", eutra_bandP);
exit(-1);
}
for (i = 0; i < BANDTABLE_SIZE && eutra_bandtable[i].band != eutra_bandP; i++);
if(i >= BANDTABLE_SIZE) {printf("i = %d , it will trigger out-of-bounds read.\n",i); exit(-1);}
if(ul_CarrierFreq_by_100k < eutra_bandtable[i].ul_min) {
printf("Band %d, bw %u : UL carrier frequency %u Hz < %u\n",
eutra_bandP, bw, ul_CarrierFreq_by_100k,
eutra_bandtable[i].ul_min);
exit(-1);
}
if(ul_CarrierFreq_by_100k > (eutra_bandtable[i].ul_max - bw)) {
printf("Band %d, bw %u : UL carrier frequency %u Hz > %d\n",
eutra_bandP, bw, ul_CarrierFreq_by_100k,
eutra_bandtable[i].ul_max - bw);
exit(-1);
}
return (ul_CarrierFreq_by_100k - eutra_bandtable[i].ul_min +
((eutra_bandtable[i].N_OFFs_DL + 180000) / 10));
}
int get_mac_addr(const char *iface,unsigned char *mac)
{
int fd;
struct ifreq ifr;
int ret=0;
memset(&ifr, 0, sizeof(ifr));
fd = socket(AF_INET, SOCK_DGRAM, 0);
ifr.ifr_addr.sa_family = AF_INET;
strncpy(ifr.ifr_name , iface , IFNAMSIZ-1);
if (0 == ioctl(fd, SIOCGIFHWADDR, &ifr)) memcpy((void*)mac,(void *)ifr.ifr_hwaddr.sa_data,6);
else {
printf("No MAC address!\n");
ret = -1;
}
printf("%s : %2x:%2x:%2x:%2x:%2x:%2x\n",iface,mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
close(fd);
return(ret);
}
void cb(void * userData, ORI_IndicationType_e type, ORI_IndicationValue_u value)
{
printf("============> Got indication %s\n", ORI_IndicationType_Print(type));
if(type == ORI_IndicationType_ObjectStateChange)
{
ORI_Object_s * obj = value.objectStateChange.object;
printf("State change for %s:%d -> %s : %s\n", ORI_ObjectType_Print(obj->typeRef.type), obj->instanceNumber,
ORI_StateType_Print(value.objectStateChange.stateType),
value.objectStateChange.stateType == ORI_StateType_AST ? ORI_AST_Print(obj->ast) : ORI_FST_Print(obj->fst));
}
else if(type == ORI_IndicationType_FaultChange)
{
ORI_Object_s * obj = value.faultChange.object;
ORI_Fault_s * fault = value.faultChange.fault;
printf("Fault change for %s:%d -> %s : %s\n", ORI_ObjectType_Print(obj->typeRef.type), obj->instanceNumber,
ORI_FaultType_Print(value.faultChange.faultType),
ORI_FaultState_Print(fault->state));
if(fault->state == ORI_FaultState_Active)
{
printf("\t Fault severity: %s\n", ORI_FaultSeverity_Print(fault->severity));
printf("\t Timestamp: %s\n", fault->timestamp);
printf("\t Description: %s\n", fault->desc);
}
}
printf("<============\n");
}
int aw2s_oricleanup(openair0_device *device) {
ORI_s * ori = (ORI_s*)device->thirdparty_priv;
ORI_Disconnect(ori);
ORI_Free(ori);
return(0);
}
int aw2s_startstreaming(openair0_device *device) {
ORI_s * ori = (ORI_s*)device->thirdparty_priv;
ORI_Result_e result;
ORI_Result_e RE_result;
openair0_config_t *openair0_cfg = device->openair0_cfg;
ORI_Object_s *tx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ? ORI_ObjectType_TxEUtraFDD :ORI_ObjectType_TxEUtraTDD, 0, NULL);
ORI_Object_s *tx1= (openair0_cfg->tx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_TxEUtraFDD : ORI_ObjectType_TxEUtraTDD, 1, NULL) : NULL;
ORI_Object_s *rx0= ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 0, NULL);
ORI_Object_s *rx1= (openair0_cfg->rx_num_channels > 1) ? ORI_FindObject(ori, openair0_cfg->duplex_mode == duplex_mode_FDD ?ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD, 1, NULL) : NULL;
ORI_Object_s *link= ORI_FindObject(ori, ORI_ObjectType_ORILink, 0, NULL);
if (tx0 == NULL || (tx1 == NULL && openair0_cfg->tx_num_channels > 1) || rx0 == NULL || (rx1 == NULL && openair0_cfg->rx_num_channels > 1) || link == NULL) return (-1);
/*******************************************************************
* UNLOCK Link
*******************************************************************/
result = ORI_ObjectStateModification(ori, link, ORI_AST_Unlocked, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
/*******************************************************************
* UNLOCK TX0
*******************************************************************/
/* Put Tx0 into service */
result = ORI_ObjectStateModification(ori, tx0, ORI_AST_Unlocked, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result));
/*******************************************************************
* UNLOCK TX1
*******************************************************************/
if (tx1) {
printf("\n\n\n========================================================\n");
/* Put Tx1 into service */
result = ORI_ObjectStateModification(ori, tx1, ORI_AST_Unlocked, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result));
}
/*******************************************************************
* UNLOCK RX0
*******************************************************************/
printf("\n\n\n========================================================\n");
/* Put Rx0 into service */
result = ORI_ObjectStateModification(ori, rx0, ORI_AST_Unlocked, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result));
/*******************************************************************
* UNLOCK RX1
*******************************************************************/
if (rx1) {
printf("\n\n\n========================================================\n");
/* Put Rx1 into service */
result = ORI_ObjectStateModification(ori, rx1, ORI_AST_Unlocked, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result));
}
while (rx0->fst != ORI_FST_Operational ||
(openair0_cfg->rx_num_channels > 1 && rx1->fst != ORI_FST_Operational) ||
tx0->fst != ORI_FST_Operational ||
(openair0_cfg->tx_num_channels > 1 && tx1->fst != ORI_FST_Operational))
{}
// test RX interface
uint64_t TS;
char temp_rx[1024] __attribute__((aligned(32)));
int aid,r0=0,r1=(openair0_cfg->rx_num_channels > 1) ? 0 : 1;
int i;
int Npackets=1024000;
for (i=0;i<Npackets;i++) {
device->trx_read_func2(device,
(openair0_timestamp*)&TS,
(void*)temp_rx,
256,
&aid);
if (aid == 0) r0=1;
if (aid == 1) r1=1;
}
if (r0==1 && r1==1) printf("Streaming started, returning to OAI\n");
else {
printf("Didn't get anything from one antenna port after %d packets %d,%d\n",Npackets,r0,r1);
return(-1);
}
return(0);
}
int aw2s_oriinit(openair0_device *device) {
ORI_s * ori;
ORI_Result_e result;
ORI_Result_e RE_result;
ORI_Object_s * objects[100];
uint32_t numObjects;
uint32_t i;
eth_params_t *eth_params = device->eth_params;
openair0_config_t *openair0_cfg = device->openair0_cfg;
/*******************************************************************
* CREATION AND CONNECTION
*******************************************************************/
printf("Initializing the ORI control interface\n");
/* Create context */
ori = ORI_Create();
if(!ori)
{
printf("Failed to create ORI context\n");
return -1;
}
device->thirdparty_priv = (void *)ori;
ori->userData = (void *)ori;
ori->indicationCallback = cb;
/* Connect... */
printf("Trying to connect to AW2S device on %s : %d\n",eth_params->remote_addr, eth_params->remote_portc);
result = ORI_Connect(ori, eth_params->remote_addr, eth_params->remote_portc, 3000, 0);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_Connect failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
/* First health check */
result = ORI_HealthCheck(ori, 6000, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_HealthCheck failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_HealthCheck: %s\n", ORI_Result_Print(RE_result));
/* Set RE time */
result = ORI_SetTime(ori, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_SetTime failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_SetTime: %s\n", ORI_Result_Print(RE_result));
/*******************************************************************
* SOFTWARE PARAMETERS ALIGNMENT
*******************************************************************/
/* Report all current objects parameters */
result = ORI_ObjectParamReport(ori, NULL, 0, ORI_ObjectParam_All, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectParamReport failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectParamReport: %s\n", ORI_Result_Print(RE_result));
/*******************************************************************
* TX PATHS CREATION
*******************************************************************/
/* Prepare parameters */
ORI_ObjectTypeRef_s txTypeRef = { NULL, openair0_cfg->duplex_mode == duplex_mode_FDD ? ORI_ObjectType_TxEUtraFDD : ORI_ObjectType_TxEUtraTDD};
ORI_ObjectParams_u txParams;
ORI_ObjectParam_e txParamList[9];
ORI_Result_e txParamResult[9];
int num_txparams;
if (openair0_cfg->duplex_mode == duplex_mode_FDD) {
txParamList[0] = ORI_ObjectParam_SigPath_antPort;
txParamList[1] = ORI_ObjectParam_SigPath_axcW;
txParamList[2] = ORI_ObjectParam_SigPath_axcB;
txParamList[3] = ORI_ObjectParam_SigPath_chanBW;
txParamList[4] = ORI_ObjectParam_SigPath_earfcn;
txParamList[5] = ORI_ObjectParam_TxSigPath_maxTxPwr;
num_txparams = 6;
}
else {
txParamList[0] = ORI_ObjectParam_SigPath_antPort;
txParamList[1] = ORI_ObjectParam_SigPath_axcW;
txParamList[2] = ORI_ObjectParam_SigPath_axcB;
txParamList[3] = ORI_ObjectParam_SigPath_chanBW;
txParamList[4] = ORI_ObjectParam_SigPath_earfcn;
txParamList[5] = ORI_ObjectParam_TxSigPath_maxTxPwr;
txParamList[6] = ORI_ObjectParam_SigPath_tddULDLConfig;
txParamList[7] = ORI_ObjectParam_SigPath_tddSpecialSFConfig;
txParamList[8] = ORI_ObjectParam_TxSigPath_tddCPLengthDL;
num_txparams = 9;
}
/* Create tx0 */
ORI_Object_s * tx0;
printf("AW2S: duplex_mode %d, tx_bw %f, rx_bw %f\n",openair0_cfg->duplex_mode,openair0_cfg->tx_bw,openair0_cfg->rx_bw);
if (openair0_cfg->duplex_mode == duplex_mode_FDD) {
txParams.TxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL);
txParams.TxEUtraFDD.axcW = 1;
txParams.TxEUtraFDD.axcB = 0;
txParams.TxEUtraFDD.chanBW = openair0_cfg->tx_bw/100e3;
txParams.TxEUtraFDD.earfcn = 3350;
txParams.TxEUtraFDD.maxTxPwr = -100;
}
else if (openair0_cfg->duplex_mode == duplex_mode_TDD) {
txParams.TxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL);
txParams.TxEUtraTDD.axcW = 1;
txParams.TxEUtraTDD.axcB = 0;
txParams.TxEUtraTDD.chanBW = openair0_cfg->tx_bw/100e3;
txParams.TxEUtraTDD.earfcn = to_earfcn_DL_aw2s(38,(long long int)openair0_cfg->tx_freq[0],txParams.TxEUtraTDD.chanBW);
txParams.TxEUtraTDD.maxTxPwr = 430-((int)openair0_cfg->tx_gain[0]*10);
txParams.TxEUtraTDD.tddULDLConfig = 1;
txParams.TxEUtraTDD.tddSpecialSFConfig = 0;
txParams.TxEUtraTDD.tddCPLengthDL = ORI_tddCPLength_Normal;
printf("AW2S: Configuring for TDD, EARFCN %u, Power %d, BW %d\n",
txParams.TxEUtraTDD.earfcn,txParams.TxEUtraTDD.maxTxPwr,txParams.TxEUtraTDD.chanBW);
}
else {
aw2s_oricleanup(device);
return -1;
}
result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx0, &RE_result);
if(RE_result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectCreation (txParams0.TxEUtraFDD/TDD) failed with error: %s (%s,%s,%s,%s,%s,%s,%s,%s,%s\n", ORI_Result_Print(result),
ORI_Result_Print(txParamResult[0]),
ORI_Result_Print(txParamResult[1]),
ORI_Result_Print(txParamResult[2]),
ORI_Result_Print(txParamResult[3]),
ORI_Result_Print(txParamResult[4]),
ORI_Result_Print(txParamResult[5]),
ORI_Result_Print(txParamResult[6]),
ORI_Result_Print(txParamResult[7]),
ORI_Result_Print(txParamResult[8]));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectCreation (txParams0.TxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result));
/* Create tx1 */
if (openair0_cfg->tx_num_channels > 1) {
ORI_Object_s * tx1;
if (openair0_cfg->duplex_mode ==duplex_mode_FDD) txParams.TxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL);
else txParams.TxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL);
result = ORI_ObjectCreation(ori, txTypeRef, txParams, txParamList, num_txparams, txParamResult, &tx1, &RE_result);
if(RE_result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectCreation (txParams1.TxEUtraFDD/TDD) failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectCreation (txParams1.TxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result));
}
/*******************************************************************
* RX PATHS CREATION
*******************************************************************/
/* Prepare parameters */
ORI_ObjectTypeRef_s rxTypeRef = { NULL, openair0_cfg->duplex_mode == duplex_mode_FDD ? ORI_ObjectType_RxEUtraFDD : ORI_ObjectType_RxEUtraTDD};
ORI_ObjectParams_u rxParams,rxParams1;
ORI_ObjectParam_e rxParamList[8] = { ORI_ObjectParam_SigPath_antPort, ORI_ObjectParam_SigPath_axcW, ORI_ObjectParam_SigPath_axcB,
ORI_ObjectParam_SigPath_chanBW, ORI_ObjectParam_SigPath_earfcn };
ORI_Result_e rxParamResult[8];
int num_rxparams = 5;
if (openair0_cfg->duplex_mode == duplex_mode_TDD) {
rxParamList[5] = ORI_ObjectParam_SigPath_tddULDLConfig;
rxParamList[6] = ORI_ObjectParam_SigPath_tddSpecialSFConfig;
rxParamList[7] = ORI_ObjectParam_RxSigPath_tddCPLengthUL;
num_rxparams = 8;
}
/* Create rx0 */
ORI_Object_s * rx0;
if (openair0_cfg->duplex_mode == duplex_mode_FDD) {
rxParams.RxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL);
rxParams.RxEUtraFDD.axcW = 1;
rxParams.RxEUtraFDD.axcB = 0;
rxParams.RxEUtraFDD.chanBW = 200;
rxParams.RxEUtraFDD.earfcn = 21350;
result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx0, &RE_result);
}
else {
rxParams.RxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 0, NULL);
rxParams.RxEUtraTDD.axcW = 1;
rxParams.RxEUtraTDD.axcB = 0;
rxParams.RxEUtraTDD.chanBW = txParams.TxEUtraTDD.chanBW;
rxParams.RxEUtraTDD.earfcn = txParams.TxEUtraTDD.earfcn;
rxParams.RxEUtraTDD.tddULDLConfig = 1;
rxParams.RxEUtraTDD.tddSpecialSFConfig = 1;
rxParams.RxEUtraTDD.tddCPLengthUL = ORI_tddCPLength_Normal;
printf("AW2S: Creating RX0 for EARFCN %d\n",rxParams.RxEUtraTDD.earfcn);
result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx0, &RE_result);
}
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectCreation (rxParams0.RxEUtraFDD/TDD) failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectCreation (rxParams0.RxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result));
if (openair0_cfg->rx_num_channels > 1) {
/* Create rx1 */
ORI_Object_s * rx1;
memcpy((void*)&rxParams1,(void*)&rxParams,sizeof(rxParams));
if (openair0_cfg->duplex_mode == duplex_mode_FDD) rxParams1.RxEUtraFDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL);
else rxParams1.RxEUtraTDD.antPort = ORI_FindObject(ori, ORI_ObjectType_AntennaPort, 1, NULL);
result = ORI_ObjectCreation(ori, rxTypeRef, rxParams1, rxParamList, num_rxparams, rxParamResult, &rx1, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectCreation (rxParams1.RxEUtraFDD/TDD) failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectCreation (rxParams1.RxEUtraFDD/TDD): %s\n", ORI_Result_Print(RE_result));
}
/* Create link */
ORI_ObjectParams_u linkParams;
ORI_ObjectParam_e linkParamList[3] = {ORI_ObjectParam_ORILink_AWS_remoteMAC, ORI_ObjectParam_ORILink_AWS_remoteIP,ORI_ObjectParam_ORILink_AWS_remoteUdpPort};
ORI_Result_e linkParamResult[3];
ORI_Object_s *link= ORI_FindObject(ori, ORI_ObjectType_ORILink, 0, NULL);
linkParams.ORILink.AWS_remoteUdpPort = eth_params->my_portd;
if (get_mac_addr(eth_params->local_if_name,linkParams.ORILink.AWS_remoteMAC) < 0) return(-1);
inet_pton(AF_INET,eth_params->my_addr,(struct in_addr*)linkParams.ORILink.AWS_remoteIP);
result = ORI_ObjectParamModify(ori,link,linkParams,linkParamList,3,linkParamResult,&RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectParamModify (linkParams) failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
result = ORI_ObjectStateModification(ori, link, ORI_AST_Locked, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectParamModify (linkParams): %s (%d,%d,%d)\n", ORI_Result_Print(RE_result),linkParamResult[0],linkParamResult[1],linkParamResult[2]);
/*******************************************************************
* FULL OBJECT PARAMETERS UPDATE
*******************************************************************/
printf("\n\n\n========================================================\n");
result = ORI_ObjectParamReport(ori, NULL, 0, ORI_ObjectParam_All, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectParamReport failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectParamReport: %s\n", ORI_Result_Print(RE_result));
/*******************************************************************
* FULL OBJECT STATES UPDATE
*******************************************************************/
printf("\n\n\n========================================================\n");
result = ORI_ObjectStateReport(ori, NULL, 0, ORI_StateType_All, ORI_EventDrivenReport_True, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectStateReport failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectStateReport: %s\n", ORI_Result_Print(RE_result));
/* Print reported states for all objects (some objects have non-applicable states though) */
numObjects = ORI_GetAllObjects(ori, objects, 100, NULL);
for(i=0; i<numObjects; i++)
printf("%s:%d -> %s / %s\n", ORI_ObjectType_Print(objects[i]->typeRef.type), objects[i]->instanceNumber, ORI_AST_Print(objects[i]->ast), ORI_FST_Print(objects[i]->fst));
/*******************************************************************
* FULL OBJECT FAULTS UPDATE
*******************************************************************/
printf("\n\n\n========================================================\n");
result = ORI_ObjectFaultReport(ori, NULL, 0, ORI_EventDrivenReport_True, &RE_result);
if(result != ORI_Result_SUCCESS)
{
printf("ORI_ObjectFaultReport failed with error: %s\n", ORI_Result_Print(result));
aw2s_oricleanup(device);
return -1;
}
printf("ORI_ObjectFaultReport: %s\n", ORI_Result_Print(RE_result));
/*******************************************************************
* PRINT STATES
*******************************************************************/
printf("\n\n\n========================================================\n");
/* Due to event driven reporting set to "true", the states modifications of the objects should be reflected back into the model. Print states for all objects (some objects have non-applicable states though) */
numObjects = ORI_GetAllObjects(ori, objects, 100, NULL);
for(i=0; i<numObjects; i++)
printf("%s:%d -> %s / %s\n", ORI_ObjectType_Print(objects[i]->typeRef.type), objects[i]->instanceNumber, ORI_AST_Print(objects[i]->ast), ORI_FST_Print(objects[i]->fst));
return 0;
}
int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params ) {
device->thirdparty_init = aw2s_oriinit;
device->thirdparty_cleanup = aw2s_oricleanup;
device->thirdparty_startstreaming = aw2s_startstreaming;
return(0);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1300,13 +1300,13 @@ void fill_rf_config(RU_t *ru,
if (fp->threequarter_fs) {
cfg->sample_rate=23.04e6;
cfg->samples_per_frame = 230400;
cfg->tx_bw = 10e6;
cfg->rx_bw = 10e6;
cfg->tx_bw = 20e6;
cfg->rx_bw = 20e6;
} else {
cfg->sample_rate=30.72e6;
cfg->samples_per_frame = 307200;
cfg->tx_bw = 10e6;
cfg->rx_bw = 10e6;
cfg->tx_bw = 20e6;
cfg->rx_bw = 20e6;
}
} else if(ru->numerology == 1) {
cfg->sample_rate=61.44e6;
......@@ -1328,13 +1328,13 @@ void fill_rf_config(RU_t *ru,
} else if(fp->N_RB_DL == 50) {
cfg->sample_rate=15.36e6;
cfg->samples_per_frame = 153600;
cfg->tx_bw = 5e6;
cfg->rx_bw = 5e6;
cfg->tx_bw = 10e6;
cfg->rx_bw = 10e6;
} else if (fp->N_RB_DL == 25) {
cfg->sample_rate=7.68e6;
cfg->samples_per_frame = 76800;
cfg->tx_bw = 2.5e6;
cfg->rx_bw = 2.5e6;
cfg->tx_bw = 5e6;
cfg->rx_bw = 5e6;
} else if (fp->N_RB_DL == 6) {
cfg->sample_rate=1.92e6;
cfg->samples_per_frame = 19200;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment