Merge remote-tracking branch 'develop' into NR_DL_MIMO
This commit is contained in:
Vendored
+1
-1
@@ -25,4 +25,4 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,16 +196,6 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- enb-usrp") {
|
||||
steps {
|
||||
lock (vmResource) {
|
||||
timeout (time: 5, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage ("Start VM -- phy-sim") {
|
||||
steps {
|
||||
lock (vmResource) {
|
||||
@@ -251,7 +241,7 @@ pipeline {
|
||||
stage ("Analysis with cppcheck") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Analysis with cppcheck") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
timeout (time: 30, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
@@ -260,7 +250,7 @@ pipeline {
|
||||
stage ("Build basic simulator") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build basic-sim") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
timeout (time: 30, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
@@ -269,7 +259,7 @@ pipeline {
|
||||
stage ("Build 5G gNB-USRP") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build gNB-USRP") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
timeout (time: 30, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
@@ -278,25 +268,16 @@ pipeline {
|
||||
stage ("Build 5G NR-UE-USRP") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build nr-UE-USRP") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
timeout (time: 30, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant nr-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Build eNB-USRP") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build eNB-USRP") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage ("Build physical simulators") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build phy-sim") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
timeout (time: 30, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
@@ -305,7 +286,7 @@ pipeline {
|
||||
stage ("Build eNB-ethernet") {
|
||||
steps {
|
||||
gitlabCommitStatus(name: "Build eNB-ethernet") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
timeout (time: 30, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
@@ -316,7 +297,7 @@ pipeline {
|
||||
// This is typically the last one to finish.
|
||||
lock (vmResource) {
|
||||
gitlabCommitStatus(name: "Build UE-ethernet") {
|
||||
timeout (time: 20, unit: 'MINUTES') {
|
||||
timeout (time: 30, unit: 'MINUTES') {
|
||||
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
|
||||
}
|
||||
}
|
||||
|
||||
+18
-1
@@ -62,6 +62,12 @@ function build_on_vm {
|
||||
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
|
||||
echo "BUILD_OPTIONS = $BUILD_OPTIONS"
|
||||
|
||||
if [[ "$VM_NAME" == *"-enb-usrp"* ]]
|
||||
then
|
||||
echo "This VM type is no longer supported in the pipeline framework"
|
||||
return
|
||||
fi
|
||||
|
||||
IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME`
|
||||
|
||||
if [ $IS_VM_ALIVE -eq 0 ]
|
||||
@@ -158,6 +164,9 @@ function build_on_vm {
|
||||
echo "cd tmp" >> $VM_CMDS
|
||||
echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $VM_CMDS
|
||||
echo "unzip -qq -DD ../localZip.zip" >> $VM_CMDS
|
||||
# Trying to make some room on filesystem before building
|
||||
echo "rm ../localZip.zip" >> $VM_CMDS
|
||||
echo "export CI_ENV=True" >> $VM_CMDS
|
||||
if [[ "$VM_NAME" == *"-cppcheck"* ]]
|
||||
then
|
||||
echo "mkdir cmake_targets/log" >> $VM_CMDS
|
||||
@@ -208,7 +217,15 @@ function build_on_vm {
|
||||
echo "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS
|
||||
echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"./build_oai -I $BUILD_OPTIONS\" > ./my-vm-build.sh" >> $VM_CMDS
|
||||
if [[ "$VM_NAME" == *"-enb-ethernet"* ]]
|
||||
then
|
||||
echo "echo \"sleep 170 && ./build_oai -I $BUILD_OPTIONS\" > ./my-vm-build.sh" >> $VM_CMDS
|
||||
elif [[ "$VM_NAME" == *"-ue-ethernet"* ]]
|
||||
then
|
||||
echo "echo \"sleep 60 && ./build_oai -I $BUILD_OPTIONS\" > ./my-vm-build.sh" >> $VM_CMDS
|
||||
else
|
||||
echo "echo \"./build_oai -I $BUILD_OPTIONS\" > ./my-vm-build.sh" >> $VM_CMDS
|
||||
fi
|
||||
echo "chmod 775 ./my-vm-build.sh " >> $VM_CMDS
|
||||
echo "echo \"sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh\"" >> $VM_CMDS
|
||||
echo "sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh" >> $VM_CMDS
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
Active_gNBs = ( "gNB-Eurecom-5GNRBox");
|
||||
# Asn1_verbosity, choice in: none, info, annoying
|
||||
Asn1_verbosity = "none";
|
||||
|
||||
gNBs =
|
||||
(
|
||||
{
|
||||
////////// Identification parameters:
|
||||
gNB_ID = 0xe00;
|
||||
|
||||
cell_type = "CELL_MACRO_GNB";
|
||||
|
||||
gNB_name = "gNB-Eurecom-5GNRBox";
|
||||
|
||||
// Tracking area code, 0x0000 and 0xfffe are reserved values
|
||||
tracking_area_code = 1;
|
||||
|
||||
plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;});
|
||||
|
||||
tr_s_preference = "local_mac"
|
||||
|
||||
////////// Physical parameters:
|
||||
|
||||
ssb_SubcarrierOffset = 0;
|
||||
pdsch_AntennaPorts = 1;
|
||||
|
||||
servingCellConfigCommon = (
|
||||
{
|
||||
#spCellConfigCommon
|
||||
|
||||
physCellId = 0;
|
||||
|
||||
# downlinkConfigCommon
|
||||
#frequencyInfoDL
|
||||
# this is 2150 MHz + 43 PRBs@30kHz SCS (same as initial BWP)
|
||||
absoluteFrequencySSB = 433096;
|
||||
dl_frequencyBand = 66;
|
||||
# this is 2150 MHz
|
||||
dl_absoluteFrequencyPointA = 430000;
|
||||
#scs-SpecificCarrierList
|
||||
dl_offstToCarrier = 0;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
dl_subcarrierSpacing = 1;
|
||||
dl_carrierBandwidth = 106;
|
||||
#initialDownlinkBWP
|
||||
#genericParameters
|
||||
# this is RBstart=0,L=50 (275*(L-1))+RBstart
|
||||
initialDLBWPlocationAndBandwidth = 13475;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
initialDLBWPsubcarrierSpacing = 1;
|
||||
#pdcch-ConfigCommon
|
||||
initialDLBWPcontrolResourceSetZero = 12;
|
||||
initialDLBWPsearchSpaceZero = 0;
|
||||
#pdsch-ConfigCommon
|
||||
#pdschTimeDomainAllocationList (up to 16 entries)
|
||||
initialDLBWPk0_0 = 0;
|
||||
#initialULBWPmappingType
|
||||
#0=typeA,1=typeB
|
||||
initialDLBWPmappingType_0 = 0;
|
||||
#this is SS=1,L=13
|
||||
initialDLBWPstartSymbolAndLength_0 = 40;
|
||||
|
||||
initialDLBWPk0_1 = 0;
|
||||
initialDLBWPmappingType_1 = 0;
|
||||
#this is SS=2,L=12
|
||||
initialDLBWPstartSymbolAndLength_1 = 53;
|
||||
|
||||
initialDLBWPk0_2 = 0;
|
||||
initialDLBWPmappingType_2 = 0;
|
||||
#this is SS=1,L=12
|
||||
initialDLBWPstartSymbolAndLength_2 = 54;
|
||||
|
||||
initialDLBWPk0_3 = 0;
|
||||
initialDLBWPmappingType_3 = 0;
|
||||
#this is SS=1,L=4
|
||||
initialDLBWPstartSymbolAndLength_3 = 57;
|
||||
#uplinkConfigCommon
|
||||
#frequencyInfoUL
|
||||
ul_frequencyBand = 66;
|
||||
ul_absoluteFrequencyPointA = 350000;
|
||||
#scs-SpecificCarrierList
|
||||
ul_offstToCarrier = 0;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
ul_subcarrierSpacing = 1;
|
||||
ul_carrierBandwidth = 106;
|
||||
pMax = 20;
|
||||
#initialUplinkBWP
|
||||
#genericParameters
|
||||
initialULBWPlocationAndBandwidth = 13475;
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
initialULBWPsubcarrierSpacing = 1;
|
||||
#rach-ConfigCommon
|
||||
#rach-ConfigGeneric
|
||||
prach_ConfigurationIndex = 98;
|
||||
#prach_msg1_FDM
|
||||
#0 = one, 1=two, 2=four, 3=eight
|
||||
prach_msg1_FDM = 0;
|
||||
prach_msg1_FrequencyStart = 0;
|
||||
zeroCorrelationZoneConfig = 13;
|
||||
preambleReceivedTargetPower = -118;
|
||||
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
|
||||
preambleTransMax = 6;
|
||||
#powerRampingStep
|
||||
# 0=dB0,1=dB2,2=dB4,3=dB6
|
||||
powerRampingStep = 1;
|
||||
#ra_ReponseWindow
|
||||
#1,2,4,8,10,20,40,80
|
||||
ra_ResponseWindow = 4;
|
||||
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
|
||||
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
|
||||
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4;
|
||||
#oneHalf (0..15) 4,8,12,16,...60,64
|
||||
ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15;
|
||||
#ra_ContentionResolutionTimer
|
||||
#(0..7) 8,16,24,32,40,48,56,64
|
||||
ra_ContentionResolutionTimer = 7;
|
||||
rsrp_ThresholdSSB = 19;
|
||||
#prach-RootSequenceIndex_PR
|
||||
#1 = 839, 2 = 139
|
||||
prach_RootSequenceIndex_PR = 2;
|
||||
prach_RootSequenceIndex = 1;
|
||||
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
|
||||
#
|
||||
msg1_SubcarrierSpacing = 1,
|
||||
|
||||
# restrictedSetConfig
|
||||
# 0=unrestricted, 1=restricted type A, 2=restricted type B
|
||||
restrictedSetConfig = 0,
|
||||
# pusch-ConfigCommon (up to 16 elements)
|
||||
initialULBWPk2_0 = 6;
|
||||
initialULBWPmappingType_0 = 1
|
||||
# this is SS=0 L=11
|
||||
initialULBWPstartSymbolAndLength_0 = 55;
|
||||
|
||||
initialULBWPk2_1 = 6;
|
||||
initialULBWPmappingType_1 = 1;
|
||||
# this is SS=0 L=12
|
||||
initialULBWPstartSymbolAndLength_1 = 69;
|
||||
|
||||
initialULBWPk2_2 = 7;
|
||||
initialULBWPmappingType_2 = 1;
|
||||
# this is SS=10 L=4
|
||||
initialULBWPstartSymbolAndLength_2 = 52;
|
||||
msg3_DeltaPreamble = 1;
|
||||
p0_NominalWithGrant =-90;
|
||||
|
||||
# pucch-ConfigCommon setup :
|
||||
# pucchGroupHopping
|
||||
# 0 = neither, 1= group hopping, 2=sequence hopping
|
||||
pucchGroupHopping = 0;
|
||||
hoppingId = 40;
|
||||
p0_nominal = -90;
|
||||
# ssb_PositionsInBurs_BitmapPR
|
||||
# 1=short, 2=medium, 3=long
|
||||
ssb_PositionsInBurst_PR = 2;
|
||||
ssb_PositionsInBurst_Bitmap = 1;
|
||||
|
||||
# ssb_periodicityServingCell
|
||||
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
|
||||
ssb_periodicityServingCell = 2;
|
||||
|
||||
# dmrs_TypeA_position
|
||||
# 0 = pos2, 1 = pos3
|
||||
dmrs_TypeA_Position = 0;
|
||||
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
subcarrierSpacing = 1;
|
||||
|
||||
|
||||
#tdd-UL-DL-ConfigurationCommon
|
||||
# subcarrierSpacing
|
||||
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
|
||||
referenceSubcarrierSpacing = 1;
|
||||
# pattern1
|
||||
# dl_UL_TransmissionPeriodicity
|
||||
# 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
|
||||
dl_UL_TransmissionPeriodicity = 6;
|
||||
nrofDownlinkSlots = 7;
|
||||
nrofDownlinkSymbols = 6;
|
||||
nrofUplinkSlots = 2;
|
||||
nrofUplinkSymbols = 4;
|
||||
|
||||
ssPBCH_BlockPower = 10;
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
# ------- SCTP definitions
|
||||
SCTP :
|
||||
{
|
||||
# Number of streams to use in input/output
|
||||
SCTP_INSTREAMS = 2;
|
||||
SCTP_OUTSTREAMS = 2;
|
||||
};
|
||||
|
||||
|
||||
////////// MME parameters:
|
||||
mme_ip_address = ( { ipv4 = "192.168.12.26";
|
||||
ipv6 = "192:168:30::17";
|
||||
active = "yes";
|
||||
preference = "ipv4";
|
||||
}
|
||||
);
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
GNB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
GNB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
GNB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
MACRLCs = (
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_s_preference = "local_L1";
|
||||
tr_n_preference = "local_RRC";
|
||||
}
|
||||
);
|
||||
|
||||
L1s = (
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_n_preference = "local_mac";
|
||||
pusch_proc_threads = 8;
|
||||
}
|
||||
);
|
||||
|
||||
RUs = (
|
||||
{
|
||||
local_rf = "yes"
|
||||
nb_tx = 1;
|
||||
nb_rx = 1;
|
||||
att_tx = 0;
|
||||
att_rx = 0;
|
||||
bands = [7];
|
||||
max_pdschReferenceSignalPower = -27;
|
||||
max_rxgain = 75;
|
||||
eNB_instances = [0];
|
||||
##beamforming 1x2 matrix: 1 layer x 2 antennas
|
||||
bf_weights = [0x00007fff, 0x0000];
|
||||
##beamforming 1x4 matrix: 1 layer x 4 antennas
|
||||
#bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000];
|
||||
## beamforming 2x2 matrix:
|
||||
# bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff];
|
||||
## beamforming 4x4 matrix:
|
||||
#bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff];
|
||||
|
||||
sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2";
|
||||
clock_src = "external";
|
||||
# if_freq = 3700000000L;
|
||||
# if_offset = 1000000;
|
||||
}
|
||||
);
|
||||
|
||||
THREAD_STRUCT = (
|
||||
{
|
||||
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
|
||||
parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
|
||||
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
|
||||
worker_config = "WORKER_ENABLE";
|
||||
}
|
||||
);
|
||||
|
||||
log_config :
|
||||
{
|
||||
global_log_level ="info";
|
||||
global_log_verbosity ="medium";
|
||||
hw_log_level ="info";
|
||||
hw_log_verbosity ="medium";
|
||||
phy_log_level ="info";
|
||||
phy_log_verbosity ="medium";
|
||||
mac_log_level ="info";
|
||||
mac_log_verbosity ="high";
|
||||
rlc_log_level ="info";
|
||||
rlc_log_verbosity ="medium";
|
||||
pdcp_log_level ="info";
|
||||
pdcp_log_verbosity ="medium";
|
||||
rrc_log_level ="info";
|
||||
rrc_log_verbosity ="medium";
|
||||
};
|
||||
|
||||
@@ -228,19 +228,20 @@ MACRLCs = (
|
||||
num_cc = 1;
|
||||
tr_s_preference = "local_L1";
|
||||
tr_n_preference = "local_RRC";
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
L1s = (
|
||||
{
|
||||
{
|
||||
num_cc = 1;
|
||||
tr_n_preference = "local_mac";
|
||||
}
|
||||
pusch_proc_threads = 8;
|
||||
}
|
||||
);
|
||||
|
||||
RUs = (
|
||||
{
|
||||
local_rf = "yes"
|
||||
local_rf = "yes"
|
||||
nb_tx = 1
|
||||
nb_rx = 1
|
||||
att_tx = 0
|
||||
@@ -249,14 +250,15 @@ RUs = (
|
||||
max_pdschReferenceSignalPower = -27;
|
||||
max_rxgain = 75;
|
||||
eNB_instances = [0];
|
||||
##beamforming 1x2 matrix: 1 layer x 2 antennas
|
||||
#bf_weights = [0x00007fff, 0x00007fff];
|
||||
##beamforming 1x4 matrix: 1 layer x 4 antennas
|
||||
## beamforming 1x2 matrix: 1 layer x 2 antennas
|
||||
bf_weights = [0x00007fff, 0x0000];
|
||||
## beamforming 1x4 matrix: 1 layer x 4 antennas
|
||||
#bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000];
|
||||
## beamforming 2x2 matrix:
|
||||
#bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff];
|
||||
## beamforming 4x4 matrix:
|
||||
#bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff];
|
||||
|
||||
sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2";
|
||||
clock_src = "external";
|
||||
}
|
||||
|
||||
@@ -87,6 +87,12 @@ function create_vm {
|
||||
echo "VM_CPU = $VM_CPU"
|
||||
echo "VM_DISK = $VM_DISK GBytes"
|
||||
|
||||
if [[ "$VM_NAME" == *"-enb-usrp"* ]]
|
||||
then
|
||||
echo "This VM type is no longer supported in the pipeline framework"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "############################################################"
|
||||
echo "Creating VM ($VM_NAME) on Ubuntu Cloud Image base"
|
||||
echo "############################################################"
|
||||
|
||||
@@ -172,6 +172,7 @@ function setvar_usage {
|
||||
function variant__v1__enb_usrp {
|
||||
NB_PATTERN_FILES=9
|
||||
BUILD_OPTIONS="--eNB -w USRP --mu"
|
||||
VM_MEMORY=3072
|
||||
}
|
||||
|
||||
function variant__v2__basic_sim {
|
||||
@@ -213,15 +214,15 @@ function variant__v6__nr_ue_usrp {
|
||||
function variant__v7__enb_ethernet {
|
||||
VM_MEMORY=4096
|
||||
ARCHIVES_LOC=enb_eth
|
||||
NB_PATTERN_FILES=8
|
||||
BUILD_OPTIONS="--eNB"
|
||||
NB_PATTERN_FILES=9
|
||||
BUILD_OPTIONS="--eNB -w USRP"
|
||||
}
|
||||
|
||||
function variant__v8__ue_ethernet {
|
||||
VM_MEMORY=4096
|
||||
ARCHIVES_LOC=ue_eth
|
||||
NB_PATTERN_FILES=12
|
||||
BUILD_OPTIONS="--UE"
|
||||
NB_PATTERN_FILES=13
|
||||
BUILD_OPTIONS="--UE -w USRP"
|
||||
}
|
||||
|
||||
function variant__v10__flexran_rtc {
|
||||
|
||||
@@ -580,16 +580,42 @@ function report_build {
|
||||
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_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
|
||||
summary_table_row "OAI ETHERNET transport - Release 15" ./archives/enb_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./enb_eth_row3.html
|
||||
summary_table_row "Parameters Lib Config - Release 15" ./archives/enb_eth/params_libconfig.Rel15.txt "Built target params_libconfig" ./enb_eth_row4.html
|
||||
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
|
||||
summary_table_row "LTE UE SoftModem - Release 15" ./archives/ue_eth/lte-uesoftmodem.Rel15.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html
|
||||
summary_table_row "Coding - Release 15" ./archives/ue_eth/coding.Rel15.txt "Built target coding" ./ue_eth_row2.html
|
||||
summary_table_row "OAI ETHERNET transport - Release 15" ./archives/ue_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./ue_eth_row3.html
|
||||
summary_table_row "Parameters Lib Config - Release 15" ./archives/ue_eth/params_libconfig.Rel15.txt "Built target params_libconfig" ./ue_eth_row4.html
|
||||
summary_table_row "RF Simulator - Release 15" ./archives/ue_eth/rfsimulator.Rel15.txt "Built target rfsimulator" ./ue_eth_row5.html
|
||||
summary_table_row "TCP OAI Bridge - Release 15" ./archives/ue_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./ue_eth_row6.html
|
||||
summary_table_row "Conf 2 UE Data - Release 15" ./archives/ue_eth/conf2uedata.Rel15.txt "Built target conf2uedata" ./ue_eth_row7.html
|
||||
summary_table_row "NVRAM - Release 15" ./archives/ue_eth/nvram.Rel15.txt "Built target nvram" ./ue_eth_row8.html
|
||||
summary_table_row "UE IP - Release 15" ./archives/ue_eth/ue_ip.Rel15.txt "Built target ue_ip" ./ue_eth_row9.html
|
||||
summary_table_row "USIM - Release 15" ./archives/ue_eth/usim.Rel15.txt "Built target usim" ./ue_eth_row9a.html
|
||||
summary_table_row "OAI USRP device if - Release 15" ./archives/ue_eth/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./ue_eth_row9b.html
|
||||
summary_table_footer
|
||||
|
||||
summary_table_header "OAI Build: 4G LTE basic simulator option" ./archives/basic_sim
|
||||
@@ -676,28 +702,6 @@ function report_build {
|
||||
summary_table_footer
|
||||
fi
|
||||
|
||||
summary_table_header "OAI Build: 4G LTE eNB -- ETHERNET transport 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
|
||||
summary_table_row "OAI ETHERNET transport - Release 15" ./archives/enb_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./enb_eth_row3.html
|
||||
summary_table_row "Parameters Lib Config - Release 15" ./archives/enb_eth/params_libconfig.Rel15.txt "Built target params_libconfig" ./enb_eth_row4.html
|
||||
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_footer
|
||||
|
||||
summary_table_header "OAI Build: 4G LTE UE -- ETHERNET transport option" ./archives/ue_eth
|
||||
summary_table_row "LTE UE SoftModem - Release 15" ./archives/ue_eth/lte-uesoftmodem.Rel15.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html
|
||||
summary_table_row "Coding - Release 15" ./archives/ue_eth/coding.Rel15.txt "Built target coding" ./ue_eth_row2.html
|
||||
summary_table_row "OAI ETHERNET transport - Release 15" ./archives/ue_eth/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./ue_eth_row3.html
|
||||
summary_table_row "Parameters Lib Config - Release 15" ./archives/ue_eth/params_libconfig.Rel15.txt "Built target params_libconfig" ./ue_eth_row4.html
|
||||
summary_table_row "RF Simulator - Release 15" ./archives/ue_eth/rfsimulator.Rel15.txt "Built target rfsimulator" ./ue_eth_row5.html
|
||||
summary_table_row "TCP OAI Bridge - Release 15" ./archives/ue_eth/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./ue_eth_row6.html
|
||||
summary_table_row "Conf 2 UE Data - Release 15" ./archives/ue_eth/conf2uedata.Rel15.txt "Built target conf2uedata" ./ue_eth_row7.html
|
||||
summary_table_row "NVRAM - Release 15" ./archives/ue_eth/nvram.Rel15.txt "Built target nvram" ./ue_eth_row8.html
|
||||
summary_table_row "UE IP - Release 15" ./archives/ue_eth/ue_ip.Rel15.txt "Built target ue_ip" ./ue_eth_row9.html
|
||||
summary_table_row "USIM - Release 15" ./archives/ue_eth/usim.Rel15.txt "Built target usim" ./ue_eth_row9a.html
|
||||
summary_table_footer
|
||||
|
||||
if [ -e ./archives/red_hat ]
|
||||
then
|
||||
echo " <h2>Red Hat Enterprise Linux Server release 7.6) -- Summary</h2>" >> ./build_results.html
|
||||
@@ -714,9 +718,23 @@ function report_build {
|
||||
echo " <button data-toggle=\"collapse\" data-target=\"#oai-compilation-details\">Details for Compilation Errors and Warnings </button>" >> ./build_results.html
|
||||
echo " <div id=\"oai-compilation-details\" class=\"collapse\">" >> ./build_results.html
|
||||
|
||||
if [ -f ./enb_usrp_row1.html ] || [ -f ./enb_usrp_row2.html ] || [ -f ./enb_usrp_row3.html ] || [ -f ./enb_usrp_row4.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 ]
|
||||
then
|
||||
for DETAILS_TABLE in `ls ./enb_usrp_row*.html`
|
||||
for DETAILS_TABLE in `ls ./enb_eth_row*.html`
|
||||
do
|
||||
cat $DETAILS_TABLE >> ./build_results.html
|
||||
done
|
||||
fi
|
||||
if [ -f ./ue_eth_row1.html ] || [ -f ./ue_eth_row2.html ] || [ -f ./ue_eth_row3.html ] || [ -f ./ue_eth_row4.html ] || [ -f ./ue_eth_row5.html ] || [ -f ./ue_eth_row6.html ] || [ -f ./ue_eth_row7.html ] || [ -f ./ue_eth_row8.html ] || [ -f ./ue_eth_row9.html ] || [ -f ./ue_eth_row9a.html ] || [ -f ./ue_eth_row9b.html ]
|
||||
then
|
||||
for DETAILS_TABLE in `ls ./ue_eth_row*.html`
|
||||
do
|
||||
cat $DETAILS_TABLE >> ./build_results.html
|
||||
done
|
||||
@@ -749,20 +767,6 @@ function report_build {
|
||||
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 ]
|
||||
then
|
||||
for DETAILS_TABLE in `ls ./enb_eth_row*.html`
|
||||
do
|
||||
cat $DETAILS_TABLE >> ./build_results.html
|
||||
done
|
||||
fi
|
||||
if [ -f ./ue_eth_row1.html ] || [ -f ./ue_eth_row2.html ] || [ -f ./ue_eth_row3.html ] || [ -f ./ue_eth_row4.html ] || [ -f ./ue_eth_row5.html ] || [ -f ./ue_eth_row6.html ]
|
||||
then
|
||||
for DETAILS_TABLE in `ls ./ue_eth_row*.html`
|
||||
do
|
||||
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`
|
||||
|
||||
@@ -749,7 +749,7 @@ function report_test {
|
||||
echo " </tr>" >> ./test_simulator_results.html
|
||||
|
||||
EPC_CONFIGS=("noS1")
|
||||
TRANS_MODES=("tdd")
|
||||
TRANS_MODES=("fdd" "tdd")
|
||||
BW_CASES=(106)
|
||||
for CN_CONFIG in ${EPC_CONFIGS[@]}
|
||||
do
|
||||
|
||||
+57
-33
@@ -379,7 +379,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`
|
||||
@@ -2189,39 +2189,50 @@ function run_test_on_vm {
|
||||
|
||||
if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]]
|
||||
then
|
||||
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
|
||||
|
||||
local try_cnt=0
|
||||
NR_STATUS=0
|
||||
CN_CONFIG="noS1"
|
||||
S1_NOS1_CFG=0
|
||||
|
||||
######### start of RA TEST loop
|
||||
while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI
|
||||
# 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
|
||||
|
||||
local try_cnt=0
|
||||
NR_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/${TMODE}_${PRB}prb_${CN_CONFIG}*ra_test.log
|
||||
|
||||
echo "############################################################"
|
||||
echo "${CN_CONFIG} : Starting the gNB"
|
||||
echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (RA TEST)"
|
||||
echo "############################################################"
|
||||
CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_test.log
|
||||
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"
|
||||
echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (RA TEST)"
|
||||
echo "############################################################"
|
||||
CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_ra_test.log
|
||||
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 ]
|
||||
@@ -2260,35 +2271,47 @@ function run_test_on_vm {
|
||||
else
|
||||
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 +2329,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 +2338,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 +2347,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 +2369,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 +2391,7 @@ function run_test_on_vm {
|
||||
else
|
||||
try_cnt=$((try_cnt+10))
|
||||
fi
|
||||
done
|
||||
done
|
||||
######### end of loop
|
||||
full_l2_sim_destroy
|
||||
|
||||
@@ -47,6 +47,12 @@ function wait_on_vm_build {
|
||||
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
|
||||
echo "BUILD_OPTIONS = $BUILD_OPTIONS"
|
||||
|
||||
if [[ "$VM_NAME" == *"-enb-usrp"* ]]
|
||||
then
|
||||
echo "This VM type is no longer supported in the pipeline framework"
|
||||
return
|
||||
fi
|
||||
|
||||
IS_VM_ALIVE=`uvt-kvm list | grep -c $VM_NAME`
|
||||
|
||||
if [ $IS_VM_ALIVE -eq 0 ]
|
||||
@@ -84,6 +90,12 @@ function wait_on_vm_build {
|
||||
}
|
||||
|
||||
function check_on_vm_build {
|
||||
if [[ "$VM_NAME" == *"-enb-usrp"* ]]
|
||||
then
|
||||
echo "This VM type is no longer supported in the pipeline framework"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "############################################################"
|
||||
echo "Creating a tmp folder to store results and artifacts"
|
||||
echo "############################################################"
|
||||
|
||||
@@ -1967,7 +1967,9 @@ 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/asn1_utils.c
|
||||
)
|
||||
|
||||
@@ -2132,7 +2134,23 @@ set (MCE_APP_SRC
|
||||
${OPENAIR2_DIR}/MCE_APP/mce_app.c
|
||||
${OPENAIR2_DIR}/MCE_APP/mce_config.c
|
||||
)
|
||||
set (MISC_NFAPI_LTE
|
||||
${OPENAIR1_DIR}/SCHED/nfapi_lte_dummy.c
|
||||
)
|
||||
|
||||
|
||||
add_library(MISC_NFAPI_LTE_LIB
|
||||
${MISC_NFAPI_LTE}
|
||||
)
|
||||
|
||||
set (MISC_NFAPI_NR
|
||||
${OPENAIR1_DIR}/SCHED/nfapi_nr_dummy.c
|
||||
)
|
||||
|
||||
|
||||
add_library(MISC_NFAPI_NR_LIB
|
||||
${MISC_NFAPI_NR}
|
||||
)
|
||||
add_library(L2
|
||||
${L2_SRC}
|
||||
${MAC_SRC}
|
||||
@@ -2885,7 +2903,7 @@ 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
|
||||
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7
|
||||
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)
|
||||
|
||||
@@ -2926,7 +2944,7 @@ 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
|
||||
PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON
|
||||
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)
|
||||
target_link_libraries (ocp-enb ${LIBXML2_LIBRARIES} pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} sctp ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES} ${LIB_LMS_LIBRARIES} ${T_LIB})
|
||||
@@ -2996,7 +3014,7 @@ 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
|
||||
PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
|
||||
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)
|
||||
|
||||
@@ -3123,6 +3141,8 @@ target_link_libraries (nr-uesoftmodem
|
||||
-Wl,--start-group
|
||||
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}
|
||||
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
|
||||
-Wl,--end-group z dl)
|
||||
|
||||
@@ -1292,7 +1292,9 @@
|
||||
(Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols),
|
||||
(Test9: SC-FDMA, 50 PRBs),
|
||||
(Test10: SC-FDMA, 75 PRBs),
|
||||
(Test11: SC-FDMA, 3 DMRS)</desc>
|
||||
(Test11: SC-FDMA, 216 PRBs),
|
||||
(Test12: SC-FDMA, 273 PRBs),
|
||||
(Test13: SC-FDMA, 3 DMRS)</desc>
|
||||
<pre_compile_prog></pre_compile_prog>
|
||||
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
|
||||
<compile_prog_args> --phy_simulators -c </compile_prog_args>
|
||||
@@ -1307,10 +1309,13 @@
|
||||
-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 -s20 -Z
|
||||
-n100 -s20 -Z -r75
|
||||
-n100 -s20 -Z -U 2 0 2</main_exec_args>
|
||||
<tags>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</tags>
|
||||
-n100 -s2 -Z
|
||||
-n100 -s2 -Z -r75
|
||||
-n100 -s2 -Z -r216 -R217
|
||||
-n100 -s2 -Z -r270 -R273
|
||||
-n100 -s2 -Z -U 2 0 2</main_exec_args>
|
||||
|
||||
<tags>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</tags>
|
||||
<search_expr_true>PUSCH test OK</search_expr_true>
|
||||
<search_expr_false>segmentation fault|assertion|exiting|fatal</search_expr_false>
|
||||
<nruns>3</nruns>
|
||||
|
||||
@@ -273,6 +273,10 @@ install_protobuf_from_source(){
|
||||
make -j`nproc`
|
||||
$SUDO make install
|
||||
$SUDO ldconfig
|
||||
if [[ -v CI_ENV ]]; then
|
||||
cd /tmp
|
||||
$SUDO rm -rf protobuf*
|
||||
fi
|
||||
) >& $protobuf_install_log
|
||||
}
|
||||
|
||||
@@ -295,6 +299,10 @@ install_protobuf_c_from_source(){
|
||||
make -j`nproc`
|
||||
$SUDO make install
|
||||
$SUDO ldconfig
|
||||
if [[ -v CI_ENV ]]; then
|
||||
cd /tmp
|
||||
$SUDO rm -rf protobuf*
|
||||
fi
|
||||
) >& $protobuf_c_install_log
|
||||
}
|
||||
|
||||
@@ -831,6 +839,9 @@ install_asn1c_from_source(){
|
||||
$SUDO make install
|
||||
cd -
|
||||
$SUDO ldconfig
|
||||
if [[ -v CI_ENV ]]; then
|
||||
$SUDO rm -rf /tmp/asn1c
|
||||
fi
|
||||
) > $asn1_install_log 2>&1
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "config_userapi.h"
|
||||
#include "../utils/LOG/log.h"
|
||||
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
|
||||
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
|
||||
void *lib_handle;
|
||||
@@ -331,9 +331,10 @@ void end_configmodule(void) {
|
||||
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
|
||||
|
||||
for(int i=0; i<cfgptr->numptrs ; i++) {
|
||||
if (cfgptr->ptrs[i] != NULL) {
|
||||
if (cfgptr->ptrs[i] != NULL && cfgptr->ptrsAllocated[i] == true) {
|
||||
free(cfgptr->ptrs[i]);
|
||||
cfgptr->ptrs[i]=NULL;
|
||||
cfgptr->ptrsAllocated[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "common/config/config_paramdesc.h"
|
||||
#include "common/utils/T/T.h"
|
||||
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
|
||||
@@ -74,6 +76,7 @@ typedef struct configmodule_interface {
|
||||
uint32_t numptrs;
|
||||
uint32_t rtflags;
|
||||
char *ptrs[CONFIG_MAX_ALLOCATEDPTRS];
|
||||
bool ptrsAllocated[CONFIG_MAX_ALLOCATEDPTRS];
|
||||
} configmodule_interface_t;
|
||||
|
||||
#ifdef CONFIG_LOADCONFIG_MAIN
|
||||
|
||||
@@ -62,6 +62,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
|
||||
|
||||
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
|
||||
config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr;
|
||||
config_get_if()->ptrsAllocated[config_get_if()->numptrs] = true;
|
||||
config_get_if()->numptrs++;
|
||||
}
|
||||
} else {
|
||||
@@ -82,7 +83,9 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
|
||||
}
|
||||
|
||||
if (*ptr == NULL) {
|
||||
*ptr = malloc(length>40?length:40); // LTS: dummy fix, waiting Francois full fix in 4G branch
|
||||
*ptr = malloc(length>40?length:40);
|
||||
// LTS: dummy fix, waiting Francois full fix in 4G branch
|
||||
// the issue is we don't know at this point the size we will get
|
||||
|
||||
if ( *ptr != NULL) {
|
||||
memset(*ptr,0,length);
|
||||
|
||||
@@ -346,6 +346,7 @@ int config_libconfig_init(char *cfgP[], int numP) {
|
||||
libconfig_privdata.configfile = strdup((char *)cfgP[0]);
|
||||
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));
|
||||
|
||||
/* Read the file. If there is an error, report it and exit. */
|
||||
if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
|
||||
|
||||
+34
-4
@@ -88,17 +88,20 @@ int write_file_matlab(const char *fname,
|
||||
void *data,
|
||||
int length,
|
||||
int dec,
|
||||
char format)
|
||||
unsigned int format,
|
||||
int multiVec)
|
||||
{
|
||||
FILE *fp=NULL;
|
||||
int i;
|
||||
|
||||
AssertFatal((format&~MATLAB_RAW) <16,"");
|
||||
|
||||
if (data == NULL)
|
||||
return -1;
|
||||
|
||||
//printf("Writing %d elements of type %d to %s\n",length,format,fname);
|
||||
|
||||
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
|
||||
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14 || multiVec) {
|
||||
fp = fopen(fname,"a+");
|
||||
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
|
||||
fp = fopen(fname,"w+");
|
||||
@@ -109,7 +112,32 @@ int write_file_matlab(const char *fname,
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
|
||||
if ( (format&MATLAB_RAW) == MATLAB_RAW ) {
|
||||
int sz[16]={sizeof(short), 2*sizeof(short),
|
||||
sizeof(int), 2*sizeof(int),
|
||||
sizeof(char), 2*sizeof(char),
|
||||
sizeof(long long),
|
||||
sizeof(double), 2*sizeof(double),
|
||||
sizeof(unsigned char),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short),
|
||||
sizeof(short)
|
||||
};
|
||||
int eltSz= sz[format&~MATLAB_RAW];
|
||||
if (dec==1)
|
||||
fwrite(data, eltSz, length, fp);
|
||||
else
|
||||
for (i=0; i<length; i+=dec)
|
||||
fwrite(data+i*eltSz, eltSz, 1, fp);
|
||||
|
||||
fclose(fp);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if ((format != 10 && format !=11 && format != 12 && format != 13 && format != 14) || multiVec)
|
||||
fprintf(fp,"%s = [",vname);
|
||||
|
||||
switch (format) {
|
||||
@@ -214,9 +242,11 @@ int write_file_matlab(const char *fname,
|
||||
case 12 : // case eren for log2_maxh real unsigned 8 bit
|
||||
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(false, "unknown dump format: %d\n", format);
|
||||
}
|
||||
|
||||
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) {
|
||||
if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) {
|
||||
fprintf(fp,"];\n");
|
||||
fclose(fp);
|
||||
return(0);
|
||||
|
||||
+24
-4
@@ -335,8 +335,27 @@ typedef struct {
|
||||
@param length length of data vector to output
|
||||
@param dec decimation level
|
||||
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
|
||||
@param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1)
|
||||
*/
|
||||
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
|
||||
#define MATLAB_RAW (1<<31)
|
||||
#define MATLAB_SHORT 0
|
||||
#define MATLAB_CSHORT 1
|
||||
#define MATLAB_INT 2
|
||||
#define MATLAB_CINT 3
|
||||
#define MATLAB_INT8 4
|
||||
#define MATLAB_CINT8 5
|
||||
#define MATLAB_LLONG 6
|
||||
#define MATLAB_DOUBLE 7
|
||||
#define MATLAB_CDOUBLE 8
|
||||
#define MATLAB_UINT8 9
|
||||
#define MATLEB_EREN1 10
|
||||
#define MATLEB_EREN2 11
|
||||
#define MATLEB_EREN3 12
|
||||
#define MATLAB_CSHORT_BRACKET1 13
|
||||
#define MATLAB_CSHORT_BRACKET2 14
|
||||
#define MATLAB_CSHORT_BRACKET3 15
|
||||
|
||||
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format, int multiVec);
|
||||
|
||||
/*----------------macro definitions for reading log configuration from the config module */
|
||||
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
||||
@@ -396,7 +415,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
|
||||
/* bitmask dependent macros, to generate debug file such as matlab file or message dump */
|
||||
# define LOG_DUMPFLAG(D) (g_log->dump_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 */
|
||||
@@ -413,7 +432,7 @@ 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
|
||||
# endif /* T_TRACER */
|
||||
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
|
||||
@@ -421,9 +440,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)
|
||||
/* @}*/
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ T_IDs.h
|
||||
T_messages.txt.h
|
||||
genids
|
||||
tracer/enb
|
||||
tracer/gnb
|
||||
tracer/extract_config
|
||||
tracer/record
|
||||
tracer/replay
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
/* let's have 100 RBs functional for the basic simulator */
|
||||
# define T_BUFFER_MAX (1024*64*2)
|
||||
#else
|
||||
# define T_BUFFER_MAX (1024*64)
|
||||
# define T_BUFFER_MAX (1024*64*2)
|
||||
#endif
|
||||
|
||||
/* size of the local cache for messages (must be pow(2,something)) */
|
||||
@@ -52,7 +52,7 @@
|
||||
/* we don't need much space for the basic simulator */
|
||||
# define T_CACHE_SIZE 1024
|
||||
#else
|
||||
# define T_CACHE_SIZE (8192 * 2)
|
||||
# define T_CACHE_SIZE (8192)
|
||||
#endif
|
||||
|
||||
/* maximum number of bytes a message can contain */
|
||||
|
||||
@@ -89,6 +89,10 @@ 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
|
||||
|
||||
#MAC logs
|
||||
ID = ENB_MAC_UE_DL_SDU
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#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 <database file> this option is mandatory\n"
|
||||
" -ip <host> connect to given IP address (default %s)\n"
|
||||
" -p <port> 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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -32,6 +32,81 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#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;
|
||||
|
||||
@@ -36,6 +36,20 @@
|
||||
#include <stdint.h>
|
||||
#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);
|
||||
|
||||
+10
-7
@@ -132,9 +132,9 @@ 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. Currently OAI in NR standalone mode transmits and receives SIB1 and triggers the RA procedure for initial access.
|
||||
|
||||
In order to run gNB in standalone mode, the following flag is needed at gNB:
|
||||
|
||||
@@ -147,8 +147,9 @@ At the gNB the --sa flag does the following
|
||||
- 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
|
||||
- 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.
|
||||
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
|
||||
- After the successful decoding of a SIB1 at RRC, the UE will start the 5G NR Initial Access Procedure by triggering the RA procedure.
|
||||
|
||||
From the `cmake_targets/ran_build/build` folder:
|
||||
|
||||
@@ -168,7 +169,7 @@ With the RF simulator (on the same machine):
|
||||
|
||||
## 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 +183,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:
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ http://www.saelig.com/MFR00066/ste2300.htm
|
||||
## Configuration Overview
|
||||
|
||||
* Non Standalone (NSA) configuration : initial Control Plane established between UE and RAN eNB, then User Plane established between UE and gNB, Core network is 4G based supporting rel 15
|
||||
|
||||
* Commercial UE: Oppo Reno 5G
|
||||
* OAI Software Defined gNB and eNB
|
||||
* eNB RF front end: USRP (ETTUS) B200 Mini or B210
|
||||
* gNB RF front end: USRP (ETTUS) B200 Mini or B210 (N310 will be needed for MIMO and wider BW's)
|
||||
@@ -40,6 +38,17 @@ http://www.saelig.com/MFR00066/ste2300.htm
|
||||
* BW: 40MHz
|
||||
* Antenna scheme: SISO
|
||||
|
||||
## COTS UEs
|
||||
|
||||
Our code might not work with all 5G phones yet, but we are constantly improving it. Here is a list of COTS UEs that we know that work with OAI.
|
||||
|
||||
* Oppo Reno 5G
|
||||
* Samsung A90 5G
|
||||
* Google Pixel 5G
|
||||
* Simcom SIMCOM8200EA
|
||||
* Quectel RM500Q-GL
|
||||
|
||||
|
||||
## Repository
|
||||
|
||||
https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop
|
||||
|
||||
@@ -74,6 +74,7 @@ int config_sync_var=-1;
|
||||
volatile int oai_exit = 0;
|
||||
double cpuf;
|
||||
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];
|
||||
|
||||
+78
-635
@@ -81,10 +81,11 @@
|
||||
|
||||
#include "s1ap_eNB.h"
|
||||
#include "SIMULATION/ETH_TRANSPORT/proto.h"
|
||||
|
||||
#include <executables/softmodem-common.h>
|
||||
|
||||
#include "T.h"
|
||||
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include <nfapi/oai_integration/nfapi_pnf.h>
|
||||
//#define DEBUG_THREADS 1
|
||||
|
||||
//#define USRP_DEBUG 1
|
||||
@@ -92,17 +93,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,39 +101,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 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;
|
||||
|
||||
@@ -151,13 +145,14 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
|
||||
|
||||
// *******************************************************************
|
||||
// NFAPI not yet supported for NR - this code has to be revised
|
||||
if (nfapi_mode == 1) {
|
||||
if (NFAPI_MODE == NFAPI_MODE_PNF) {
|
||||
// I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
|
||||
//add_subframe(&frame, &subframe, 4);
|
||||
//oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
|
||||
//LOG_D(PHY, "oai_subframe_ind(frame:%u, subframe:%d) - NOT CALLED ********\n", frame, subframe);
|
||||
start_meas(&nfapi_meas);
|
||||
oai_subframe_ind(frame_rx, slot_rx);
|
||||
// oai_subframe_ind(frame_rx, slot_rx);
|
||||
oai_slot_ind(frame_rx, slot_rx);
|
||||
stop_meas(&nfapi_meas);
|
||||
|
||||
/*if (gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus||
|
||||
@@ -233,12 +228,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);
|
||||
@@ -272,23 +261,24 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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,
|
||||
@@ -328,466 +318,7 @@ 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 = 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;
|
||||
|
||||
|
||||
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; i<gNB->num_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; i<gNB->num_RU; i++) {
|
||||
if (ru == gNB->RU_list[i]) {
|
||||
if ((proc->RU_mask&(1<<i)) > 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<<i);
|
||||
}
|
||||
}
|
||||
if (proc->RU_mask != (1<<gNB->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;i<gNB->num_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<<i)) > 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<<i);
|
||||
}
|
||||
}
|
||||
if (proc->RU_mask_prach != (1<<gNB->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;
|
||||
@@ -808,71 +339,13 @@ static void *process_stats_thread(void *param) {
|
||||
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<<gNB->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);
|
||||
int threadCnt = min(numCPU, gNB->pusch_proc_threads);
|
||||
char ul_pool[80];
|
||||
@@ -883,70 +356,40 @@ void init_gNB_proc(int inst) {
|
||||
s_offset += 3;
|
||||
}
|
||||
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->L1_stats_thread, process_stats_thread,(void *)gNB, "time_meas", -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);
|
||||
@@ -999,7 +442,13 @@ void init_eNB_afterRU(void) {
|
||||
for (i=0; i<gNB->RU_list[ru_id]->nb_rx; aa++,i++) {
|
||||
LOG_I(PHY,"Attaching RU %d antenna %d to gNB antenna %d\n",gNB->RU_list[ru_id]->idx,i,aa);
|
||||
gNB->prach_vars.rxsigF[aa] = gNB->RU_list[ru_id]->prach_rxsigF[0][i];
|
||||
#if 0
|
||||
printf("before %p\n", gNB->common_vars.rxdataF[aa]);
|
||||
#endif
|
||||
gNB->common_vars.rxdataF[aa] = gNB->RU_list[ru_id]->common.rxdataF[i];
|
||||
#if 0
|
||||
printf("after %p\n", gNB->common_vars.rxdataF[aa]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1008,15 +457,9 @@ void init_eNB_afterRU(void) {
|
||||
* (not tested in other modes).
|
||||
*/
|
||||
//init_precoding_weights(RC.gNB[inst]);
|
||||
init_gNB_proc(inst);
|
||||
init_gNB_Tpool(inst);
|
||||
}
|
||||
|
||||
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
AssertFatal(RC.ru[ru_id]!=NULL,"ru_id %d is null\n",ru_id);
|
||||
RC.ru[ru_id]->nr_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) {
|
||||
|
||||
+74
-610
@@ -114,6 +114,7 @@ int attach_rru(RU_t *ru);
|
||||
int connect_rau(RU_t *ru);
|
||||
|
||||
uint16_t sf_ahead;
|
||||
uint16_t slot_ahead;
|
||||
uint16_t sl_ahead;
|
||||
|
||||
extern int emulate_rf;
|
||||
@@ -787,259 +788,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; i<ru->nb_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; i<ru->nb_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; i<ru->num_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;
|
||||
@@ -1298,136 +1046,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; i<ru->nb_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; i<ru->nb_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; i<ru->nb_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; i<ru->num_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; j<gNB->num_RU; j++) {
|
||||
if (ru == gNB->RU_list[j]) {
|
||||
if ((gNB_proc->RU_mask_tx&(1<<j)) > 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<<j);
|
||||
sprintf(filename,"tx%ddataF_BF_frame%d_sl%d.m", i, print_frame, slot_tx);
|
||||
LOG_M(filename,"txdataF_BF_frame",&ru->common.txdataF_BF[i][0],fp->samples_per_subframe_wCP, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (gNB_proc->RU_mask_tx != (1<<gNB->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; i<ru->nb_tx; i++)
|
||||
}//if(frame_tx == print_frame)
|
||||
}//else emulate_rf
|
||||
}
|
||||
|
||||
void *ru_thread( void *param ) {
|
||||
@@ -1435,12 +1108,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;
|
||||
|
||||
nfapi_nr_config_request_scf_t *cfg = &ru->config;
|
||||
@@ -1500,6 +1172,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 +1189,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 +1202,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
|
||||
while (!oai_exit) {
|
||||
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
|
||||
@@ -1556,31 +1219,23 @@ 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
|
||||
|
||||
int slot_type = nr_slot_select(cfg,proc->frame_rx,proc->tti_rx);
|
||||
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);
|
||||
@@ -1630,50 +1285,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; i<ru->nb_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; i<ru->nb_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");
|
||||
@@ -1684,85 +1306,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));
|
||||
@@ -1784,17 +1334,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;
|
||||
@@ -1805,44 +1348,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);
|
||||
|
||||
@@ -1855,46 +1367,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);
|
||||
@@ -1923,17 +1398,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)
|
||||
|
||||
@@ -85,12 +85,13 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
#include "x2ap_eNB.h"
|
||||
#include "ngap_gNB.h"
|
||||
#include "gnb_paramdef.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||
|
||||
uint8_t nfapi_mode = 0; // Default to monolithic mode
|
||||
extern uint8_t nfapi_mode; // Default to monolithic mode
|
||||
|
||||
pthread_cond_t sync_cond;
|
||||
pthread_mutex_t sync_mutex;
|
||||
@@ -811,7 +812,7 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
|
||||
} else {
|
||||
printf("No ITTI, Initializing L1\n");
|
||||
RCconfig_L1();
|
||||
RCconfig_NR_L1();
|
||||
}
|
||||
|
||||
/* Start the agent. If it is turned off in the configuration, it won't start */
|
||||
@@ -832,7 +833,7 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
|
||||
usleep(1000);
|
||||
|
||||
if (nfapi_mode) {
|
||||
if (NFAPI_MODE) {
|
||||
printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
|
||||
pthread_cond_init(&sync_cond,NULL);
|
||||
pthread_mutex_init(&sync_mutex, NULL);
|
||||
@@ -840,7 +841,7 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
|
||||
const char *nfapi_mode_str = "<UNKNOWN>";
|
||||
|
||||
switch(nfapi_mode) {
|
||||
switch(NFAPI_MODE) {
|
||||
case 0:
|
||||
nfapi_mode_str = "MONOLITHIC";
|
||||
break;
|
||||
@@ -860,7 +861,7 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
|
||||
printf("NFAPI MODE:%s\n", nfapi_mode_str);
|
||||
|
||||
if (nfapi_mode==2) // VNF
|
||||
if (NFAPI_MODE==NFAPI_MODE_VNF)
|
||||
wait_nfapi_init("main?");
|
||||
|
||||
printf("START MAIN THREADS\n");
|
||||
@@ -889,7 +890,7 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
|
||||
config_sync_var=0;
|
||||
|
||||
if (nfapi_mode==1) { // PNF
|
||||
if (NFAPI_MODE==NFAPI_MODE_PNF) {
|
||||
wait_nfapi_init("main?");
|
||||
}
|
||||
|
||||
@@ -909,7 +910,7 @@ if(!IS_SOFTMODEM_NOS1)
|
||||
load_softscope("nr",&p);
|
||||
}
|
||||
|
||||
if (nfapi_mode != 1 && nfapi_mode != 2) {
|
||||
if (NFAPI_MODE != NFAPI_MODE_PNF && NFAPI_MODE != NFAPI_MODE_VNF) {
|
||||
printf("Not NFAPI mode - call init_eNB_afterRU()\n");
|
||||
init_eNB_afterRU();
|
||||
} else {
|
||||
|
||||
+16
-9
@@ -703,16 +703,23 @@ 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)
|
||||
|
||||
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 = 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 ==
|
||||
|
||||
@@ -531,7 +531,8 @@ int main( int argc, char **argv ) {
|
||||
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
|
||||
|
||||
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, UE[CC_id]->frame_parms.dl_CarrierFreq);
|
||||
|
||||
init_symbol_rotation(&UE[CC_id]->frame_parms);
|
||||
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
|
||||
|
||||
#ifdef FR2_TEST
|
||||
@@ -557,11 +558,14 @@ int main( int argc, char **argv ) {
|
||||
|
||||
|
||||
init_NR_UE_threads(1);
|
||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||
printf("UE threads created by %ld\n", gettid());
|
||||
|
||||
// wait for end of program
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
// Sleep a while before checking all parameters have been used
|
||||
// Some are used directly in external threads, asynchronously
|
||||
sleep(20);
|
||||
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
|
||||
|
||||
while(true)
|
||||
sleep(3600);
|
||||
|
||||
@@ -39,11 +39,14 @@
|
||||
#include "executables/thread-common.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "softmodem-common.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
|
||||
static softmodem_params_t softmodem_params;
|
||||
char *parallel_config=NULL;
|
||||
char *worker_config=NULL;
|
||||
|
||||
uint8_t nfapi_mode=0;
|
||||
|
||||
static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS;
|
||||
static struct timespec start;
|
||||
@@ -143,6 +146,7 @@ void get_common_options(uint32_t execmask) {
|
||||
if(parallel_config != NULL) set_parallel_conf(parallel_config);
|
||||
|
||||
if(worker_config != NULL) set_worker_conf(worker_config);
|
||||
nfapi_setmode(nfapi_mode);
|
||||
}
|
||||
void softmodem_printresources(int sig, telnet_printfunc_t pf) {
|
||||
struct rusage usage;
|
||||
|
||||
@@ -91,6 +91,7 @@ extern "C"
|
||||
#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_NFAPI "Change the nFAPI mode for NR\n"
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters common to eNodeB and UE */
|
||||
@@ -112,6 +113,7 @@ extern "C"
|
||||
#define SEND_DMRSSYNC softmodem_params.send_dmrs_sync
|
||||
#define USIM_TEST softmodem_params.usim_test
|
||||
#define USE_256QAM_TABLE softmodem_params.use_256qam_table
|
||||
#define NFAPI softmodem_params.nfapi
|
||||
|
||||
#define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat";
|
||||
|
||||
@@ -142,6 +144,7 @@ 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}, \
|
||||
}
|
||||
|
||||
|
||||
@@ -229,6 +232,7 @@ typedef struct {
|
||||
int hw_timing_advance;
|
||||
uint32_t send_dmrs_sync;
|
||||
int use_256qam_table;
|
||||
uint8_t nfapi;
|
||||
} softmodem_params_t;
|
||||
|
||||
extern uint64_t get_softmodem_optmask(void);
|
||||
@@ -240,6 +244,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 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;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Changelog
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Procedure to run nFAPI in 5G NR
|
||||
|
||||
## Conributed by 5G Testbed IISC
|
||||
### Developers: Sudhakar B,Mahesh K,Gokul S,Aniq U.R
|
||||
|
||||
## Procedure to Build gNB and UE
|
||||
|
||||
The regular commands to build gNB and UE can be used
|
||||
```
|
||||
sudo ./build_oai --gNB --UE
|
||||
|
||||
```
|
||||
## Procedure to run NR nFAPI using RF-Simulator
|
||||
|
||||
### VNF command
|
||||
```
|
||||
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test
|
||||
|
||||
```
|
||||
### PNF command
|
||||
```
|
||||
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --rfsim --phy-test --rfsimulator.serveraddr server
|
||||
|
||||
```
|
||||
### UE command
|
||||
```
|
||||
sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path . -d
|
||||
|
||||
```
|
||||
## Procedure to run NR nFAPI using Hardware
|
||||
Will be updated as we have not yet currently tested on hardware
|
||||
|
||||
## Notes
|
||||
* In order to acheive the synchronization between VNF and PNF and receive the P7 messages within the timing window the order in which we should run the modules on different terminals is UE->VNF->PNF
|
||||
* Currently only downlink is functional and working as we are still working on uplink functionality
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,5 +23,8 @@
|
||||
#define NFAPI_PNF_H__
|
||||
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);
|
||||
|
||||
void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
||||
void oai_slot_ind(uint16_t sfn, uint16_t slot);
|
||||
#endif
|
||||
|
||||
@@ -39,8 +39,12 @@
|
||||
#include "nfapi_vnf.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#define TEST
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern UL_RCC_IND_t UL_RCC_INFO;
|
||||
|
||||
@@ -189,11 +193,12 @@ int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t
|
||||
int vnf_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *codec) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst);
|
||||
void install_schedule_handlers(IF_Module_t *if_inst);
|
||||
extern int single_thread_flag;
|
||||
extern void init_eNB_afterRU(void);
|
||||
extern uint16_t sf_ahead;
|
||||
extern uint16_t slot_ahead;
|
||||
|
||||
void oai_create_enb(void) {
|
||||
int bodge_counter=0;
|
||||
@@ -231,6 +236,39 @@ void oai_enb_init(void) {
|
||||
init_eNB_afterRU();
|
||||
}
|
||||
|
||||
|
||||
void oai_create_gnb(void) {
|
||||
int bodge_counter=0;
|
||||
PHY_VARS_gNB *gNB = RC.gNB[0];
|
||||
RC.nb_nr_CC = (int *)malloc(sizeof(int)); // TODO: find a better function to place this in
|
||||
|
||||
gNB->Mod_id = bodge_counter;
|
||||
gNB->CC_id = bodge_counter;
|
||||
gNB->abstraction_flag = 0;
|
||||
gNB->single_thread_flag = 0;//single_thread_flag;
|
||||
RC.nb_nr_CC[bodge_counter] = 1;
|
||||
|
||||
if (gNB->if_inst==0) {
|
||||
gNB->if_inst = NR_IF_Module_init(bodge_counter);
|
||||
}
|
||||
|
||||
|
||||
// This will cause phy_config_request to be installed. That will result in RRC configuring the PHY
|
||||
// that will result in gNB->configured being set to TRUE.
|
||||
// See we need to wait for that to happen otherwise the NFAPI message exchanges won't contain the right parameter values
|
||||
if (RC.gNB[0]->if_inst==0 || RC.gNB[0]->if_inst->NR_PHY_config_req==0 || RC.gNB[0]->if_inst->NR_Schedule_response==0) {
|
||||
printf("RC.gNB[0][0]->if_inst->NR_PHY_config_req is not installed - install it\n");
|
||||
install_nr_schedule_handlers(RC.gNB[0]->if_inst);
|
||||
}
|
||||
|
||||
do {
|
||||
printf("%s() Waiting for gNB to become configured (by RRC/PHY) - need to wait otherwise NFAPI messages won't contain correct values\n", __FUNCTION__);
|
||||
usleep(50000);
|
||||
} while(gNB->configured != 1);
|
||||
|
||||
printf("%s() gNB is now configured\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
int pnf_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
||||
printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
|
||||
oai_create_enb();
|
||||
@@ -241,6 +279,16 @@ int pnf_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_nr_connection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
||||
printf("[VNF] pnf connection indication idx:%d\n", p5_idx);
|
||||
oai_create_gnb();
|
||||
nfapi_nr_pnf_param_request_t req;
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST;
|
||||
nfapi_nr_vnf_pnf_param_req(config, p5_idx, &req);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_disconnection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
||||
printf("[VNF] pnf disconnection indication idx:%d\n", p5_idx);
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
@@ -251,6 +299,42 @@ int pnf_disconnection_indication_cb(nfapi_vnf_config_t *config, int p5_idx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_param_response_t *resp) {
|
||||
printf("[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
pnf_info *pnf = vnf->pnfs;
|
||||
|
||||
for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i) {
|
||||
phy_info phy;
|
||||
memset(&phy,0,sizeof(phy));
|
||||
phy.index = resp->pnf_phy.phy[i].phy_config_index;
|
||||
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
|
||||
nfapi_vnf_allocate_phy(config, p5_idx, &(phy.id));
|
||||
|
||||
for(int j = 0; j < resp->pnf_phy.phy[i].number_of_rfs; ++j) {
|
||||
printf("[VNF] (PHY:%d) (RF%d) %d\n", i, j, resp->pnf_phy.phy[i].rf_config[j].rf_config_index);
|
||||
phy.rfs[0] = resp->pnf_phy.phy[i].rf_config[j].rf_config_index;
|
||||
}
|
||||
|
||||
pnf->phys[0] = phy;
|
||||
}
|
||||
nfapi_nr_pnf_config_request_t req;
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
|
||||
req.pnf_phy_rf_config.tl.tag = NFAPI_PNF_PHY_RF_TAG;
|
||||
req.pnf_phy_rf_config.number_phy_rf_config_info = 2; // DJP pnf.phys.size();
|
||||
printf("DJP:Hard coded num phy rf to 2\n");
|
||||
|
||||
for(unsigned i = 0; i < 2; ++i) {
|
||||
req.pnf_phy_rf_config.phy_rf_config[i].phy_id = pnf->phys[i].id;
|
||||
req.pnf_phy_rf_config.phy_rf_config[i].phy_config_index = pnf->phys[i].index;
|
||||
req.pnf_phy_rf_config.phy_rf_config[i].rf_config_index = pnf->phys[i].rfs[0];
|
||||
}
|
||||
|
||||
nfapi_nr_vnf_pnf_config_req(config, p5_idx, &req);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_response_t *resp) {
|
||||
printf("[VNF] pnf param response idx:%d error:%d\n", p5_idx, resp->error_code);
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
@@ -270,7 +354,6 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
|
||||
|
||||
pnf->phys[0] = phy;
|
||||
}
|
||||
|
||||
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
|
||||
rf_info rf;
|
||||
memset(&rf,0,sizeof(rf));
|
||||
@@ -278,7 +361,6 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
|
||||
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
|
||||
pnf->rfs[0] = rf;
|
||||
}
|
||||
|
||||
nfapi_pnf_config_request_t req;
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = NFAPI_PNF_CONFIG_REQUEST;
|
||||
@@ -296,6 +378,31 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_nr_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_config_response_t *resp) {
|
||||
printf("[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n", p5_idx, resp->header.phy_id, resp->header.message_id, resp->header.message_length);
|
||||
|
||||
if(1) {
|
||||
nfapi_nr_pnf_start_request_t req;
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.phy_id = resp->header.phy_id;
|
||||
req.header.message_id = NFAPI_PNF_START_REQUEST;
|
||||
nfapi_nr_vnf_pnf_start_req(config, p5_idx, &req);
|
||||
} else {
|
||||
// Rather than send the pnf_start_request we will demonstrate
|
||||
// sending a vendor extention message. The start request will be
|
||||
// send when the vendor extension response is received
|
||||
//vnf_info* vnf = (vnf_info*)(config->user_data);
|
||||
vendor_ext_p5_req req;
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = P5_VENDOR_EXT_REQ;
|
||||
req.dummy1 = 45;
|
||||
req.dummy2 = 1977;
|
||||
nfapi_vnf_vendor_extension(config, p5_idx, &req.header);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_response_t *resp) {
|
||||
printf("[VNF] pnf config response idx:%d resp[header[phy_id:%u message_id:%02x message_length:%u]]\n", p5_idx, resp->header.phy_id, resp->header.message_id, resp->header.message_length);
|
||||
|
||||
@@ -321,6 +428,70 @@ int pnf_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_config_
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot) {
|
||||
struct timespec curr_t;
|
||||
clock_gettime(CLOCK_MONOTONIC,&curr_t);
|
||||
//printf("\n wake_gNB_rxtx before assignment sfn:%d slot:%d TIME %d.%d",sfn,slot,curr_t.tv_sec,curr_t.tv_nsec);
|
||||
gNB_L1_proc_t *proc=&gNB->proc;
|
||||
gNB_L1_rxtx_proc_t *L1_proc= (slot&1)? &proc->L1_proc : &proc->L1_proc_tx;
|
||||
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
//printf("%s(eNB:%p, sfn:%d, sf:%d)\n", __FUNCTION__, eNB, sfn, sf);
|
||||
//int i;
|
||||
struct timespec wait;
|
||||
clock_gettime(CLOCK_REALTIME, &wait);
|
||||
wait.tv_sec = 0;
|
||||
wait.tv_nsec +=5000L;
|
||||
//wait.tv_nsec = 0;
|
||||
// wake up TX for subframe n+sf_ahead
|
||||
// lock the TX mutex and make sure the thread is ready
|
||||
if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) {
|
||||
LOG_E( PHY, "[gNB] ERROR pthread_mutex_lock for gNB RXTX thread %d (IC %d)\n", L1_proc->slot_rx&1,L1_proc->instance_cnt );
|
||||
exit_fun( "error locking mutex_rxtx" );
|
||||
return(-1);
|
||||
}
|
||||
|
||||
{
|
||||
static uint16_t old_slot = 0;
|
||||
static uint16_t old_sfn = 0;
|
||||
proc->slot_rx = old_slot;
|
||||
proc->frame_rx = old_sfn;
|
||||
// Try to be 1 frame back
|
||||
old_slot = slot;
|
||||
old_sfn = sfn;
|
||||
//printf("\n wake_gNB_rxtx after assignment sfn:%d slot:%d",proc->frame_rx,proc->slot_rx);
|
||||
if (old_slot == 0 && old_sfn % 100 == 0) LOG_W( PHY,"[gNB] sfn/slot:%d%d old_sfn/slot:%d%d proc[rx:%d%d]\n", sfn, slot, old_sfn, old_slot, proc->frame_rx, proc->slot_rx);
|
||||
}
|
||||
|
||||
++L1_proc->instance_cnt;
|
||||
//LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d] L1_proc->instance_cnt_rxtx:%d \n", sfn, sf, proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx);
|
||||
// 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+N), so TS_tx = TX_rx+N*samples_per_tti,
|
||||
// and proc->subframe_tx = proc->subframe_rx+sf_ahead
|
||||
L1_proc->timestamp_tx = proc->timestamp_rx + (slot_ahead *fp->samples_per_subframe);
|
||||
L1_proc->frame_rx = proc->frame_rx;
|
||||
L1_proc->slot_rx = proc->slot_rx;
|
||||
L1_proc->frame_tx = (L1_proc->slot_rx > (19-slot_ahead)) ? (L1_proc->frame_rx+1)&1023 : L1_proc->frame_rx;
|
||||
L1_proc->slot_tx = (L1_proc->slot_rx + slot_ahead)%20;
|
||||
|
||||
//LOG_I(PHY, "sfn/sf:%d%d proc[rx:%d%d] rx:%d%d] About to wake rxtx thread\n\n", sfn, slot, proc->frame_rx, proc->slot_rx, L1_proc->frame_rx, L1_proc->slot_rx);
|
||||
//printf("\nEntering wake_gNB_rxtx sfn %d slot %d\n",L1_proc->frame_rx,L1_proc->slot_rx);
|
||||
// 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_clond_signal" );
|
||||
return(-1);
|
||||
}
|
||||
|
||||
//LOG_D(PHY,"%s() About to attempt pthread_mutex_unlock\n", __FUNCTION__);
|
||||
pthread_mutex_unlock( &L1_proc->mutex );
|
||||
//LOG_D(PHY,"%s() UNLOCKED pthread_mutex_unlock\n", __FUNCTION__);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
|
||||
L1_proc_t *proc=&eNB->proc;
|
||||
L1_rxtx_proc_t *L1_proc= (sf&1)? &proc->L1_proc : &proc->L1_proc_tx;
|
||||
@@ -416,6 +587,7 @@ int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) {
|
||||
printf("[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
|
||||
|
||||
if (sync==1 && nfapi_sync_var!=0) {
|
||||
|
||||
printf("[VNF] Signal to OAI main code that it can go\n");
|
||||
pthread_mutex_lock(&nfapi_sync_mutex);
|
||||
nfapi_sync_var=0;
|
||||
@@ -426,6 +598,29 @@ int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn, uint16_t slot) {
|
||||
static uint8_t first_time = 1;
|
||||
|
||||
if (first_time) {
|
||||
printf("[VNF] slot indication %d\n", NFAPI_SFNSLOT2DEC(sfn, slot));
|
||||
first_time = 0;
|
||||
}
|
||||
|
||||
if (RC.gNB && RC.gNB[0]->configured) {
|
||||
// uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
|
||||
// uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
|
||||
LOG_D(PHY,"[VNF] slot indication sfn:%d sf:%d\n", sfn, slot);
|
||||
wake_gNB_rxtx(RC.gNB[0], sfn, slot); // DONE: find NR equivalent
|
||||
} else {
|
||||
printf("[VNF] %s() RC.gNB:%p\n", __FUNCTION__, RC.gNB);
|
||||
|
||||
if (RC.gNB) printf("RC.gNB[0]->configured:%d\n", RC.gNB[0]->configured);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn_sf) {
|
||||
static uint8_t first_time = 1;
|
||||
|
||||
@@ -937,6 +1132,14 @@ int vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_
|
||||
static pthread_t vnf_start_pthread;
|
||||
static pthread_t vnf_p7_start_pthread;
|
||||
|
||||
void *vnf_nr_p7_start_thread(void *ptr) {
|
||||
printf("%s()\n", __FUNCTION__);
|
||||
pthread_setname_np(pthread_self(), "VNF_P7");
|
||||
nfapi_vnf_p7_config_t *config = (nfapi_vnf_p7_config_t *)ptr;
|
||||
nfapi_nr_vnf_p7_start(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
void *vnf_p7_start_thread(void *ptr) {
|
||||
printf("%s()\n", __FUNCTION__);
|
||||
pthread_setname_np(pthread_self(), "VNF_P7");
|
||||
@@ -947,12 +1150,13 @@ void *vnf_p7_start_thread(void *ptr) {
|
||||
|
||||
void set_thread_priority(int priority);
|
||||
|
||||
void *vnf_p7_thread_start(void *ptr) {
|
||||
void *vnf_nr_p7_thread_start(void *ptr) {
|
||||
set_thread_priority(79);
|
||||
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
|
||||
p7_vnf->config->port = p7_vnf->local_port;
|
||||
p7_vnf->config->sync_indication = &phy_sync_indication;
|
||||
p7_vnf->config->subframe_indication = &phy_subframe_indication;
|
||||
p7_vnf->config->slot_indication = &phy_slot_indication;
|
||||
|
||||
p7_vnf->config->harq_indication = &phy_harq_indication;
|
||||
p7_vnf->config->crc_indication = &phy_crc_indication;
|
||||
p7_vnf->config->rx_indication = &phy_rx_indication;
|
||||
@@ -977,11 +1181,72 @@ void *vnf_p7_thread_start(void *ptr) {
|
||||
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
|
||||
p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
|
||||
p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI P7 start thread %s\n", __FUNCTION__);
|
||||
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_nr_p7_start_thread, p7_vnf->config);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *vnf_p7_thread_start(void *ptr) {
|
||||
set_thread_priority(79);
|
||||
vnf_p7_info *p7_vnf = (vnf_p7_info *)ptr;
|
||||
p7_vnf->config->port = p7_vnf->local_port;
|
||||
p7_vnf->config->sync_indication = &phy_sync_indication;
|
||||
p7_vnf->config->subframe_indication = &phy_subframe_indication;
|
||||
p7_vnf->config->slot_indication = &phy_slot_indication;
|
||||
|
||||
p7_vnf->config->harq_indication = &phy_harq_indication;
|
||||
p7_vnf->config->crc_indication = &phy_crc_indication;
|
||||
p7_vnf->config->rx_indication = &phy_rx_indication;
|
||||
p7_vnf->config->rach_indication = &phy_rach_indication;
|
||||
p7_vnf->config->srs_indication = &phy_srs_indication;
|
||||
p7_vnf->config->sr_indication = &phy_sr_indication;
|
||||
p7_vnf->config->cqi_indication = &phy_cqi_indication;
|
||||
p7_vnf->config->lbt_dl_indication = &phy_lbt_dl_indication;
|
||||
p7_vnf->config->nb_harq_indication = &phy_nb_harq_indication;
|
||||
p7_vnf->config->nrach_indication = &phy_nrach_indication;
|
||||
p7_vnf->config->malloc = &vnf_allocate;
|
||||
p7_vnf->config->free = &vnf_deallocate;
|
||||
p7_vnf->config->trace = &vnf_trace;
|
||||
p7_vnf->config->vendor_ext = &phy_vendor_ext;
|
||||
p7_vnf->config->user_data = p7_vnf;
|
||||
p7_vnf->mac->user_data = p7_vnf;
|
||||
p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
|
||||
p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
|
||||
p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
|
||||
p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
|
||||
p7_vnf->config->codec_config.allocate = &vnf_allocate;
|
||||
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
|
||||
p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
|
||||
p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI P7 start thread %s\n", __FUNCTION__);
|
||||
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_p7_start_thread, p7_vnf->config);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_pnf_start_response_t *resp) {
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
||||
pnf_info *pnf = vnf->pnfs;
|
||||
nfapi_nr_param_request_scf_t req;
|
||||
printf("[VNF] pnf start response idx:%d config:%p user_data:%p p7_vnf[config:%p thread_started:%d]\n", p5_idx, config, config->user_data, vnf->p7_vnfs[0].config, vnf->p7_vnfs[0].thread_started);
|
||||
|
||||
if(p7_vnf->thread_started == 0) {
|
||||
pthread_t vnf_p7_thread;
|
||||
pthread_create(&vnf_p7_thread, NULL, &vnf_nr_p7_thread_start, p7_vnf);
|
||||
p7_vnf->thread_started = 1;
|
||||
} else {
|
||||
// P7 thread already running.
|
||||
}
|
||||
|
||||
// start all the phys in the pnf.
|
||||
printf("[VNF] Sending NFAPI_VNF_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST;
|
||||
req.header.phy_id = pnf->phys[0].id;
|
||||
nfapi_nr_vnf_param_req(config, p5_idx, &req);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_response_t *resp) {
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
||||
@@ -998,7 +1263,7 @@ int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_re
|
||||
}
|
||||
|
||||
// start all the phys in the pnf.
|
||||
printf("[VNF] Sending NFAPI_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
|
||||
printf("[VNF] Sending NFAPI_VNF_PARAM_REQUEST phy_id:%d\n", pnf->phys[0].id);
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = NFAPI_PARAM_REQUEST;
|
||||
req.header.phy_id = pnf->phys[0].id;
|
||||
@@ -1008,6 +1273,69 @@ int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_re
|
||||
|
||||
extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw);
|
||||
|
||||
int nr_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_response_scf_t *resp) {
|
||||
|
||||
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
||||
pnf_info *pnf = vnf->pnfs;
|
||||
phy_info *phy = pnf->phys;
|
||||
struct sockaddr_in pnf_p7_sockaddr;
|
||||
nfapi_nr_config_request_scf_t *req = &RC.nrmac[0]->config[0]; // check
|
||||
phy->remote_port = 32123;//resp->nfapi_config.p7_pnf_port.value;
|
||||
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
|
||||
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
|
||||
// for now just 1
|
||||
printf("[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled,
|
||||
p7_vnf->periodic_timing_period);
|
||||
req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST;
|
||||
req->header.phy_id = phy->id;
|
||||
printf("[VNF] Send NFAPI_CONFIG_REQUEST\n");
|
||||
//printf("\n NR bandP =%d\n",req->nfapi_config.rf_bands.rf_band[0]);
|
||||
|
||||
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NR_NFAPI_P7_VNF_PORT_TAG;
|
||||
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
|
||||
req->num_tlv++;
|
||||
printf("[VNF] DJP local_port:%d\n", p7_vnf->local_port);
|
||||
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
|
||||
struct sockaddr_in vnf_p7_sockaddr;
|
||||
vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
|
||||
memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
|
||||
req->num_tlv++;
|
||||
printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
|
||||
req->nfapi_config.timing_window.tl.tag = NFAPI_NR_NFAPI_TIMING_WINDOW_TAG;
|
||||
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
|
||||
printf("\n[VNF]Timing window tag : %d Timing window:%u\n",NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, p7_vnf->timing_window);
|
||||
req->num_tlv++;
|
||||
|
||||
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
|
||||
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG;
|
||||
req->nfapi_config.timing_info_mode.value = (p7_vnf->aperiodic_timing_enabled << 1) | (p7_vnf->periodic_timing_enabled);
|
||||
req->num_tlv++;
|
||||
|
||||
if(p7_vnf->periodic_timing_enabled) {
|
||||
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG;
|
||||
req->nfapi_config.timing_info_period.value = p7_vnf->periodic_timing_period;
|
||||
req->num_tlv++;
|
||||
}
|
||||
}
|
||||
//TODO: Assign tag and value for P7 message offsets
|
||||
req->nfapi_config.dl_tti_timing_offset.tl.tag = NFAPI_NR_NFAPI_DL_TTI_TIMING_OFFSET;
|
||||
req->nfapi_config.ul_tti_timing_offset.tl.tag = NFAPI_NR_NFAPI_UL_TTI_TIMING_OFFSET;
|
||||
req->nfapi_config.ul_dci_timing_offset.tl.tag = NFAPI_NR_NFAPI_UL_DCI_TIMING_OFFSET;
|
||||
req->nfapi_config.tx_data_timing_offset.tl.tag = NFAPI_NR_NFAPI_TX_DATA_TIMING_OFFSET;
|
||||
|
||||
vendor_ext_tlv_2 ve2;
|
||||
memset(&ve2, 0, sizeof(ve2));
|
||||
ve2.tl.tag = VENDOR_EXT_TLV_2_TAG;
|
||||
ve2.dummy = 2016;
|
||||
req->vendor_extension = &ve2.tl;
|
||||
nfapi_nr_vnf_config_req(config, p5_idx, req);
|
||||
printf("[VNF] Sent NFAPI_VNF_CONFIG_REQ num_tlv:%u\n",req->num_tlv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t *resp) {
|
||||
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
@@ -1016,7 +1344,7 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t
|
||||
phy_info *phy = pnf->phys;
|
||||
struct sockaddr_in pnf_p7_sockaddr;
|
||||
nfapi_config_request_t *req = &RC.mac[0]->config[0];
|
||||
phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
|
||||
phy->remote_port = 32123;//resp->nfapi_config.p7_pnf_port.value;
|
||||
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
|
||||
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
|
||||
// for now just 1
|
||||
@@ -1062,6 +1390,19 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nr_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_config_response_scf_t *resp) {
|
||||
nfapi_nr_start_request_scf_t req;
|
||||
printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||
printf("[VNF] Calling oai_enb_init()\n");
|
||||
oai_enb_init(); // TODO: change to gnb
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_REQUEST;
|
||||
req.header.phy_id = resp->header.phy_id;
|
||||
nfapi_nr_vnf_start_req(config, p5_idx, &req);
|
||||
printf("[VNF] Send NFAPI_VNF_START_REQUEST idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response_t *resp) {
|
||||
nfapi_start_request_t req;
|
||||
printf("[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||
@@ -1085,6 +1426,17 @@ int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_response_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_response_scf_t *resp) {
|
||||
printf("[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
pnf_info *pnf = vnf->pnfs;
|
||||
phy_info *phy = pnf->phys;
|
||||
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
|
||||
|
||||
nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, phy->remote_port, phy->id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_header_t *msg) {
|
||||
printf("[VNF] %s\n", __FUNCTION__);
|
||||
|
||||
@@ -1129,6 +1481,13 @@ void vnf_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t *header) {
|
||||
|
||||
nfapi_vnf_config_t *config = 0;
|
||||
|
||||
void vnf_nr_start_thread(void *ptr) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
|
||||
pthread_setname_np(pthread_self(), "VNF");
|
||||
config = (nfapi_vnf_config_t *)ptr;
|
||||
nfapi_nr_vnf_start(config);
|
||||
}
|
||||
|
||||
void vnf_start_thread(void *ptr) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] VNF NFAPI thread - nfapi_vnf_start()%s\n", __FUNCTION__);
|
||||
pthread_setname_np(pthread_self(), "VNF");
|
||||
@@ -1138,7 +1497,57 @@ void vnf_start_thread(void *ptr) {
|
||||
|
||||
static vnf_info vnf;
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
||||
nfapi_setmode(NFAPI_MODE_VNF);
|
||||
memset(&vnf, 0, sizeof(vnf));
|
||||
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
|
||||
vnf.p7_vnfs[0].timing_window = 32;
|
||||
vnf.p7_vnfs[0].periodic_timing_enabled = 1;
|
||||
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
|
||||
vnf.p7_vnfs[0].periodic_timing_period = 10;
|
||||
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
|
||||
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
|
||||
//vnf.p7_vnfs[0].local_port = vnf.p7_vnfs[0].local_port; // 50001; // TODO: remove hardcode
|
||||
vnf.p7_vnfs[0].local_port = 50011;
|
||||
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
|
||||
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
|
||||
config->malloc = malloc;
|
||||
config->free = free;
|
||||
config->trace = &vnf_trace;
|
||||
config->vnf_p5_port = vnf_p5_port;
|
||||
config->vnf_ipv4 = 1;
|
||||
config->vnf_ipv6 = 0;
|
||||
config->pnf_list = 0;
|
||||
config->phy_list = 0;
|
||||
|
||||
config->pnf_nr_connection_indication = &pnf_nr_connection_indication_cb;
|
||||
config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
|
||||
|
||||
config->pnf_nr_param_resp = &pnf_nr_param_resp_cb;
|
||||
config->pnf_nr_config_resp = &pnf_nr_config_resp_cb;
|
||||
config->pnf_nr_start_resp = &pnf_nr_start_resp_cb;
|
||||
config->nr_param_resp = &nr_param_resp_cb;
|
||||
config->nr_config_resp = &nr_config_resp_cb;
|
||||
config->nr_start_resp = &nr_start_resp_cb;
|
||||
config->vendor_ext = &vendor_ext_cb;
|
||||
config->user_data = &vnf;
|
||||
// To allow custom vendor extentions to be added to nfapi
|
||||
config->codec_config.unpack_vendor_extension_tlv = &vnf_unpack_vendor_extension_tlv;
|
||||
config->codec_config.pack_vendor_extension_tlv = &vnf_pack_vendor_extension_tlv;
|
||||
config->codec_config.unpack_p4_p5_vendor_extension = &vnf_unpack_p4_p5_vendor_extension;
|
||||
config->codec_config.pack_p4_p5_vendor_extension = &vnf_pack_p4_p5_vendor_extension;
|
||||
config->allocate_p4_p5_vendor_ext = &vnf_allocate_p4_p5_vendor_ext;
|
||||
config->deallocate_p4_p5_vendor_ext = &vnf_deallocate_p4_p5_vendor_ext;
|
||||
config->codec_config.allocate = &vnf_allocate;
|
||||
config->codec_config.deallocate = &vnf_deallocate;
|
||||
memset(&UL_RCC_INFO,0,sizeof(UL_RCC_IND_t));
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
pthread_create(&vnf_start_pthread, NULL, (void *)&vnf_nr_start_thread, config);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
||||
nfapi_setmode(NFAPI_MODE_VNF);
|
||||
memset(&vnf, 0, sizeof(vnf));
|
||||
@@ -1150,7 +1559,8 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
||||
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
|
||||
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
|
||||
vnf.p7_vnfs[0].local_port = 50001;
|
||||
//vnf.p7_vnfs[0].local_port = vnf.p7_vnfs[0].local_port; // 50001; // TODO: remove hardcode
|
||||
vnf.p7_vnfs[0].local_port = 50011;
|
||||
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
|
||||
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
|
||||
config->malloc = malloc;
|
||||
@@ -1161,8 +1571,10 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
|
||||
config->vnf_ipv6 = 0;
|
||||
config->pnf_list = 0;
|
||||
config->phy_list = 0;
|
||||
|
||||
config->pnf_connection_indication = &pnf_connection_indication_cb;
|
||||
config->pnf_disconnect_indication = &pnf_disconnection_indication_cb;
|
||||
|
||||
config->pnf_param_resp = &pnf_param_resp_cb;
|
||||
config->pnf_config_resp = &pnf_config_resp_cb;
|
||||
config->pnf_start_resp = &pnf_start_resp_cb;
|
||||
@@ -1203,15 +1615,17 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
{
|
||||
//LOG_I(PHY, "sfn:%d,slot:%d\n",dl_config_req->SFN,dl_config_req->Slot);
|
||||
//printf("\nEntering oai_nfapi_nr_dl_config_req sfn:%d,slot:%d\n",dl_config_req->SFN,dl_config_req->Slot);
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
|
||||
dl_config_req->header.message_id= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
|
||||
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
|
||||
int retval = nfapi_vnf_p7_nr_dl_config_req(p7_config, dl_config_req);
|
||||
|
||||
dl_config_req->dl_tti_request_body.nPDUs = 0;
|
||||
dl_config_req->dl_tti_request_body.nPDUs = 0;
|
||||
dl_config_req->dl_tti_request_body.nGroup = 0;
|
||||
|
||||
|
||||
@@ -1221,6 +1635,23 @@ int oai_nfapi_nr_dl_config_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
return retval;
|
||||
}
|
||||
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
|
||||
{
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
tx_data_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
|
||||
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
|
||||
int retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
|
||||
|
||||
if (retval!=0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
} else {
|
||||
tx_data_req->Number_of_PDUs = 0;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
|
||||
{
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
@@ -1238,6 +1669,22 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
|
||||
return retval;
|
||||
}
|
||||
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
ul_dci_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
ul_dci_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST;
|
||||
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
|
||||
int retval = nfapi_vnf_p7_ul_dci_req(p7_config, ul_dci_req);
|
||||
|
||||
if (retval!=0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
} else {
|
||||
ul_dci_req->numPdus = 0;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
@@ -1255,6 +1702,26 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
|
||||
ul_tti_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
ul_tti_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST;
|
||||
|
||||
int retval = nfapi_vnf_p7_ul_tti_req(p7_config, ul_tti_req);
|
||||
|
||||
if (retval!=0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
} else {
|
||||
// Reset number of PDUs so that it is not resent
|
||||
ul_tti_req->n_pdus = 0;
|
||||
ul_tti_req->n_group = 0;
|
||||
ul_tti_req->n_ulcch = 0;
|
||||
ul_tti_req->n_ulsch = 0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
|
||||
@@ -23,5 +23,5 @@
|
||||
#define NFAPI_VNF_H__
|
||||
|
||||
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
|
||||
|
||||
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port);
|
||||
#endif
|
||||
|
||||
@@ -120,6 +120,17 @@ typedef struct {
|
||||
} nfapi_tl_t;
|
||||
#define NFAPI_TAG_LENGTH_PACKED_LEN 4
|
||||
|
||||
// Convenience methods to convert between SFN/SLOT formats
|
||||
#define NFAPI_SFNSLOT2DEC(_sfn,_slot) ( _sfn*20 + _slot ) // total count of slots
|
||||
#define NFAPI_SFNSLOTDEC2SFNSLOT(_sfnslot_dec) ((((_sfnslot_dec) / 20) << 4) | (((_sfnslot_dec) - (((_sfnslot_dec) / 20) * 10)) & 0x3F))
|
||||
|
||||
#define NFAPI_SFNSLOT2SFN(_sfnslot) ((_sfnslot) >> 6)
|
||||
#define NFAPI_SFNSLOT2SLOT(_sfnslot) ((_sfnslot) & 0x3F)
|
||||
#define NFAPI_SFNSLOTDEC2SFN(_sfnslot_dec) ((_sfnslot_dec) / 20)
|
||||
#define NFAPI_SFNSLOTDEC2SLOT(_sfnslot_dec) ((_sfnslot_dec) % 20)
|
||||
|
||||
#define NFAPI_MAX_SFNSLOTDEC 1024*20 // 20 is for numerology 1
|
||||
|
||||
// Convenience methods to convert between SFN/SFN formats
|
||||
#define NFAPI_SFNSF2DEC(_sfnsf) ((((_sfnsf) >> 4) * 10) + ((_sfnsf) & 0xF))
|
||||
#define NFAPI_SFNSFDEC2SFNSF(_sfnsf_dec) ((((_sfnsf_dec) / 10) << 4) | (((_sfnsf_dec) - (((_sfnsf_dec) / 10) * 10)) & 0xF))
|
||||
@@ -176,7 +187,6 @@ typedef enum {
|
||||
NFAPI_DL_NODE_SYNC,
|
||||
NFAPI_TIMING_INFO,
|
||||
|
||||
|
||||
NFAPI_RSSI_REQUEST = 0x0200,
|
||||
NFAPI_RSSI_RESPONSE,
|
||||
NFAPI_RSSI_INDICATION,
|
||||
@@ -587,6 +597,26 @@ typedef struct {
|
||||
#define NFAPI_PNF_PHY_RF_TAG 0x1003
|
||||
|
||||
// Generic strucutre for single tlv value.
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
int32_t value;
|
||||
} nfapi_int32_tlv_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint32_t value;
|
||||
} nfapi_uint32_tlv_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
int64_t value;
|
||||
} nfapi_int64_tlv_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint64_t value;
|
||||
} nfapi_uint64_tlv_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t value;
|
||||
@@ -1106,6 +1136,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint8_t num_tlvs;
|
||||
nfapi_pnf_phy_rf_config_t pnf_phy_rf_config;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_pnf_config_request_t;
|
||||
@@ -2466,7 +2497,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint32_t t1;
|
||||
int32_t delta_sfn_sf;
|
||||
int32_t delta_sfn_sf;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_dl_node_sync_t;
|
||||
|
||||
@@ -2481,22 +2512,50 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint32_t last_sfn_sf;
|
||||
|
||||
uint32_t time_since_last_timing_info;
|
||||
uint32_t dl_config_jitter;
|
||||
uint32_t tx_request_jitter;
|
||||
uint32_t ul_config_jitter;
|
||||
uint32_t hi_dci0_jitter;
|
||||
|
||||
int32_t dl_config_latest_delay;
|
||||
int32_t tx_request_latest_delay;
|
||||
int32_t ul_config_latest_delay;
|
||||
int32_t hi_dci0_latest_delay;
|
||||
|
||||
int32_t dl_config_earliest_arrival;
|
||||
int32_t tx_request_earliest_arrival;
|
||||
int32_t ul_config_earliest_arrival;
|
||||
int32_t hi_dci0_earliest_arrival;
|
||||
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_timing_info_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
|
||||
uint32_t last_sfn;
|
||||
uint32_t last_slot;
|
||||
uint32_t time_since_last_timing_info;
|
||||
|
||||
uint32_t dl_tti_jitter;
|
||||
uint32_t tx_data_request_jitter;
|
||||
uint32_t ul_tti_jitter;
|
||||
uint32_t ul_dci_jitter;
|
||||
|
||||
int32_t dl_tti_latest_delay;
|
||||
int32_t tx_data_request_latest_delay;
|
||||
int32_t ul_tti_latest_delay;
|
||||
int32_t ul_dci_latest_delay;
|
||||
|
||||
int32_t dl_tti_earliest_arrival;
|
||||
int32_t tx_data_request_earliest_arrival;
|
||||
int32_t ul_tti_earliest_arrival;
|
||||
int32_t ul_dci_earliest_arrival;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_timing_info_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint32_t handle;
|
||||
@@ -3653,6 +3712,50 @@ typedef struct {
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nmm_stop_response_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// TODO: see if this needs to be uncommented
|
||||
|
||||
// These TLVs are used to setup the transport connection between VNF and PNF
|
||||
nfapi_ipv4_address_t p7_vnf_address_ipv4;
|
||||
nfapi_ipv6_address_t p7_vnf_address_ipv6;
|
||||
nfapi_uint16_tlv_t p7_vnf_port;
|
||||
|
||||
nfapi_ipv4_address_t p7_pnf_address_ipv4;
|
||||
nfapi_ipv6_address_t p7_pnf_address_ipv6;
|
||||
nfapi_uint16_tlv_t p7_pnf_port;
|
||||
|
||||
nfapi_uint8_tlv_t timing_window; //Value: 0 → 30,000 microseconds
|
||||
nfapi_uint8_tlv_t timing_info_mode;
|
||||
nfapi_uint8_tlv_t timing_info_period;
|
||||
|
||||
nfapi_uint32_tlv_t dl_tti_timing_offset;
|
||||
nfapi_uint32_tlv_t ul_tti_timing_offset;
|
||||
nfapi_uint32_tlv_t ul_dci_timing_offset;
|
||||
nfapi_uint32_tlv_t tx_data_timing_offset;
|
||||
|
||||
// These TLVs are used to setup the transport connection between VNF and PNF
|
||||
/*
|
||||
nfapi_uint8_tlv_t dl_ue_per_sf;
|
||||
nfapi_uint8_tlv_t ul_ue_per_sf;
|
||||
|
||||
// These TLVs are used by PNF to report its RF capabilities to the VNF software
|
||||
nfapi_rf_bands_t rf_bands;
|
||||
*/
|
||||
// These TLVs are used by the VNF to configure the synchronization with the PNF.
|
||||
|
||||
|
||||
// These TLVs are used by the VNF to configure the RF in the PNF
|
||||
//nfapi_uint16_tlv_t max_transmit_power;
|
||||
//nfapi_uint32_tlv_t nrarfcn;
|
||||
|
||||
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
|
||||
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
|
||||
// nfapi_nmm_frequency_bands_t nmm_lte_frequency_bands;
|
||||
// nfapi_uint8_tlv_t nmm_uplink_rssi_supported;
|
||||
|
||||
} nfapi_nr_nfapi_t;
|
||||
|
||||
//
|
||||
// Configuration options for the encode decode functions
|
||||
//
|
||||
@@ -3864,6 +3967,7 @@ int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
*
|
||||
*/
|
||||
int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
int nfapi_nr_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
|
||||
/*! \brief Decodes an NFAPI P5 message header
|
||||
* \param pMessageBuf A pointer to an encoded P5 message header
|
||||
@@ -3887,6 +3991,7 @@ int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
||||
*
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_nr_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config);
|
||||
|
||||
/*! \brief Encodes an NFAPI P7 message to a buffer
|
||||
@@ -3900,6 +4005,7 @@ int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
*
|
||||
*/
|
||||
int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
||||
int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
||||
|
||||
/*! \brief Decodes an NFAPI P7 message header
|
||||
* \param pMessageBuf A pointer to an encoded P7 message header
|
||||
@@ -3925,6 +4031,7 @@ int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, vo
|
||||
* The function will decode a byte stream pointed to by pMessageBuf into a nfapi p7 message structure pointer to by pUnpackedBuf
|
||||
*/
|
||||
int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config);
|
||||
int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config);
|
||||
|
||||
/*! \brief Calculates the checksum of a message
|
||||
*
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define _NFAPI_NR_INTERFACE_H_
|
||||
|
||||
#include "nfapi_interface.h"
|
||||
#include <nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h>
|
||||
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
|
||||
|
||||
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
|
||||
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
|
||||
@@ -22,62 +22,32 @@
|
||||
// nFAPI enums
|
||||
|
||||
|
||||
|
||||
//These TLVs are used exclusively by nFAPI
|
||||
typedef struct
|
||||
{
|
||||
// These TLVs are used to setup the transport connection between VNF and PNF
|
||||
// nfapi_ipv4_address_t p7_vnf_address_ipv4;
|
||||
// nfapi_ipv6_address_t p7_vnf_address_ipv6;
|
||||
// nfapi_uint16_tlv_t p7_vnf_port;
|
||||
|
||||
// nfapi_ipv4_address_t p7_pnf_address_ipv4;
|
||||
// nfapi_ipv6_address_t p7_pnf_address_ipv6;
|
||||
// nfapi_uint16_tlv_t p7_pnf_port;
|
||||
|
||||
// // These TLVs are used to setup the transport connection between VNF and PNF
|
||||
// nfapi_uint8_tlv_t dl_ue_per_sf;
|
||||
// nfapi_uint8_tlv_t ul_ue_per_sf;
|
||||
|
||||
// These TLVs are used by PNF to report its RF capabilities to the VNF software
|
||||
nfapi_rf_bands_t rf_bands;
|
||||
|
||||
// These TLVs are used by the VNF to configure the synchronization with the PNF.
|
||||
// nfapi_uint8_tlv_t timing_window;
|
||||
// nfapi_uint8_tlv_t timing_info_mode;
|
||||
// nfapi_uint8_tlv_t timing_info_period;
|
||||
|
||||
// These TLVs are used by the VNF to configure the RF in the PNF
|
||||
// nfapi_uint16_tlv_t max_transmit_power;
|
||||
nfapi_uint32_tlv_t nrarfcn;
|
||||
|
||||
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
|
||||
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
|
||||
// nfapi_nmm_frequency_bands_t nmm_lte_frequency_bands;
|
||||
// nfapi_uint8_tlv_t nmm_uplink_rssi_supported;
|
||||
|
||||
} nfapi_nr_nfapi_t;
|
||||
|
||||
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x5100
|
||||
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x5101
|
||||
#define NFAPI_NR_NFAPI_P7_VNF_PORT_TAG 0x5102
|
||||
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG 0x5103
|
||||
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG 0x5104
|
||||
#define NFAPI_NR_NFAPI_P7_PNF_PORT_TAG 0x5105
|
||||
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x0100
|
||||
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x0101
|
||||
#define NFAPI_NR_NFAPI_P7_VNF_PORT_TAG 0x0102
|
||||
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG 0x0103
|
||||
#define NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG 0x0104
|
||||
#define NFAPI_NR_NFAPI_P7_PNF_PORT_TAG 0x0105
|
||||
#define NFAPI_NR_NFAPI_DL_TTI_TIMING_OFFSET 0x0106
|
||||
#define NFAPI_NR_NFAPI_UL_TTI_TIMING_OFFSET 0x0107
|
||||
#define NFAPI_NR_NFAPI_UL_DCI_TIMING_OFFSET 0x0108
|
||||
#define NFAPI_NR_NFAPI_TX_DATA_TIMING_OFFSET 0x0109
|
||||
#define NFAPI_NR_NFAPI_TIMING_WINDOW_TAG 0x011E
|
||||
#define NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG 0x011F
|
||||
#define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x0120
|
||||
|
||||
/*
|
||||
#define NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG 0x510A
|
||||
#define NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG 0x510B
|
||||
#define NFAPI_NR_NFAPI_RF_BANDS_TAG 0x5114
|
||||
#define NFAPI_NR_NFAPI_TIMING_WINDOW_TAG 0x511E
|
||||
#define NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG 0x511F
|
||||
#define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x5120
|
||||
#define NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG 0x5128
|
||||
#define NFAPI_NR_NFAPI_NRARFCN_TAG 0x5129
|
||||
#define NFAPI_NR_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG 0x5130
|
||||
#define NFAPI_NR_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG 0x5131
|
||||
#define NFAPI_NR_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG 0x5132
|
||||
#define NFAPI_NR_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG 0x5133
|
||||
|
||||
*/
|
||||
// P5 Message Structures
|
||||
|
||||
typedef struct {
|
||||
@@ -323,7 +293,7 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED=0,
|
||||
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED
|
||||
NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED=1
|
||||
} nfapi_nr_cce_reg_mapping_type_e;
|
||||
|
||||
typedef enum {
|
||||
|
||||
Binary file not shown.
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "stddef.h"
|
||||
#include "nfapi_interface.h"
|
||||
#include "nfapi_nr_interface.h"
|
||||
|
||||
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
|
||||
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
|
||||
@@ -24,25 +25,7 @@
|
||||
#define NFAPI_MAX_NUM_CB 8
|
||||
|
||||
// Extension to the generic structures for single tlv values
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
int32_t value;
|
||||
} nfapi_int32_tlv_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint32_t value;
|
||||
} nfapi_uint32_tlv_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
int64_t value;
|
||||
} nfapi_int64_tlv_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint64_t value;
|
||||
} nfapi_uint64_tlv_t;
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_DMRS_TYPE1=0,
|
||||
@@ -76,35 +59,42 @@ typedef enum {
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST= 0X05,
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION=0X06,
|
||||
NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION=0X07,
|
||||
NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE=0X010D,
|
||||
NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE=0X010F,
|
||||
//RESERVED 0X08 ~ 0X7F
|
||||
NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST= 0X80,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST= 0X81,
|
||||
NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION=0X82,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST= 0X83,
|
||||
NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST=0X54,
|
||||
NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST=0X84, // CHANGED TO 0X84
|
||||
NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION=0X85,
|
||||
NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION= 0X86,
|
||||
NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION= 0X87,
|
||||
NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION= 0X88,
|
||||
NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89
|
||||
NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89,
|
||||
//RESERVED 0X8a ~ 0xff
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST = 0x0100,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE = 0x0101,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST= 0x0102,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE= 0x0103,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST= 0x0104,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE= 0x0105,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST= 0x0106,
|
||||
NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE= 0x0107,
|
||||
|
||||
NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC = 0x0180,
|
||||
NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC,
|
||||
NFAPI_NR_PHY_MSG_TYPE_TIMING_INFO
|
||||
} nfapi_nr_phy_msg_type_e;
|
||||
|
||||
// SCF222_5G-FAPI_PHY_SPI_Specificayion.pdf Section 3.3
|
||||
|
||||
//3.3.1 PARAM
|
||||
|
||||
|
||||
|
||||
//same with nfapi_param_request_t
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_param_request_t;
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_PARAM_MSG_OK = 0,
|
||||
NFAPI_NR_PARAM_MSG_INVALID_STATE
|
||||
|
||||
} nfapi_nr_param_errors_e;
|
||||
|
||||
/*typedef struct {
|
||||
nfapi_nr_param_errors_e error_code;
|
||||
@@ -278,12 +268,6 @@ typedef struct
|
||||
//-------------------------------------------//
|
||||
//3.3.2 CONFIG
|
||||
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_CONFIG_MSG_OK = 0,
|
||||
NFAPI_NR_CONFIG_MSG_INVALID_CONFIG //The configuration provided has missing mandatory TLVs, or TLVs that are invalid or unsupported in this state.
|
||||
} nfapi_nr_config_errors_e;
|
||||
|
||||
/*typedef struct {
|
||||
nfapi_nr_config_errors_e error_code;
|
||||
uint8_t number_of_invalid_tlvs_that_can_only_be_configured_in_idle;
|
||||
@@ -465,9 +449,108 @@ typedef struct
|
||||
|
||||
} nfapi_nr_measurement_config_t;
|
||||
|
||||
// ERROR enums
|
||||
typedef enum { // Table 2-22
|
||||
NFAPI_NR_PARAM_MSG_OK = 0,
|
||||
NFAPI_NR_PARAM_MSG_INVALID_STATE
|
||||
} nfapi_nr_param_errors_e;
|
||||
|
||||
typedef enum { // Table 2-25
|
||||
NFAPI_NR_CONFIG_MSG_OK = 0,
|
||||
NFAPI_NR_CONFIG_MSG_INVALID_STATE, //The CONFIG.request was received when the PHY was not in the IDLE state or the CONFIGURED state.
|
||||
NFAPI_NR_CONFIG_MSG_INVALID_CONFIG //The configuration provided has missing mandatory TLVs, or TLVs that are invalid or unsupported in this state.
|
||||
} nfapi_nr_config_errors_e;
|
||||
|
||||
typedef enum { // Table 2-27
|
||||
NFAPI_NR_START_MSG_OK = 0,
|
||||
NFAPI_NR_START_MSG_INVALID_STATE
|
||||
} nfapi_nr_start_errors_e;
|
||||
|
||||
//PNF P5 NR
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_param_request_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t num_tlv;
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint32_t error_code;
|
||||
nfapi_pnf_param_general_t pnf_param_general;
|
||||
nfapi_pnf_phy_t pnf_phy;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_param_response_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint8_t num_tlvs;
|
||||
nfapi_pnf_phy_rf_config_t pnf_phy_rf_config;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_config_request_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint32_t error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_config_response_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_start_request_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint32_t error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_start_response_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_stop_request_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint32_t error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_pnf_stop_response_t;
|
||||
|
||||
|
||||
/* PARAM.REQUEST */
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_param_request_scf_t;
|
||||
|
||||
/* PARAM.RESPONSE */
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint8_t error_code;
|
||||
|
||||
uint8_t num_tlv;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
|
||||
nfapi_nr_cell_param_t cell_param;
|
||||
nfapi_nr_carrier_param_t carrier_param;
|
||||
nfapi_nr_pdcch_param_t pdcch_param;
|
||||
nfapi_nr_pucch_param_t pucch_param;
|
||||
nfapi_nr_pdsch_param_t pdsch_param;
|
||||
nfapi_nr_pusch_param_t pusch_param;
|
||||
nfapi_nr_prach_param_t prach_param;
|
||||
nfapi_nr_measurement_param_t measurement_param;
|
||||
nfapi_nr_nfapi_t nfapi_config;
|
||||
} nfapi_nr_param_response_scf_t;
|
||||
|
||||
//------------------------------//
|
||||
//3.3.2 CONFIG
|
||||
|
||||
/* CONFIG.REQUEST */
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
|
||||
uint8_t num_tlv;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
|
||||
nfapi_nr_carrier_config_t carrier_config;
|
||||
nfapi_nr_cell_config_t cell_config;
|
||||
nfapi_nr_ssb_config_t ssb_config;
|
||||
@@ -475,20 +558,32 @@ typedef struct {
|
||||
nfapi_nr_ssb_table_t ssb_table;
|
||||
nfapi_nr_tdd_table_t tdd_table;
|
||||
nfapi_nr_measurement_config_t measurement_config;
|
||||
nfapi_nr_nfapi_t nfapi_config;
|
||||
} nfapi_nr_config_request_scf_t;
|
||||
|
||||
|
||||
/* CONFIG.RESPONSE */
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
uint8_t error_code;
|
||||
//uint8_t num_invalid_tlvs;
|
||||
// TODO: add list of invalid/unsupported TLVs (see Table 3.18)
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_config_response_scf_t;
|
||||
|
||||
//------------------------------//
|
||||
//3.3.3 START
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_start_request_t;
|
||||
} nfapi_nr_start_request_scf_t;
|
||||
|
||||
typedef enum {
|
||||
NFAPI_NR_START_MSG_INVALID_STATE
|
||||
} nfapi_nr_start_errors_e;
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_nr_start_errors_e error_code;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_start_response_scf_t;
|
||||
|
||||
//3.3.4 STOP
|
||||
|
||||
@@ -497,6 +592,7 @@ typedef struct {
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_stop_request_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
@@ -580,7 +676,7 @@ typedef struct {
|
||||
uint16_t sfn; //0->1023
|
||||
uint16_t slot;//0->319
|
||||
|
||||
} nfapi_nr_slot_indication_t;
|
||||
} nfapi_nr_slot_indication_scf_t;
|
||||
|
||||
// 3.4.2
|
||||
|
||||
@@ -619,8 +715,10 @@ typedef struct {
|
||||
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];
|
||||
uint16_t *beamIdx[275];
|
||||
// Depends on digBFInterfaces
|
||||
uint16_t beamIdx[256];
|
||||
} nfapi_nr_tx_precoding_and_beamforming_t;
|
||||
|
||||
//table 3-37
|
||||
@@ -941,6 +1039,7 @@ typedef struct {
|
||||
} nfapi_nr_dl_tti_request_pdu_t;
|
||||
|
||||
#define NFAPI_NR_MAX_DL_TTI_PDUS 32
|
||||
|
||||
typedef struct {
|
||||
/// Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
|
||||
uint8_t nPDUs;
|
||||
@@ -954,11 +1053,28 @@ typedef struct {
|
||||
uint8_t PduIdx[256][12];
|
||||
} nfapi_nr_dl_tti_request_body_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint32_t t1;
|
||||
int32_t delta_sfn_slot;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_dl_node_sync_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint32_t t1;
|
||||
uint32_t t2;
|
||||
uint32_t t3;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_nr_ul_node_sync_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
/// System Frame Number (0-1023)
|
||||
uint16_t SFN;
|
||||
/// Slot number (0-319)
|
||||
/// Slot number (0-19)
|
||||
uint16_t Slot;
|
||||
nfapi_nr_dl_tti_request_body_t dl_tti_request_body;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
@@ -973,7 +1089,7 @@ typedef struct
|
||||
nfapi_nr_dl_tti_ssb_pdu_t* ssb_pdu;
|
||||
} nfapi_nr_dl_pdu_configuration_t;
|
||||
*/
|
||||
/*
|
||||
/*
|
||||
typedef struct
|
||||
{
|
||||
uint16_t pdu_type;//0: PDCCH PDU 1: PDSCH PDU 2: CSI-RS PDU 3: SSB PDU,
|
||||
@@ -1272,6 +1388,7 @@ typedef struct
|
||||
} nfapi_nr_ul_tti_request_number_of_groups_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint16_t SFN; //0->1023
|
||||
uint16_t Slot;//0->319
|
||||
uint8_t n_pdus;//Number of PDUs that are included in this message. All PDUs in the message are numbered in order. Value 0 -> 255
|
||||
@@ -1318,6 +1435,7 @@ typedef struct {
|
||||
} nfapi_nr_ul_dci_request_pdus_t;
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint16_t SFN;
|
||||
uint16_t Slot;
|
||||
uint8_t numPdus;
|
||||
@@ -1363,6 +1481,7 @@ typedef struct
|
||||
#define NFAPI_NR_MAX_TX_REQUEST_PDUS 16
|
||||
typedef struct
|
||||
{
|
||||
nfapi_p7_message_header_t header;
|
||||
uint16_t SFN;
|
||||
uint16_t Slot;
|
||||
uint16_t Number_of_PDUs;
|
||||
|
||||
@@ -712,7 +712,7 @@ int unpack_tlv_list(unpack_tlv_t unpack_fns[], uint16_t size, uint8_t **ppReadPa
|
||||
|
||||
for(idx = 0; idx < size; ++idx)
|
||||
{
|
||||
if(unpack_fns[idx].tag == generic_tl.tag)
|
||||
if(unpack_fns[idx].tag == generic_tl.tag) // match the extracted tag value with all the tags in unpack_fn list
|
||||
{
|
||||
tagMatch = 1;
|
||||
nfapi_tl_t* tl = (nfapi_tl_t*)(unpack_fns[idx].tlv);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+2135
-187
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,9 @@ typedef struct {
|
||||
|
||||
int pnf_connect(pnf_t *pnf);
|
||||
int pnf_message_pump(pnf_t *pnf);
|
||||
int pnf_nr_message_pump(pnf_t *pnf);
|
||||
|
||||
int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
|
||||
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
|
||||
int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len);
|
||||
int pnf_send_message(pnf_t* pnf, uint8_t* msg, uint32_t msg_len, uint16_t stream_id);
|
||||
|
||||
@@ -29,15 +29,37 @@
|
||||
|
||||
typedef struct {
|
||||
uint16_t dl_conf_ontime;
|
||||
uint16_t dl_tti_ontime;
|
||||
uint16_t dl_conf_late;
|
||||
uint16_t dl_tti_late;
|
||||
uint16_t ul_conf_ontime;
|
||||
uint16_t ul_tti_ontime;
|
||||
uint16_t ul_conf_late;
|
||||
uint16_t ul_tti_late;
|
||||
uint16_t hi_dci0_ontime;
|
||||
uint16_t hi_dci0_late;
|
||||
uint16_t ul_dci_ontime;
|
||||
uint16_t ul_dci_late;
|
||||
uint16_t tx_ontime;
|
||||
uint16_t tx_late;
|
||||
uint16_t tx_data_ontime;
|
||||
uint16_t tx_data_late;
|
||||
} pnf_p7_stats_t;
|
||||
|
||||
|
||||
typedef struct { // TODO: replace with the stats
|
||||
uint16_t dl_tti_ontime;
|
||||
uint16_t dl_tti_late;
|
||||
uint16_t ul_tti_ontime;
|
||||
uint16_t ul_tti_late;
|
||||
uint16_t ul_dci_ontime;
|
||||
uint16_t ul_dci_late;
|
||||
uint16_t tx_data_ontime;
|
||||
uint16_t tx_data_late;
|
||||
} pnf_p7_nr_stats_t;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t* buffer;
|
||||
uint16_t length;
|
||||
@@ -82,7 +104,7 @@ typedef struct {
|
||||
pthread_mutex_t pack_mutex; // should we allow the client to specifiy
|
||||
|
||||
nfapi_pnf_p7_subframe_buffer_t subframe_buffer[30/*NFAPI_MAX_TIMING_WINDOW_SIZE*/];
|
||||
|
||||
nfapi_pnf_p7_slot_buffer_t slot_buffer[30/*NFAPI_MAX_TIMING_WINDOW_SIZE*/];
|
||||
uint32_t sequence_number;
|
||||
uint16_t max_num_segments;
|
||||
|
||||
@@ -94,6 +116,12 @@ typedef struct {
|
||||
uint16_t sfn_sf;
|
||||
uint32_t sf_start_time_hr;
|
||||
int32_t sfn_sf_shift;
|
||||
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint16_t sfn_slot;
|
||||
uint32_t slot_start_time_hr;
|
||||
int32_t slot_shift;
|
||||
|
||||
uint8_t timing_info_period_counter;
|
||||
uint8_t timing_info_aperiodic_send; // 0:false 1:true
|
||||
@@ -104,18 +132,26 @@ typedef struct {
|
||||
uint32_t ul_config_jitter;
|
||||
uint32_t hi_dci0_jitter;
|
||||
uint32_t tx_jitter;
|
||||
|
||||
//P7 NR
|
||||
uint32_t dl_tti_jitter;
|
||||
uint32_t ul_tti_jitter;
|
||||
uint32_t ul_dci_jitter;
|
||||
uint32_t tx_data_jitter;
|
||||
|
||||
uint32_t tick;
|
||||
pnf_p7_stats_t stats;
|
||||
pnf_p7_nr_stats_t nr_stats;
|
||||
|
||||
} pnf_p7_t;
|
||||
|
||||
int pnf_p7_message_pump(pnf_p7_t* pnf_p7);
|
||||
|
||||
int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7);
|
||||
int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* msg, uint32_t msg_len);
|
||||
int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t msg_len);
|
||||
|
||||
|
||||
int pnf_p7_slot_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
|
||||
int pnf_p7_subframe_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn_sf);
|
||||
|
||||
pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len);
|
||||
|
||||
@@ -25,8 +25,14 @@ extern "C" {
|
||||
#include "nfapi_interface.h"
|
||||
#include "debug.h"
|
||||
#include <openair2/PHY_INTERFACE/IF_Module.h>
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "openair1/PHY/defs_gNB.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/*! This enum is used to describe the states of the pnf
|
||||
*/
|
||||
@@ -121,6 +127,7 @@ typedef struct nfapi_pnf_config
|
||||
* The client is expected to send the PNF_PARAM.response after receiving the
|
||||
* PNF_PARAM.request. This can be done in the call back.
|
||||
*/
|
||||
int (*pnf_nr_param_req)(nfapi_pnf_config_t* config, nfapi_nr_pnf_param_request_t* req);
|
||||
int (*pnf_param_req)(nfapi_pnf_config_t* config, nfapi_pnf_param_request_t* req);
|
||||
|
||||
/*! A callback for the PNF_CONFIG.request
|
||||
@@ -133,7 +140,8 @@ typedef struct nfapi_pnf_config
|
||||
* PNF_CONFIG.request. This can be done in the call back.
|
||||
*/
|
||||
int (*pnf_config_req)(nfapi_pnf_config_t* config, nfapi_pnf_config_request_t* req);
|
||||
|
||||
int (*pnf_nr_config_req)(nfapi_pnf_config_t* config, nfapi_nr_pnf_config_request_t* req);
|
||||
|
||||
/*! A callback for the PNF_START.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
* \param req A data structure for the decoded PNF_CONFIG.request. This will have
|
||||
@@ -144,7 +152,8 @@ typedef struct nfapi_pnf_config
|
||||
* PNF_START.request. This can be done in the call back.
|
||||
*/
|
||||
int (*pnf_start_req)(nfapi_pnf_config_t* config, nfapi_pnf_start_request_t* req);
|
||||
|
||||
int (*pnf_nr_start_req)(nfapi_pnf_config_t* config, nfapi_nr_pnf_start_request_t* req);
|
||||
|
||||
/*! A callback for the PNF_STOP.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
* \param req A data structure for the decoded PNF_STOP.request. This will have
|
||||
@@ -167,7 +176,8 @@ typedef struct nfapi_pnf_config
|
||||
* PARAM.request. This can be done in the call back.
|
||||
*/
|
||||
int (*param_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req);
|
||||
|
||||
int (*nr_param_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_param_request_scf_t* req);
|
||||
|
||||
/*! A callback for the CONFIG.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
* \param phy A pointer to the pnf phy configuration
|
||||
@@ -179,6 +189,7 @@ typedef struct nfapi_pnf_config
|
||||
* CONFIG.request. This can be done in the call back.
|
||||
*/
|
||||
int (*config_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req);
|
||||
int (*nr_config_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_config_request_scf_t* req);
|
||||
|
||||
/*! A callback for the START.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
@@ -190,8 +201,8 @@ typedef struct nfapi_pnf_config
|
||||
* The client is expected to send the START.response after the client has received the
|
||||
* first subframe indication from FAPI.
|
||||
*/
|
||||
int (*start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req);
|
||||
|
||||
int (*start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_start_request_t* req);
|
||||
int (*nr_start_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_start_request_scf_t* req);
|
||||
/*! A callback for the STOP.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
* \param phy A pointer to the pnf phy configuration
|
||||
@@ -203,7 +214,8 @@ typedef struct nfapi_pnf_config
|
||||
* STOP.request. This can be done in the call back.
|
||||
*/
|
||||
int (*stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_stop_request_t* req);
|
||||
|
||||
int (*nr_stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_stop_request_t* req);
|
||||
|
||||
/*! A callback for the MEASUREMENT.request
|
||||
* \param config A pointer to the pnf configuration
|
||||
* \param phy A pointer to the pnf phy configuration
|
||||
@@ -355,6 +367,7 @@ int nfapi_pnf_config_destroy(nfapi_pnf_config_t* config);
|
||||
* \endcode
|
||||
*/
|
||||
int nfapi_pnf_start(nfapi_pnf_config_t* config);
|
||||
int nfapi_nr_pnf_start(nfapi_pnf_config_t* config);
|
||||
|
||||
/*! Stop the PNF library.
|
||||
* \param config A pointer to the pnf configuration
|
||||
@@ -371,6 +384,8 @@ int nfapi_pnf_stop(nfapi_pnf_config_t* config);
|
||||
*
|
||||
*/
|
||||
int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp);
|
||||
int nfapi_nr_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_param_response_t* resp);
|
||||
|
||||
|
||||
/*! Send the PNF_CONFIG.response
|
||||
* \param config A pointer to a pnf configuraiton
|
||||
@@ -379,6 +394,7 @@ int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_respons
|
||||
*
|
||||
*/
|
||||
int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_response_t* resp);
|
||||
int nfapi_nr_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_config_response_t* resp);
|
||||
|
||||
/*! Send the PNF_START.response
|
||||
* \param config A pointer to a pnf configuraiton
|
||||
@@ -387,7 +403,7 @@ int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_respo
|
||||
*
|
||||
*/
|
||||
int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp);
|
||||
|
||||
int nfapi_nr_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_start_response_t* resp);
|
||||
/*! Send the PNF_STOP.response
|
||||
* \param config A pointer to a pnf configuraiton
|
||||
* \param resp A pointer to the message structure
|
||||
@@ -403,6 +419,7 @@ int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_
|
||||
*
|
||||
*/
|
||||
int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp);
|
||||
int nfapi_nr_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_param_response_scf_t* resp);
|
||||
|
||||
/*! Send the CONFIG.response
|
||||
* \param config A pointer to a pnf configuraiton
|
||||
@@ -411,7 +428,7 @@ int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* res
|
||||
*
|
||||
*/
|
||||
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp);
|
||||
|
||||
int nfapi_nr_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_scf_t* resp);
|
||||
/*! Send the START.response
|
||||
* \param config A pointer to a pnf configuraiton
|
||||
* \param resp A pointer to the message structure
|
||||
@@ -419,6 +436,7 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* r
|
||||
*
|
||||
*/
|
||||
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp);
|
||||
int nfapi_nr_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_start_response_scf_t* resp);
|
||||
|
||||
/*! Send the STOP.response
|
||||
* \param config A pointer to a pnf configuraiton
|
||||
@@ -550,6 +568,22 @@ typedef struct
|
||||
nfapi_ue_release_request_t* ue_release_req;
|
||||
} nfapi_pnf_p7_subframe_buffer_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//uint16_t sfn_slot
|
||||
int16_t sfn;
|
||||
int16_t slot;
|
||||
//TODO: Change P7 structs to NR
|
||||
nfapi_nr_dl_tti_request_t* dl_tti_req;//nfapi_dl_config_request_t* dl_config_req;
|
||||
nfapi_nr_ul_tti_request_t* ul_tti_req;//nfapi_ul_config_request_t* ul_config_req;
|
||||
nfapi_nr_ul_dci_request_t* ul_dci_req;//nfapi_hi_dci0_request_t* hi_dci0_req;
|
||||
nfapi_nr_tx_data_request_t* tx_data_req;//nfapi_tx_request_t* tx_req;
|
||||
|
||||
//TODO: check these two later
|
||||
//nfapi_lbt_dl_config_request_t* lbt_dl_config_req;
|
||||
//nfapi_ue_release_request_t* ue_release_req;
|
||||
} nfapi_pnf_p7_slot_buffer_t;
|
||||
|
||||
typedef struct nfapi_pnf_p7_config nfapi_pnf_p7_config_t;
|
||||
|
||||
/*! The nfapi PNF PHY P7 configuration information created using the nfapi_pnf_p7_create function
|
||||
@@ -602,6 +636,8 @@ typedef struct nfapi_pnf_p7_config
|
||||
/*! The dummy subframe buffer structure that should be used in case there
|
||||
* are no 'valid' subframe messages */
|
||||
nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
|
||||
|
||||
nfapi_pnf_p7_slot_buffer_t dummy_slot; // defining a slot equivalent for now
|
||||
|
||||
/*! Configuration options for the p7 pack unpack functions*/
|
||||
nfapi_p7_codec_config_t codec_config;
|
||||
@@ -611,6 +647,7 @@ typedef struct nfapi_pnf_p7_config
|
||||
|
||||
// tdb : if these should be public
|
||||
uint16_t subframe_buffer_size;
|
||||
uint16_t slot_buffer_size;
|
||||
uint8_t timing_info_mode_periodic; // 0:false 1:true
|
||||
uint8_t timing_info_mode_aperiodic; // 0:false 1:true
|
||||
uint8_t timing_info_period; // 1..225 in subframes
|
||||
@@ -620,6 +657,7 @@ typedef struct nfapi_pnf_p7_config
|
||||
* \param req A pointer to the dl config request message structure
|
||||
* \return not currently used
|
||||
*/
|
||||
int (*dl_tti_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_dl_tti_request_t* req);
|
||||
int (*dl_config_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_dl_config_request_t* req);
|
||||
|
||||
/*! A callback for the UL_CONFIG.request
|
||||
@@ -627,6 +665,7 @@ typedef struct nfapi_pnf_p7_config
|
||||
* \param req A pointer to the ul config request message structure
|
||||
* \return not currently used
|
||||
*/
|
||||
int (*ul_tti_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req);
|
||||
int (*ul_config_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_ul_config_request_t* req);
|
||||
|
||||
/*! A callback for the HI_DCI0.request
|
||||
@@ -634,8 +673,9 @@ typedef struct nfapi_pnf_p7_config
|
||||
* \param req A pointer to the hi dci0 request message structure
|
||||
* \return not currently used
|
||||
*/
|
||||
int (*ul_dci_req_fn)(gNB_L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req);
|
||||
int (*hi_dci0_req)(L1_rxtx_proc_t *proc,nfapi_pnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
|
||||
|
||||
|
||||
/*! A callback for the TX_REQ.request
|
||||
* \param config A poiner to the PNF P7 config
|
||||
* \param req A pointer to the tx request message structure
|
||||
@@ -645,6 +685,7 @@ typedef struct nfapi_pnf_p7_config
|
||||
* will 'keep' the pointers until they are transmitted the callee should set the pointers in the req to 0
|
||||
* and then use the p7 codec config free function to release the pdu's when appropriate.
|
||||
*/
|
||||
int (*tx_data_req_fn)(nfapi_pnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req);
|
||||
int (*tx_req)(nfapi_pnf_p7_config_t* config, nfapi_tx_request_t* req);
|
||||
|
||||
/*! A callback for the LBT_DL_CONFIG.request
|
||||
@@ -708,6 +749,7 @@ int nfapi_pnf_p7_config_destroy(nfapi_pnf_p7_config_t* config);
|
||||
* This function will not return until nfapi_pnf_p7_stop is called.
|
||||
*/
|
||||
int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config);
|
||||
int nfapi_nr_pnf_p7_start(nfapi_pnf_p7_config_t* config);
|
||||
|
||||
/*! Stop the PNF P7 library.
|
||||
* \param config A pointer to a PNF P7 config
|
||||
@@ -717,6 +759,21 @@ int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config);
|
||||
*/
|
||||
int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config);
|
||||
|
||||
/*! NR Slot indication
|
||||
* message copied from nfapi_pnf_p7_subframe_ind
|
||||
* \param config A pointer to a PNF P7 config
|
||||
* \param phy_id The phy_id for the phy instance
|
||||
* \param sfn_sf The SFN and SF in the format of FAPI
|
||||
* \return 0 means success, -1 means failure
|
||||
*
|
||||
* The client should call the subframe indication every 1ms. The PNF will
|
||||
* respond by invoking the pnf p7 subframe callbacks with the messages from the subframe buffer
|
||||
*
|
||||
* If messages are not in the subframe buffer, they dummy subframe messages will be sent
|
||||
*/
|
||||
int nfapi_pnf_p7_slot_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
|
||||
|
||||
|
||||
/*! Subframe indication
|
||||
* \param config A pointer to a PNF P7 config
|
||||
* \param phy_id The phy_id for the phy instance
|
||||
|
||||
@@ -26,9 +26,29 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "pnf.h"
|
||||
|
||||
# if 1 // for hard-code (remove later)
|
||||
#include "COMMON/platform_types.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "NR_BCCH-BCH-Message.h"
|
||||
#include "NR_ServingCellConfigCommon.h"
|
||||
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
|
||||
#include "NR_MIB.h"
|
||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
|
||||
#endif
|
||||
|
||||
#define MAX_SCTP_STREAMS 16
|
||||
|
||||
void nfapi_pnf_phy_config_delete_all(nfapi_pnf_config_t* config)
|
||||
@@ -63,6 +83,50 @@ nfapi_pnf_phy_config_t* nfapi_pnf_phy_config_find(nfapi_pnf_config_t* config, ui
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_pnf_param_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n");
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_nr_pnf_param_request_t), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
if(pnf->_public.state == NFAPI_PNF_IDLE)
|
||||
{
|
||||
if(pnf->_public.pnf_nr_param_req)
|
||||
{
|
||||
(pnf->_public.pnf_nr_param_req)(&pnf->_public, &req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__);
|
||||
|
||||
nfapi_nr_pnf_param_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_pnf_param_resp(&pnf->_public, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -173,6 +237,72 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
|
||||
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_pnf_config_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n");
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
// ensure correct state
|
||||
if(pnf->_public.state != NFAPI_PNF_RUNNING)
|
||||
{
|
||||
// delete the phy records
|
||||
nfapi_pnf_phy_config_delete_all(&pnf->_public);
|
||||
|
||||
// create the phy records
|
||||
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
|
||||
{
|
||||
int i = 0;
|
||||
for(i = 0; i < req.pnf_phy_rf_config.number_phy_rf_config_info; ++i)
|
||||
{
|
||||
nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
|
||||
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
|
||||
|
||||
phy->state = NFAPI_PNF_PHY_IDLE;
|
||||
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
|
||||
|
||||
nfapi_pnf_phy_config_add(&(pnf->_public), phy);
|
||||
}
|
||||
}
|
||||
|
||||
if(pnf->_public.pnf_nr_config_req)
|
||||
{
|
||||
(pnf->_public.pnf_nr_config_req)(&(pnf->_public), &req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state);
|
||||
|
||||
nfapi_nr_pnf_config_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_pnf_config_resp(&(pnf->_public), &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -215,6 +345,48 @@ void pnf_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_nr_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_pnf_start_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n");
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
if(pnf->_public.state == NFAPI_PNF_CONFIGURED)
|
||||
{
|
||||
if(pnf->_public.pnf_nr_start_req)
|
||||
{
|
||||
(pnf->_public.pnf_nr_start_req)(&(pnf->_public), &req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_pnf_start_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_PNF_START_RESPONSE;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_pnf_start_resp(&(pnf->_public), &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -330,6 +502,78 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_param_request_scf_t req;
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n");
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
{
|
||||
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||
if(phy)
|
||||
{
|
||||
if(phy->state == NFAPI_PNF_PHY_IDLE)
|
||||
{
|
||||
if(config->nr_param_req)
|
||||
{
|
||||
(config->nr_param_req)(config, phy, &req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_param_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_param_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_param_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||
nfapi_nr_pnf_param_resp(config, &resp);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_param_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_param_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
|
||||
@@ -401,6 +645,85 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_config_request_scf_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n");
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
{
|
||||
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||
|
||||
#if 0 // emulate set_config TLV reception (hard-code)
|
||||
int tdd_return = set_tdd_config_nr(&req, 1, 7, 6, 2, 4);
|
||||
#endif
|
||||
|
||||
if(phy)
|
||||
{
|
||||
if(phy->state != NFAPI_PNF_PHY_RUNNING)
|
||||
{
|
||||
if(config->nr_config_req)
|
||||
{
|
||||
(config->nr_config_req)(config, phy, &req);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_config_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_CONFIG_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_config_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_config_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_CONFIG_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||
nfapi_nr_pnf_config_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_config_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_CONFIG_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_config_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -472,6 +795,77 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_start_request_scf_t req;
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
{
|
||||
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||
if(phy)
|
||||
{
|
||||
if(phy->state != NFAPI_PNF_PHY_RUNNING)
|
||||
{
|
||||
if(config->nr_start_req)
|
||||
{
|
||||
(config->nr_start_req)(config, phy, &req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_start_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_start_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_start_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||
nfapi_nr_pnf_start_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_start_response_scf_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_nr_pnf_start_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -543,6 +937,77 @@ void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || pnf == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_stop_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
{
|
||||
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id);
|
||||
if(phy)
|
||||
{
|
||||
if(phy->state != NFAPI_PNF_PHY_RUNNING)
|
||||
{
|
||||
if(config->nr_stop_req)
|
||||
{
|
||||
(config->nr_stop_req)(config, phy, &req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_stop_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE;
|
||||
resp.header.phy_id = req.header.phy_id;
|
||||
resp.error_code = NFAPI_MSG_INVALID_STATE;
|
||||
nfapi_pnf_stop_resp(config, &resp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -1071,7 +1536,101 @@ void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uin
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_nr_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
nfapi_p4_p5_message_header_t messageHeader;
|
||||
|
||||
// validate the input params
|
||||
if(pRecvMsg == NULL || recvMsgLen < NFAPI_HEADER_LENGTH)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
// unpack the message header
|
||||
if (nfapi_p5_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p4_p5_message_header_t), &pnf->_public.codec_config) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (messageHeader.message_id)
|
||||
{
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST:
|
||||
pnf_nr_handle_pnf_param_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST:
|
||||
pnf_nr_handle_pnf_config_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST:
|
||||
pnf_nr_handle_pnf_start_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_PNF_STOP_REQUEST:
|
||||
pnf_handle_pnf_stop_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_REQUEST:
|
||||
pnf_nr_handle_param_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST:
|
||||
pnf_nr_handle_config_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_START_REQUEST:
|
||||
pnf_nr_handle_start_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST:
|
||||
pnf_nr_handle_stop_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_MEASUREMENT_REQUEST:
|
||||
pnf_handle_measurement_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_RSSI_REQUEST:
|
||||
pnf_handle_rssi_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_CELL_SEARCH_REQUEST:
|
||||
pnf_handle_cell_search_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_BROADCAST_DETECT_REQUEST:
|
||||
pnf_handle_broadcast_detect_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST:
|
||||
pnf_handle_system_information_schedule_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_SYSTEM_INFORMATION_REQUEST:
|
||||
pnf_handle_system_information_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
case NFAPI_NMM_STOP_REQUEST:
|
||||
pnf_handle_nmm_stop_request(pnf, pRecvMsg, recvMsgLen);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||
messageHeader.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
|
||||
{
|
||||
pnf_handle_vendor_extension(pRecvMsg, recvMsgLen, pnf, messageHeader.message_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, messageHeader.message_id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
@@ -1169,6 +1728,24 @@ void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||
{
|
||||
int packed_len = nfapi_nr_p5_message_pack(msg, msg_len,
|
||||
pnf->tx_message_buffer,
|
||||
sizeof(pnf->tx_message_buffer),
|
||||
&pnf->_public.codec_config);
|
||||
|
||||
if (packed_len < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p5_message_pack failed (%d)\n", packed_len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pnf_send_message(pnf, pnf->tx_message_buffer, packed_len, 0/*msg->stream_id*/);
|
||||
}
|
||||
|
||||
|
||||
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||
{
|
||||
int packed_len = nfapi_p5_message_pack(msg, msg_len,
|
||||
@@ -1393,8 +1970,15 @@ int pnf_connect(pnf_t* pnf)
|
||||
|
||||
int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
|
||||
{
|
||||
|
||||
if (pnf->sctp)
|
||||
{
|
||||
printf("\nPNF SENDS: \n");
|
||||
for(int i=0; i<len; i++){
|
||||
printf("%d", msg[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (sctp_sendmsg(pnf->p5_sock, msg, len, NULL, 0, 42/*config->sctp_stream_number*/, 0, stream/*P5_STREAM_ID*/, 0, 0) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "sctp_sendmsg failed errno: %d\n", errno);
|
||||
@@ -1412,7 +1996,6 @@ int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int pnf_read_dispatch_message(pnf_t* pnf)
|
||||
{
|
||||
int socket_connected = 1;
|
||||
@@ -1486,6 +2069,13 @@ int pnf_read_dispatch_message(pnf_t* pnf)
|
||||
}
|
||||
else
|
||||
{
|
||||
// print the received message
|
||||
printf("\n MESSAGE RECEIVED: \n");
|
||||
for(int i=0; i<message_size; i++){
|
||||
printf("%d", read_buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (flags & MSG_NOTIFICATION)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||
@@ -1533,6 +2123,135 @@ int pnf_read_dispatch_message(pnf_t* pnf)
|
||||
return socket_connected;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int pnf_nr_read_dispatch_message(pnf_t* pnf)
|
||||
{
|
||||
int socket_connected = 1;
|
||||
|
||||
// 1. Peek the message header
|
||||
// 2. If the message is larger than the stack buffer then create a dynamic buffer
|
||||
// 3. Read the buffer
|
||||
// 4. Handle the p5 message
|
||||
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
|
||||
uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
|
||||
uint8_t stack_buffer[stack_buffer_size];
|
||||
|
||||
uint8_t* dynamic_buffer = 0;
|
||||
|
||||
uint8_t* read_buffer = &stack_buffer[0];
|
||||
uint32_t message_size = 0;
|
||||
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addr_len = sizeof(addr);
|
||||
|
||||
struct sctp_sndrcvinfo sndrcvinfo;
|
||||
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||
|
||||
{
|
||||
int flags = MSG_PEEK;
|
||||
message_size = sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, /*(struct sockaddr*)&addr, &addr_len*/ 0, 0, &sndrcvinfo, &flags);
|
||||
|
||||
if(message_size == -1)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to peek sctp message size errno:%d\n", errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
|
||||
if(unpack_result < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to unpack p5 message header\n");
|
||||
return 0;
|
||||
}
|
||||
message_size = header.message_length;
|
||||
|
||||
// now have the size of the mesage
|
||||
}
|
||||
|
||||
if(message_size > stack_buffer_size)
|
||||
{
|
||||
dynamic_buffer = (uint8_t*)malloc(message_size);
|
||||
|
||||
if(dynamic_buffer == NULL)
|
||||
{
|
||||
// todo : add error mesage
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
read_buffer = dynamic_buffer;
|
||||
}
|
||||
|
||||
{
|
||||
int flags = 0;
|
||||
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||
|
||||
int recvmsg_result = sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
|
||||
if(recvmsg_result == -1)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
// print the received message
|
||||
printf("\n MESSAGE RECEIVED: \n");
|
||||
for(int i=0; i<message_size; i++){
|
||||
printf("%d", read_buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (flags & MSG_NOTIFICATION)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||
|
||||
// todo - handle the events
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
|
||||
pnf->p5_sock,
|
||||
inet_ntoa(addr.sin_addr),
|
||||
ntohs(addr.sin_port),
|
||||
sndrcvinfo.sinfo_assoc_id,
|
||||
sndrcvinfo.sinfo_stream,
|
||||
ntohl(sndrcvinfo.sinfo_ppid),
|
||||
message_size,
|
||||
flags);
|
||||
*/
|
||||
|
||||
// handle now if complete message in one or more segments
|
||||
if ((flags & 0x80) == 0x80)
|
||||
{
|
||||
pnf_nr_handle_p5_message(pnf, read_buffer, message_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
|
||||
|
||||
// assume socket disconnected
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
|
||||
socket_connected = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dynamic_buffer)
|
||||
{
|
||||
free(dynamic_buffer);
|
||||
}
|
||||
|
||||
return socket_connected;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1597,3 +2316,64 @@ int pnf_message_pump(pnf_t* pnf)
|
||||
|
||||
}
|
||||
|
||||
int pnf_nr_message_pump(pnf_t* pnf)
|
||||
{
|
||||
uint8_t socketConnected = 1;
|
||||
|
||||
while(socketConnected && pnf->terminate == 0)
|
||||
{
|
||||
fd_set rfds;
|
||||
int selectRetval = 0;
|
||||
|
||||
// select on a timeout and then get the message
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(pnf->p5_sock, &rfds);
|
||||
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout);
|
||||
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
// timeout
|
||||
continue;
|
||||
}
|
||||
else if (selectRetval == -1 && (errno == EINTR))
|
||||
{
|
||||
// interrupted by signal
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "P5 Signal Interrupt %d\n", errno);
|
||||
continue;
|
||||
}
|
||||
else if (selectRetval == -1)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "P5 select() failed\n");
|
||||
sleep(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(FD_ISSET(pnf->p5_sock, &rfds))
|
||||
{
|
||||
socketConnected = pnf_nr_read_dispatch_message(pnf);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "Why are we here\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Drop back to idle if we have lost connection
|
||||
pnf->_public.state = NFAPI_PNF_PHY_IDLE;
|
||||
|
||||
|
||||
// close the connection and socket
|
||||
if (close(pnf->p5_sock) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "close(sctpSock) failed errno: %d\n", errno);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
|
||||
nfapi_pnf_config_t* nfapi_pnf_config_create()
|
||||
{
|
||||
@@ -81,6 +83,40 @@ int nfapi_pnf_start(nfapi_pnf_config_t* config)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_nr_pnf_start(nfapi_pnf_config_t* config)
|
||||
{
|
||||
// Verify that config is not null
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = config->trace;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
while (_this->terminate == 0)
|
||||
{
|
||||
int connect_result = pnf_connect(_this);
|
||||
|
||||
if(connect_result > 0)
|
||||
{
|
||||
pnf_nr_message_pump(_this);
|
||||
}
|
||||
else if(connect_result < 0)
|
||||
{
|
||||
return connect_result;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() terminate=1 - EXITTING............\n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_pnf_stop(nfapi_pnf_config_t* config)
|
||||
{
|
||||
// Verify that config is not null
|
||||
@@ -96,6 +132,21 @@ int nfapi_pnf_stop(nfapi_pnf_config_t* config)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int nfapi_nr_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_param_response_t* resp)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (config == NULL || resp == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_pnf_param_response_t));
|
||||
}
|
||||
|
||||
int nfapi_pnf_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_pnf_param_response_t* resp)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -129,6 +180,27 @@ int nfapi_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_pnf_config_respo
|
||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_config_response_t));
|
||||
}
|
||||
|
||||
|
||||
int nfapi_nr_pnf_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_config_response_t* resp)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (config == NULL || resp == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(resp->error_code == NFAPI_MSG_OK)
|
||||
{
|
||||
config->state = NFAPI_PNF_CONFIGURED;
|
||||
}
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_pnf_config_response_t));
|
||||
}
|
||||
|
||||
|
||||
int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_response_t* resp)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -148,6 +220,26 @@ int nfapi_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_pnf_start_respons
|
||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_start_response_t));
|
||||
}
|
||||
|
||||
int nfapi_nr_pnf_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_pnf_start_response_t* resp)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (config == NULL || resp == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(resp->error_code == NFAPI_MSG_OK)
|
||||
{
|
||||
config->state = NFAPI_PNF_RUNNING;
|
||||
}
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_pnf_start_response_t));
|
||||
}
|
||||
|
||||
|
||||
int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_t* resp)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -166,7 +258,6 @@ int nfapi_pnf_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_pnf_stop_response_
|
||||
|
||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_pnf_stop_response_t));
|
||||
}
|
||||
|
||||
int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* resp)
|
||||
{
|
||||
if (config == NULL || resp == NULL)
|
||||
@@ -180,6 +271,20 @@ int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* res
|
||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t));
|
||||
}
|
||||
|
||||
|
||||
int nfapi_nr_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_param_response_scf_t* resp)
|
||||
{
|
||||
if (config == NULL || resp == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_param_response_scf_t));
|
||||
}
|
||||
|
||||
int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* resp)
|
||||
{
|
||||
if (config == NULL || resp == NULL)
|
||||
@@ -208,6 +313,35 @@ int nfapi_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_config_response_t* r
|
||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_config_response_t));
|
||||
}
|
||||
|
||||
int nfapi_nr_pnf_config_resp(nfapi_pnf_config_t* config, nfapi_nr_config_response_scf_t* resp)
|
||||
{
|
||||
if (config == NULL || resp == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
|
||||
|
||||
if(phy)
|
||||
{
|
||||
if(resp->error_code == NFAPI_NR_CONFIG_MSG_OK)
|
||||
{
|
||||
phy->state = NFAPI_PNF_PHY_CONFIGURED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknow phy id %d\n", __FUNCTION__, resp->header.phy_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_config_response_scf_t));
|
||||
}
|
||||
|
||||
|
||||
int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* resp)
|
||||
{
|
||||
if (config == NULL || resp == NULL)
|
||||
@@ -235,6 +369,34 @@ int nfapi_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_start_response_t* res
|
||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_start_response_t));
|
||||
}
|
||||
|
||||
int nfapi_nr_pnf_start_resp(nfapi_pnf_config_t* config, nfapi_nr_start_response_scf_t* resp)
|
||||
{
|
||||
if (config == NULL || resp == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, resp->header.phy_id);
|
||||
if(phy)
|
||||
{
|
||||
if(resp->error_code == NFAPI_NR_START_MSG_OK)
|
||||
{
|
||||
phy->state = NFAPI_PNF_PHY_RUNNING;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: unknown phy id %d\n", __FUNCTION__, resp->header.phy_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_start_response_scf_t));
|
||||
}
|
||||
|
||||
|
||||
int nfapi_pnf_stop_resp(nfapi_pnf_config_t* config, nfapi_stop_response_t* resp)
|
||||
{
|
||||
if (config == NULL || resp == NULL)
|
||||
|
||||
+1466
-10
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@ nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create()
|
||||
_this->_public.segment_size = 1400;
|
||||
_this->max_num_segments = 8;
|
||||
|
||||
_this->_public.subframe_buffer_size = 8;
|
||||
_this->_public.subframe_buffer_size = 8;// TODO: Initialize the slot_buffer size
|
||||
_this->_public.timing_info_mode_periodic = 1;
|
||||
_this->_public.timing_info_period = 32;
|
||||
_this->_public.timing_info_mode_aperiodic = 1;
|
||||
@@ -76,6 +76,26 @@ int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_nr_pnf_p7_start(nfapi_pnf_p7_config_t* config)
|
||||
{
|
||||
// Verify that config is not null
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = config->trace;
|
||||
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
|
||||
pnf_nr_p7_message_pump(_this);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config)
|
||||
{
|
||||
// Verify that config is not null
|
||||
@@ -88,6 +108,16 @@ int nfapi_pnf_p7_stop(nfapi_pnf_p7_config_t* config)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_pnf_p7_slot_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn, uint16_t slot)
|
||||
{
|
||||
// Verify that config is not null
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
|
||||
return pnf_p7_slot_ind(_this, phy_id, sfn, slot);
|
||||
}
|
||||
|
||||
int nfapi_pnf_p7_subframe_ind(nfapi_pnf_p7_config_t* config, uint16_t phy_id, uint16_t sfn_sf)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,9 @@ typedef struct phy_info
|
||||
uint8_t enabled;
|
||||
uint16_t phy_id;
|
||||
uint16_t sfn_sf;
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
|
||||
|
||||
pthread_t thread;
|
||||
|
||||
@@ -1207,6 +1210,12 @@ void send_dl_subframe_msgs_interleaved(int p7Sock, int phy_id, struct sockaddr_i
|
||||
//free(req.tx_request_body.tx_pdu_list);
|
||||
}
|
||||
|
||||
void send_slot_indication(phy_info_t* phy_info)
|
||||
{
|
||||
// DONE: add sfn and slot as members in the phy_info
|
||||
nfapi_pnf_p7_slot_ind(phy_info->config, phy_info->phy_id, phy_info->sfn, phy_info->slot);
|
||||
}
|
||||
|
||||
void send_subframe_indication(phy_info_t* phy_info)
|
||||
{
|
||||
nfapi_pnf_p7_subframe_ind(phy_info->config, phy_info->phy_id, phy_info->sfn_sf);
|
||||
|
||||
@@ -35,9 +35,13 @@ typedef struct
|
||||
|
||||
|
||||
int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
|
||||
int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
|
||||
|
||||
int vnf_pack_and_send_p4_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len);
|
||||
|
||||
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf);
|
||||
int vnf_nr_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf);
|
||||
|
||||
|
||||
void nfapi_vnf_phy_info_list_add(nfapi_vnf_config_t* config, nfapi_vnf_phy_info_t* info);
|
||||
nfapi_vnf_phy_info_t* nfapi_vnf_phy_info_list_find(nfapi_vnf_config_t* config, uint16_t phy_id);
|
||||
|
||||
@@ -77,6 +77,9 @@ typedef struct nfapi_vnf_p7_connection_info {
|
||||
int32_t sf_offset_filtered;
|
||||
int32_t sf_offset_trend;
|
||||
int32_t sf_offset;
|
||||
int32_t slot_offset;
|
||||
int32_t slot_offset_trend;
|
||||
int32_t slot_offset_filtered;
|
||||
uint16_t zero_count;
|
||||
int32_t adjustment;
|
||||
int32_t insync_minor_adjustment;
|
||||
@@ -85,8 +88,10 @@ typedef struct nfapi_vnf_p7_connection_info {
|
||||
uint32_t previous_t1;
|
||||
uint32_t previous_t2;
|
||||
int32_t previous_sf_offset_filtered;
|
||||
|
||||
int32_t previous_slot_offset_filtered;
|
||||
int sfn_sf;
|
||||
int sfn;
|
||||
int slot;
|
||||
|
||||
int socket;
|
||||
struct sockaddr_in local_addr;
|
||||
@@ -111,6 +116,7 @@ typedef struct {
|
||||
nfapi_vnf_p7_connection_info_t* p7_connections;
|
||||
int socket;
|
||||
uint32_t sf_start_time_hr;
|
||||
uint32_t slot_start_time_hr;
|
||||
uint8_t* rx_message_buffer; // would this be better put in the p7 conenction info?
|
||||
uint16_t rx_message_buffer_size;
|
||||
|
||||
@@ -120,14 +126,19 @@ uint32_t vnf_get_current_time_hr(void);
|
||||
|
||||
uint16_t increment_sfn_sf(uint16_t sfn_sf);
|
||||
int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
|
||||
int vnf_nr_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info);
|
||||
|
||||
int send_mac_subframe_indications(vnf_p7_t* config);
|
||||
int send_mac_slot_indications(vnf_p7_t* config);
|
||||
int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7 );
|
||||
int vnf_nr_p7_read_dispatch_message(vnf_p7_t* vnf_p7 );
|
||||
|
||||
void vnf_p7_connection_info_list_add(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* node);
|
||||
nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_find(vnf_p7_t* vnf_p7, uint16_t phy_id);
|
||||
nfapi_vnf_p7_connection_info_t* vnf_p7_connection_info_list_delete(vnf_p7_t* vnf_p7, uint16_t phy_id);
|
||||
|
||||
int vnf_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
|
||||
int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
|
||||
|
||||
void vnf_p7_release_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header);
|
||||
void vnf_p7_release_pdu(vnf_p7_t* vnf_p7, void* pdu);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "nfapi_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "nfapi_nr_interface.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
@@ -120,6 +121,7 @@ typedef struct nfapi_vnf_config
|
||||
*
|
||||
* \todo Do we need to send the address information of the PNF?
|
||||
*/
|
||||
int (*pnf_nr_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
|
||||
int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
|
||||
|
||||
/*! \brief Callback indicating that a pnf has lost connection
|
||||
@@ -160,6 +162,7 @@ typedef struct nfapi_vnf_config
|
||||
* then the substructure pointers should be set to 0 and then the client should
|
||||
* use the codec_config.deallocate function to release it at a future point
|
||||
*/
|
||||
int (*pnf_nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_response_t* resp);
|
||||
int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp);
|
||||
|
||||
/*! A callback for the PNF_CONFIG.resp
|
||||
@@ -182,7 +185,8 @@ typedef struct nfapi_vnf_config
|
||||
* use the codec_config.deallocate function to release it at a future point
|
||||
*/
|
||||
int (*pnf_config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_response_t* resp);
|
||||
|
||||
int (*pnf_nr_config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_config_response_t* resp);
|
||||
|
||||
/*! A callback for the PNF_START.resp
|
||||
* \param config A pointer to the vnf configuration
|
||||
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
||||
@@ -203,7 +207,8 @@ typedef struct nfapi_vnf_config
|
||||
* use the codec_config.deallocate function to release it at a future point
|
||||
*/
|
||||
int (*pnf_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_start_response_t* resp);
|
||||
|
||||
int (*pnf_nr_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_start_response_t* resp);
|
||||
|
||||
/*! A callback for the PNF_STOP.resp
|
||||
* \param config A pointer to the vnf configuration
|
||||
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
||||
@@ -249,6 +254,7 @@ typedef struct nfapi_vnf_config
|
||||
* use the codec_config.deallocate function to release it at a future point
|
||||
*/
|
||||
int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp);
|
||||
int (*nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_response_scf_t* resp);
|
||||
|
||||
/*! A callback for the CONFIG.response
|
||||
* \param config A pointer to the vnf configuration
|
||||
@@ -266,8 +272,9 @@ typedef struct nfapi_vnf_config
|
||||
* then the substructure pointers should be set to 0 and then the client should
|
||||
* use the codec_config.deallocate function to release it at a future point
|
||||
*/
|
||||
int (*nr_config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config_response_scf_t* resp);
|
||||
int (*config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp);
|
||||
|
||||
|
||||
/*! A callback for the START.resp
|
||||
* \param config A pointer to the vnf configuration
|
||||
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
|
||||
@@ -285,6 +292,7 @@ typedef struct nfapi_vnf_config
|
||||
* use the codec_config.deallocate function to release it at a future point
|
||||
*/
|
||||
int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp);
|
||||
int (*nr_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_response_scf_t* resp);
|
||||
|
||||
/*! A callback for the STOP.resp
|
||||
* \param config A pointer to the vnf configuration
|
||||
@@ -469,6 +477,8 @@ void nfapi_vnf_config_destory(nfapi_vnf_config_t* config);
|
||||
*
|
||||
* This function will not return untill nfapi_vnf_stop is called
|
||||
*/
|
||||
int nfapi_nr_vnf_start(nfapi_vnf_config_t* config);
|
||||
|
||||
int nfapi_vnf_start(nfapi_vnf_config_t* config);
|
||||
|
||||
/*! Stop the VNF library.
|
||||
@@ -500,6 +510,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
|
||||
* \return 0 means success, -1 failure
|
||||
*/
|
||||
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req);
|
||||
int nfapi_nr_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_request_t* req);
|
||||
|
||||
/*! Send the PNF_CONFIG.request
|
||||
* \param config A pointer to a vnf config
|
||||
@@ -508,6 +519,7 @@ int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_pa
|
||||
* \return 0 means success, -1 failure
|
||||
*/
|
||||
int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_config_request_t* req);
|
||||
int nfapi_nr_vnf_pnf_config_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_nr_pnf_config_request_t* req);
|
||||
|
||||
/*! Send the PNF_START.request
|
||||
* \param config A pointer to a vnf config
|
||||
@@ -516,6 +528,7 @@ int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_co
|
||||
* \return 0 means success, -1 failure
|
||||
*/
|
||||
int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_start_request_t* req);
|
||||
int nfapi_nr_vnf_pnf_start_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_nr_pnf_start_request_t* req);
|
||||
|
||||
/*! Send the PNF_STOP.request
|
||||
* \param config A pointer to a vnf config
|
||||
@@ -532,6 +545,7 @@ int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config,int p5_idx, nfapi_pnf_stop
|
||||
* \return 0 means success, -1 failure
|
||||
*/
|
||||
int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req);
|
||||
int nfapi_nr_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_request_scf_t* req);
|
||||
|
||||
/*! Send the CONFIG.request
|
||||
* \param config A pointer to a vnf config
|
||||
@@ -539,6 +553,7 @@ int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_requ
|
||||
* \param req A pointer to a CONFIG.request message structure
|
||||
* \return 0 means success, -1 failure
|
||||
*/
|
||||
int nfapi_nr_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config_request_scf_t* req);
|
||||
int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req);
|
||||
|
||||
/*! Send the START.request
|
||||
@@ -548,6 +563,7 @@ int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_re
|
||||
* \return 0 means success, -1 failure
|
||||
*/
|
||||
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req);
|
||||
int nfapi_nr_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_request_scf_t* req);
|
||||
|
||||
/*! Send the STOP.request
|
||||
* \param config A pointer to a vnf config
|
||||
@@ -692,6 +708,7 @@ typedef struct nfapi_vnf_p7_config
|
||||
*/
|
||||
|
||||
int (*subframe_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf);
|
||||
int (*slot_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
|
||||
|
||||
/*! A callback for the HARQ.indication
|
||||
* \param config A pointer to the vnf p7 configuration
|
||||
@@ -885,6 +902,8 @@ void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config);
|
||||
*/
|
||||
|
||||
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config);
|
||||
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config);
|
||||
|
||||
|
||||
/*! Stop the VNF P7 library.
|
||||
* \param config A pointer to an vnf p7 configuration structure
|
||||
@@ -950,7 +969,7 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti
|
||||
* may be released after this function call has returned or at a later pointer
|
||||
*/
|
||||
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req);
|
||||
|
||||
int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req);
|
||||
/*! Send the HI_DCI0.request
|
||||
* \param config A pointer to the vnf p7 configuration
|
||||
* \param req A data structure for the decoded HI_DCI0.request.
|
||||
@@ -960,7 +979,7 @@ int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_re
|
||||
* may be released after this function call has returned or at a later pointer
|
||||
*/
|
||||
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req);
|
||||
|
||||
int nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req);
|
||||
/*! Send the TX.req
|
||||
* \param config A pointer to the vnf p7 configuration
|
||||
* \param req A data structure for the decoded HI_DCI0.request.
|
||||
@@ -970,7 +989,7 @@ int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_reques
|
||||
* may be released after this function call has returned or at a later pointer
|
||||
*/
|
||||
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req);
|
||||
|
||||
int nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req);
|
||||
/*! Send the LBT_DL_CONFIG.requst
|
||||
* \param config A pointer to the vnf p7 configuration
|
||||
* \param req A data structure for the decoded LBT_DL_CONFIG.request.
|
||||
|
||||
@@ -21,9 +21,12 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "vnf.h"
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
|
||||
|
||||
void* vnf_malloc(nfapi_vnf_config_t* config, size_t size)
|
||||
@@ -101,6 +104,39 @@ nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vnf_nr_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || config == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_PARAM.reponse\n");
|
||||
|
||||
nfapi_nr_pnf_param_response_t msg;
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||
{
|
||||
// Invoke the call back
|
||||
if(config->pnf_nr_param_resp)
|
||||
{
|
||||
(config->pnf_nr_param_resp)(config, p5_idx, &msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
// make sure to release any dyanmic part of the message
|
||||
if(msg.vendor_extension)
|
||||
config->codec_config.deallocate(msg.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -134,6 +170,40 @@ void vnf_handle_pnf_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_con
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vnf_nr_handle_pnf_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || config == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_CONFIG_RESPONSE\n");
|
||||
|
||||
nfapi_nr_pnf_config_response_t msg;
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||
{
|
||||
// Invoke the call back
|
||||
if(config->pnf_nr_config_resp)
|
||||
{
|
||||
(config->pnf_nr_config_resp)(config, p5_idx, &msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
// make sure to release any dyanmic part of the message
|
||||
if(msg.vendor_extension)
|
||||
config->codec_config.deallocate(msg.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_handle_pnf_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -167,6 +237,38 @@ void vnf_handle_pnf_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_co
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_nr_handle_pnf_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || config == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PNF_START_RESPONSE\n");
|
||||
|
||||
nfapi_nr_pnf_start_response_t msg;
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->pnf_nr_start_resp)
|
||||
{
|
||||
(config->pnf_nr_start_resp)(config, p5_idx, &msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
// make sure to release any dyanmic part of the message
|
||||
if(msg.vendor_extension)
|
||||
config->codec_config.deallocate(msg.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_handle_pnf_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -298,8 +400,113 @@ void vnf_handle_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_nr_handle_param_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || config == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received PARAM_RESPONSE\n");
|
||||
|
||||
nfapi_nr_param_response_scf_t msg;
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||
{
|
||||
|
||||
if (msg.error_code == NFAPI_NR_PARAM_MSG_OK)
|
||||
{
|
||||
nfapi_vnf_phy_info_t* phy_info = nfapi_vnf_phy_info_list_find(config, msg.header.phy_id);
|
||||
|
||||
if(msg.nfapi_config.p7_pnf_address_ipv4.tl.tag)
|
||||
{
|
||||
struct sockaddr_in sockAddr;
|
||||
|
||||
(void)memcpy(&sockAddr.sin_addr.s_addr, msg.nfapi_config.p7_pnf_address_ipv4.address, NFAPI_IPV4_ADDRESS_LENGTH);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 IPv4 address: %s\n", inet_ntoa(sockAddr.sin_addr));
|
||||
|
||||
// store address
|
||||
phy_info->p7_pnf_address.sin_addr = sockAddr.sin_addr;
|
||||
}
|
||||
|
||||
if(msg.nfapi_config.p7_pnf_address_ipv6.tl.tag)
|
||||
{
|
||||
struct sockaddr_in6 sockAddr6;
|
||||
char addr6[64];
|
||||
(void)memcpy(&sockAddr6.sin6_addr, msg.nfapi_config.p7_pnf_address_ipv6.address, NFAPI_IPV6_ADDRESS_LENGTH);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 IPv6 address: %s\n", inet_ntop(AF_INET6, &sockAddr6.sin6_addr, addr6, sizeof(addr6)));
|
||||
}
|
||||
|
||||
if (msg.nfapi_config.p7_pnf_port.tl.tag)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 Port: %d\n", msg.nfapi_config.p7_pnf_port.value);
|
||||
|
||||
// store port
|
||||
phy_info->p7_pnf_address.sin_port = htons(msg.nfapi_config.p7_pnf_port.value);
|
||||
}
|
||||
}
|
||||
|
||||
if(config->nr_param_resp)
|
||||
{
|
||||
(config->nr_param_resp)(config, p5_idx, &msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
// make sure to release any dyanmic part of the message
|
||||
if(msg.vendor_extension)
|
||||
config->codec_config.deallocate(msg.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vnf_nr_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || config == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received CONFIG_RESPONSE\n");
|
||||
|
||||
nfapi_nr_config_response_scf_t msg;
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >=0 )
|
||||
{
|
||||
// check the error code:
|
||||
|
||||
if (msg.error_code == NFAPI_NR_CONFIG_MSG_OK){
|
||||
if(config->nr_config_resp)
|
||||
{
|
||||
(config->nr_config_resp)(config, p5_idx, &msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
// make sure to release any dyanmic part of the message
|
||||
if(msg.vendor_extension)
|
||||
config->codec_config.deallocate(msg.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || config == NULL)
|
||||
{
|
||||
@@ -314,9 +521,13 @@ void vnf_handle_config_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >=0 )
|
||||
{
|
||||
if(config->config_resp)
|
||||
{
|
||||
(config->config_resp)(config, p5_idx, &msg);
|
||||
// check the error code:
|
||||
|
||||
if (msg.error_code == NFAPI_MSG_OK){
|
||||
if(config->config_resp)
|
||||
{
|
||||
(config->config_resp)(config, p5_idx, &msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -362,6 +573,40 @@ void vnf_handle_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_nr_handle_start_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || config == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received START_RESPONSE\n");
|
||||
|
||||
nfapi_nr_start_response_scf_t msg;
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &msg, sizeof(msg), &config->codec_config) >= 0)
|
||||
{ // check the error code
|
||||
if (msg.error_code == NFAPI_NR_START_MSG_OK){
|
||||
if(config->nr_start_resp)
|
||||
{
|
||||
(config->nr_start_resp)(config, p5_idx, &msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
// make sure to release any dyanmic part of the message
|
||||
if(msg.vendor_extension)
|
||||
config->codec_config.deallocate(msg.vendor_extension);
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_handle_stop_response(void *pRecvMsg, int recvMsgLen, nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
|
||||
@@ -811,6 +1056,74 @@ void vnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, nfapi_vnf_confi
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_nr_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config)
|
||||
{
|
||||
nfapi_p4_p5_message_header_t messageHeader;
|
||||
|
||||
// validate the input params
|
||||
if(pRecvMsg == NULL || recvMsgLen < NFAPI_HEADER_LENGTH || config == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p4_p5_message: invalid input params\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// unpack the message header
|
||||
if (nfapi_p5_message_header_unpack(pRecvMsg, recvMsgLen, &messageHeader, sizeof(nfapi_p4_p5_message_header_t), &config->codec_config) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unpack message header failed, ignoring\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (messageHeader.message_id)
|
||||
{
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE:
|
||||
vnf_nr_handle_pnf_param_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE:
|
||||
vnf_nr_handle_pnf_config_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE:
|
||||
vnf_nr_handle_pnf_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||
break;
|
||||
|
||||
case NFAPI_PNF_STOP_RESPONSE:
|
||||
vnf_handle_pnf_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE:
|
||||
vnf_nr_handle_param_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
|
||||
vnf_nr_handle_config_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
|
||||
vnf_nr_handle_start_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE:
|
||||
vnf_handle_stop_response(pRecvMsg, recvMsgLen, config, p5_idx);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
|
||||
messageHeader.message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
|
||||
{
|
||||
vnf_handle_vendor_extension(pRecvMsg, recvMsgLen, config, p5_idx, messageHeader.message_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s P5 Unknown message ID %d\n", __FUNCTION__, messageHeader.message_id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_vnf_config_t* config)
|
||||
{
|
||||
nfapi_p4_p5_message_header_t messageHeader;
|
||||
@@ -926,6 +1239,137 @@ void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int vnf_nr_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
|
||||
{
|
||||
if(1)
|
||||
{
|
||||
int socket_connected = 1;
|
||||
|
||||
// 1. Peek the message header
|
||||
// 2. If the message is larger than the stack buffer then create a dynamic buffer
|
||||
// 3. Read the buffer
|
||||
// 4. Handle the p5 message
|
||||
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
|
||||
uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
|
||||
uint8_t stack_buffer[stack_buffer_size];
|
||||
|
||||
uint8_t* dynamic_buffer = 0;
|
||||
|
||||
uint8_t* read_buffer = &stack_buffer[0];
|
||||
uint32_t message_size = 0;
|
||||
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addr_len = sizeof(addr);
|
||||
|
||||
struct sctp_sndrcvinfo sndrcvinfo;
|
||||
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||
|
||||
{
|
||||
int flags = MSG_PEEK;
|
||||
message_size = sctp_recvmsg(pnf->p5_sock, header_buffer, header_buffer_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
|
||||
|
||||
if(message_size == -1)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to peek sctp message size errno:%d\n", errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
nfapi_p4_p5_message_header_t header;
|
||||
int unpack_result = nfapi_p5_message_header_unpack(header_buffer, header_buffer_size, &header, sizeof(header), 0);
|
||||
if(unpack_result < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to decode message header %d\n", unpack_result);
|
||||
return 0;
|
||||
}
|
||||
message_size = header.message_length;
|
||||
|
||||
// now have the size of the mesage
|
||||
}
|
||||
|
||||
if(message_size > stack_buffer_size)
|
||||
{
|
||||
dynamic_buffer = (uint8_t*)malloc(message_size);
|
||||
|
||||
if(dynamic_buffer == NULL)
|
||||
{
|
||||
// todo : add error mesage
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Failed to allocate dynamic buffer for sctp_recvmsg size:%d\n", message_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
read_buffer = dynamic_buffer;
|
||||
}
|
||||
|
||||
{
|
||||
int flags = 0;
|
||||
(void)memset(&sndrcvinfo, 0, sizeof(struct sctp_sndrcvinfo));
|
||||
|
||||
int recvmsg_result = sctp_recvmsg(pnf->p5_sock, read_buffer, message_size, (struct sockaddr*)&addr, &addr_len, &sndrcvinfo, &flags);
|
||||
if(recvmsg_result == -1)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Failed to read sctp message size errno:%d\n", errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flags & MSG_NOTIFICATION)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||
|
||||
// todo - handle the events
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Received message fd:%d from %s:%u assoc:%d on stream %d, PPID %d, length %d, flags 0x%x\n",
|
||||
pnf->p5_sock,
|
||||
inet_ntoa(addr.sin_addr),
|
||||
ntohs(addr.sin_port),
|
||||
sndrcvinfo.sinfo_assoc_id,
|
||||
sndrcvinfo.sinfo_stream,
|
||||
ntohl(sndrcvinfo.sinfo_ppid),
|
||||
message_size,
|
||||
flags);
|
||||
*/
|
||||
|
||||
// handle now if complete message in one or more segments
|
||||
if ((flags & 0x80) == 0x80)
|
||||
{
|
||||
// printf("\nVNF RECEIVES:\n");
|
||||
// for(int i=0; i<message_size; i++){
|
||||
// printf("%d", read_buffer[i]);
|
||||
// }
|
||||
// printf("\n");
|
||||
|
||||
vnf_nr_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "sctp_recvmsg: unhandled mode with flags 0x%x\n", flags);
|
||||
|
||||
// assume socket disconnected
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "Disconnected socket\n");
|
||||
socket_connected = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dynamic_buffer)
|
||||
{
|
||||
free(dynamic_buffer);
|
||||
}
|
||||
|
||||
return socket_connected;
|
||||
}
|
||||
}
|
||||
|
||||
int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* pnf)
|
||||
{
|
||||
if(1)
|
||||
@@ -1024,6 +1468,12 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t*
|
||||
// handle now if complete message in one or more segments
|
||||
if ((flags & 0x80) == 0x80)
|
||||
{
|
||||
// printf("\nVNF RECEIVES:\n");
|
||||
// for(int i=0; i<message_size; i++){
|
||||
// printf("%d", read_buffer[i]);
|
||||
// }
|
||||
// printf("\n");
|
||||
|
||||
vnf_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
|
||||
}
|
||||
else
|
||||
@@ -1051,6 +1501,12 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t*
|
||||
|
||||
static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len, uint8_t stream)
|
||||
{
|
||||
// printf("\n MESSAGE SENT: \n");
|
||||
// for(int i=0; i<len; i++){
|
||||
// printf("%d", *(uint8_t *)(msg + i));
|
||||
// }
|
||||
// printf("\n");
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s len:%d stream:%d\n", __FUNCTION__, len, stream);
|
||||
|
||||
int result = sctp_sendmsg(pnf->p5_sock, msg, len, (struct sockaddr*)&pnf->p5_pnf_sockaddr, sizeof(pnf->p5_pnf_sockaddr),1, 0, stream, 0, 4);
|
||||
@@ -1071,6 +1527,29 @@ static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
|
||||
{
|
||||
nfapi_vnf_pnf_info_t* pnf = nfapi_vnf_pnf_list_find(&(vnf->_public), p5_idx);
|
||||
|
||||
if(pnf)
|
||||
{
|
||||
// pack the message for transmission
|
||||
int packedMessageLength = nfapi_nr_p5_message_pack(msg, msg_len, vnf->tx_message_buffer, sizeof(vnf->tx_message_buffer), &vnf->_public.codec_config);
|
||||
|
||||
if (packedMessageLength < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_p5_message_pack failed with return %d\n", packedMessageLength);
|
||||
return -1;
|
||||
}
|
||||
return vnf_send_p5_msg(pnf, vnf->tx_message_buffer, packedMessageLength, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find pnf info for p5_idx:%d\n", __FUNCTION__, p5_idx);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int vnf_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_p4_p5_message_header_t* msg, uint16_t msg_len)
|
||||
{
|
||||
|
||||
@@ -63,6 +63,418 @@ void nfapi_vnf_config_destory(nfapi_vnf_config_t* config)
|
||||
free(config);
|
||||
}
|
||||
|
||||
int nfapi_nr_vnf_start(nfapi_vnf_config_t* config)
|
||||
{
|
||||
// Verify that config is not null
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = (nfapi_trace_fn_t)config->trace;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
|
||||
|
||||
int p5ListenSock, p5Sock;
|
||||
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrSize;
|
||||
|
||||
struct sockaddr_in6 addr6;
|
||||
|
||||
struct sctp_event_subscribe events;
|
||||
struct sctp_initmsg initMsg;
|
||||
int noDelay;
|
||||
|
||||
(void)memset(&addr, 0, sizeof(struct sockaddr_in));
|
||||
(void)memset(&addr6, 0, sizeof(struct sockaddr_in6));
|
||||
(void)memset(&events, 0, sizeof(struct sctp_event_subscribe));
|
||||
(void)memset(&initMsg, 0, sizeof(struct sctp_initmsg));
|
||||
|
||||
vnf_t* vnf = (vnf_t*)(config);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 VNF connection on port %u\n", config->vnf_p5_port);
|
||||
|
||||
/*
|
||||
char * host = 0;
|
||||
char * port = "4242";
|
||||
struct addrinfo hints;
|
||||
bzero(&hints, sizeof(struct addrinfo));
|
||||
//hints.ai_flags=AI_PASSIVE;
|
||||
//hints.ai_flags=AI_DEFAULT;
|
||||
hints.ai_family=AF_UNSPEC;
|
||||
//hints.ai_family=AF_INET6;
|
||||
hints.ai_socktype=SOCK_STREAM;
|
||||
//hints.ai_protocol=IPPROTO_SCTP
|
||||
|
||||
struct addrinfo *aiHead = 0;
|
||||
|
||||
|
||||
|
||||
int result = getaddrinfo(host, port, &hints, &aiHead);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "getaddrinfo return %d %d\n", result, errno);
|
||||
|
||||
while(aiHead->ai_next != NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "addr info %d (IP %d UDP %d SCTP %d)\n %d (%d)\n",
|
||||
aiHead->ai_protocol, IPPROTO_IP, IPPROTO_UDP, IPPROTO_SCTP,
|
||||
aiHead->ai_flags, AI_PASSIVE);
|
||||
|
||||
char hostBfr[ NI_MAXHOST ];
|
||||
char servBfr[ NI_MAXSERV ];
|
||||
|
||||
getnameinfo(aiHead->ai_addr,
|
||||
aiHead->ai_addrlen,
|
||||
hostBfr,
|
||||
sizeof( hostBfr ),
|
||||
servBfr,
|
||||
sizeof( servBfr ),
|
||||
NI_NUMERICHOST | NI_NUMERICSERV );
|
||||
|
||||
switch(aiHead->ai_family)
|
||||
{
|
||||
case PF_INET:
|
||||
{
|
||||
struct sockaddr_in *pSadrIn = (struct sockaddr_in*) aiHead->ai_addr;
|
||||
printf(
|
||||
" ai_addr = sin_family: %d (AF_INET = %d, "
|
||||
"AF_INET6 = %d)\n"
|
||||
" sin_addr: %s\n"
|
||||
" sin_port: %s\n",
|
||||
pSadrIn->sin_family,
|
||||
AF_INET,
|
||||
AF_INET6,
|
||||
hostBfr,
|
||||
servBfr );
|
||||
}
|
||||
break;
|
||||
case PF_INET6:
|
||||
{
|
||||
struct sockaddr_in6 *pSadrIn6 = (struct sockaddr_in6*) aiHead->ai_addr;
|
||||
fprintf( stderr,
|
||||
" ai_addr = sin6_family: %d (AF_INET = %d, "
|
||||
"AF_INET6 = %d) \n"
|
||||
" sin6_addr: %s\n"
|
||||
" sin6_port: %s\n"
|
||||
" sin6_flowinfo: %d\n"
|
||||
" sin6_scope_id: %d\n",
|
||||
pSadrIn6->sin6_family,
|
||||
AF_INET,
|
||||
AF_INET6,
|
||||
hostBfr,
|
||||
servBfr,
|
||||
pSadrIn6->sin6_flowinfo,
|
||||
pSadrIn6->sin6_scope_id);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Not ment to be here\n");
|
||||
break;
|
||||
}
|
||||
|
||||
aiHead = aiHead->ai_next;
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
int protocol;
|
||||
int domain;
|
||||
|
||||
if (vnf->sctp)
|
||||
protocol = IPPROTO_SCTP;
|
||||
else
|
||||
protocol = IPPROTO_IP;
|
||||
|
||||
if(config->vnf_ipv6)
|
||||
{
|
||||
domain = PF_INET6;
|
||||
}
|
||||
else
|
||||
{
|
||||
domain = AF_INET;
|
||||
}
|
||||
|
||||
// open the SCTP socket
|
||||
if ((p5ListenSock = socket(domain, SOCK_STREAM, protocol)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
|
||||
return 0;
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created... %d\n", p5ListenSock);
|
||||
}
|
||||
|
||||
if (vnf->sctp)
|
||||
{
|
||||
// configure for MSG_NOTIFICATION
|
||||
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof(struct sctp_event_subscribe)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_EVENTS) errno: %d\n", errno);
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF Setting the SCTP_INITMSG\n");
|
||||
// configure the SCTP socket options
|
||||
initMsg.sinit_num_ostreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater
|
||||
initMsg.sinit_max_instreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater
|
||||
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno)
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
noDelay = 1;
|
||||
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_NODELAY, &noDelay, sizeof(noDelay)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (STCP_NODELAY) errno: %d\n", errno);
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
struct sctp_event_subscribe events;
|
||||
memset( (void *)&events, 0, sizeof(events) );
|
||||
events.sctp_data_io_event = 1;
|
||||
|
||||
if(setsockopt(p5ListenSock, SOL_SCTP, SCTP_EVENTS, (const void *)&events, sizeof(events)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt errno: %d\n", errno);
|
||||
close(p5ListenSock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(config->vnf_ipv6)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV6 binding to port %d %d\n", config->vnf_p5_port, p5ListenSock);
|
||||
addr6.sin6_family = AF_INET6;
|
||||
addr6.sin6_port = htons(config->vnf_p5_port);
|
||||
addr6.sin6_addr = in6addr_any;
|
||||
|
||||
// bind to the configured address and port
|
||||
if (bind(p5ListenSock, (struct sockaddr *)&addr6, sizeof(struct sockaddr_in6)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if(config->vnf_ipv4)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "IPV4 binding to port %d\n", config->vnf_p5_port);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(config->vnf_p5_port);
|
||||
addr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
// bind to the configured address and port
|
||||
if (bind(p5ListenSock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
|
||||
//if (sctp_bindx(p5ListenSock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), SCTP_BINDX_ADD_ADDR) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "bind succeeded..%d.\n", p5ListenSock);
|
||||
|
||||
// put the socket into listen mode
|
||||
if (listen(p5ListenSock, 2) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After listen errno: %d\n", errno);
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "listen succeeded...\n");
|
||||
|
||||
struct timeval tv;
|
||||
fd_set read_fd_set;
|
||||
|
||||
|
||||
int p5_idx = 0;
|
||||
while(vnf->terminate == 0)
|
||||
{
|
||||
FD_ZERO(&read_fd_set);
|
||||
|
||||
FD_SET(p5ListenSock, &read_fd_set);
|
||||
int max_fd = p5ListenSock;
|
||||
|
||||
tv.tv_sec = 5;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
|
||||
while(pnf != 0)
|
||||
{
|
||||
if(pnf->connected)
|
||||
{
|
||||
FD_SET(pnf->p5_sock, &read_fd_set);
|
||||
if (pnf->p5_sock > max_fd)
|
||||
{
|
||||
max_fd = pnf->p5_sock;
|
||||
}
|
||||
}
|
||||
|
||||
pnf = pnf->next;
|
||||
}
|
||||
|
||||
int select_result = select(max_fd + 1, &read_fd_set, 0, 0, &tv);
|
||||
|
||||
if(select_result == -1)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "select result %d errno %d\n", select_result, errno);
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
else if(select_result)
|
||||
{
|
||||
if(FD_ISSET(p5ListenSock, &read_fd_set))
|
||||
{
|
||||
addrSize = sizeof(struct sockaddr_in);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Accepting connection from PNF...\n");
|
||||
|
||||
p5Sock = accept(p5ListenSock, (struct sockaddr *)&addr, &addrSize);
|
||||
|
||||
if (p5Sock < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to accept PNF connection reason:%d\n", errno);
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF connection (fd:%d) accepted from %s:%d \n", p5Sock, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||
nfapi_vnf_pnf_info_t* pnf = (nfapi_vnf_pnf_info_t*)malloc(sizeof(nfapi_vnf_pnf_info_t));
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
|
||||
memset(pnf, 0, sizeof(nfapi_vnf_pnf_info_t));
|
||||
pnf->p5_sock = p5Sock;
|
||||
pnf->p5_idx = p5_idx++;
|
||||
pnf->p5_pnf_sockaddr = addr;
|
||||
pnf->connected = 1;
|
||||
|
||||
nfapi_vnf_pnf_list_add(config, pnf);
|
||||
|
||||
// Inform mac that a pnf connection has been established
|
||||
// todo : allow mac to 'accept' the connection. i.e. to
|
||||
// reject it.
|
||||
if(config->pnf_nr_connection_indication != 0)
|
||||
{
|
||||
(config->pnf_nr_connection_indication)(config, pnf->p5_idx);
|
||||
}
|
||||
|
||||
|
||||
// check the connection status
|
||||
{
|
||||
struct sctp_status status;
|
||||
(void)memset(&status, 0, sizeof(struct sctp_status));
|
||||
socklen_t optLen = (socklen_t) sizeof(struct sctp_status);
|
||||
if (getsockopt(p5Sock, IPPROTO_SCTP, SCTP_STATUS, &status, &optLen) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After getsockopt errno: %d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Association ID = %d\n", status.sstat_assoc_id);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Receiver window size = %d\n", status.sstat_rwnd);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF In Streams = %d\n", status.sstat_instrms);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF Out Streams = %d\n", status.sstat_outstrms);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t delete_pnfs = 0;
|
||||
|
||||
nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
|
||||
while(pnf != 0)
|
||||
{
|
||||
if(FD_ISSET(pnf->p5_sock, &read_fd_set))
|
||||
{
|
||||
if(vnf_nr_read_dispatch_message(config, pnf) == 0)
|
||||
{
|
||||
if(config->pnf_disconnect_indication != 0)
|
||||
{
|
||||
(config->pnf_disconnect_indication)(config, pnf->p5_idx);
|
||||
}
|
||||
|
||||
close(pnf->p5_sock);
|
||||
|
||||
pnf->to_delete = 1;
|
||||
delete_pnfs = 1;
|
||||
}
|
||||
}
|
||||
|
||||
pnf = pnf->next;
|
||||
}
|
||||
|
||||
if(delete_pnfs)
|
||||
{
|
||||
nfapi_vnf_pnf_info_t* pnf = config->pnf_list;
|
||||
nfapi_vnf_pnf_info_t* prev = 0;
|
||||
while(pnf != 0)
|
||||
{
|
||||
nfapi_vnf_pnf_info_t* curr = pnf;
|
||||
|
||||
if(pnf->to_delete == 1)
|
||||
{
|
||||
if(prev == 0)
|
||||
{
|
||||
config->pnf_list = pnf->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev->next = pnf->next;
|
||||
}
|
||||
|
||||
pnf = pnf->next;
|
||||
|
||||
free(curr);
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = pnf;
|
||||
pnf = pnf->next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// timeout
|
||||
|
||||
// Should we test for socket closure here every second?
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Sock socket's\n");
|
||||
{
|
||||
nfapi_vnf_pnf_info_t* curr = config->pnf_list;
|
||||
while(curr != NULL)
|
||||
{
|
||||
if(config->pnf_disconnect_indication)
|
||||
{
|
||||
(config->pnf_disconnect_indication)(config, curr->p5_idx);
|
||||
}
|
||||
|
||||
close(curr->p5_sock);
|
||||
curr = curr->next;
|
||||
}
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p5Listen socket\n");
|
||||
close(p5ListenSock);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int nfapi_vnf_start(nfapi_vnf_config_t* config)
|
||||
{
|
||||
// Verify that config is not null
|
||||
@@ -486,6 +898,16 @@ int nfapi_vnf_stop(nfapi_vnf_config_t* config)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nfapi_nr_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_param_request_t));
|
||||
}
|
||||
|
||||
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
@@ -496,6 +918,17 @@ int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_pa
|
||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_param_request_t));
|
||||
}
|
||||
|
||||
int nfapi_nr_vnf_pnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_config_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_config_request_t));
|
||||
}
|
||||
|
||||
|
||||
int nfapi_vnf_pnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_config_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
@@ -516,6 +949,16 @@ int nfapi_vnf_pnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_st
|
||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_start_request_t));
|
||||
}
|
||||
|
||||
int nfapi_nr_vnf_pnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_start_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_start_request_t));
|
||||
}
|
||||
|
||||
int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
@@ -526,6 +969,16 @@ int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_sto
|
||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_pnf_stop_request_t));
|
||||
}
|
||||
|
||||
int nfapi_nr_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_request_scf_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_param_request_scf_t));
|
||||
}
|
||||
|
||||
int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
@@ -535,6 +988,38 @@ int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_requ
|
||||
|
||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_param_request_t));
|
||||
}
|
||||
|
||||
int nfapi_nr_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config_request_scf_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
nfapi_vnf_phy_info_t* phy = nfapi_vnf_phy_info_list_find(config, req->header.phy_id);
|
||||
|
||||
if(phy == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "%s failed to find phy information phy_id:%d\n", __FUNCTION__, req->header.phy_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// set the timing parameters
|
||||
req->nfapi_config.timing_window.tl.tag = NFAPI_NR_NFAPI_TIMING_WINDOW_TAG;
|
||||
req->nfapi_config.timing_window.value = phy->timing_window;
|
||||
req->num_tlv++;
|
||||
|
||||
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG;
|
||||
req->nfapi_config.timing_info_mode.value = phy->timing_info_mode;
|
||||
req->num_tlv++;
|
||||
|
||||
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG;
|
||||
req->nfapi_config.timing_info_period.value = phy->timing_info_period;
|
||||
req->num_tlv++;
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_config_request_scf_t));
|
||||
}
|
||||
|
||||
int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
@@ -565,7 +1050,8 @@ int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_re
|
||||
|
||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_config_request_t));
|
||||
}
|
||||
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t* req)
|
||||
|
||||
int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_request_t * req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
@@ -574,6 +1060,18 @@ int nfapi_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_requ
|
||||
|
||||
return vnf_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_start_request_t));
|
||||
}
|
||||
|
||||
int nfapi_nr_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_request_scf_t * req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_start_request_scf_t));
|
||||
}
|
||||
|
||||
|
||||
int nfapi_vnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
@@ -664,7 +1162,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
|
||||
info->p5_idx = p5_idx;
|
||||
info->phy_id = vnf->next_phy_id++;
|
||||
|
||||
info->timing_window = 30; // This seems to override what gets set by the user - why???
|
||||
info->timing_window = 30; // This seems to override what gets set by the user - why??? //TODO: Change in NR in terms of microsecends,what should be the value?
|
||||
info->timing_info_mode = 0x03;
|
||||
info->timing_info_period = 128;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,7 @@
|
||||
|
||||
#define FAPI2_IP_DSCP 0
|
||||
|
||||
|
||||
nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
|
||||
{
|
||||
vnf_p7_t* _this = (vnf_p7_t*)calloc(1, sizeof(vnf_p7_t));
|
||||
@@ -90,6 +91,368 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
|
||||
|
||||
// monitor the p7 endpoints and the timing loop and
|
||||
// send indications to mac
|
||||
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
{
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
|
||||
// Create p7 receive udp port
|
||||
// todo : this needs updating for Ipv6
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port);
|
||||
|
||||
// open the UDP socket
|
||||
if ((vnf_p7->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P7 socket errno: %d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 socket created...\n");
|
||||
|
||||
// configure the UDP socket options
|
||||
int iptos_value = FAPI2_IP_DSCP << 2;
|
||||
if (setsockopt(vnf_p7->socket, IPPROTO_IP, IP_TOS, &iptos_value, sizeof(iptos_value)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (IP_TOS) errno: %d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 setsockopt succeeded...\n");
|
||||
|
||||
// Create the address structure
|
||||
struct sockaddr_in addr;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(config->port);
|
||||
addr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
// bind to the configured port
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 binding too %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||
if (bind(vnf_p7->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) < 0)
|
||||
//if (sctp_bindx(config->socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in), 0) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After bind errno: %d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 bind succeeded...\n");
|
||||
|
||||
|
||||
//struct timespec original_pselect_timeout;
|
||||
struct timespec pselect_timeout;
|
||||
pselect_timeout.tv_sec = 0;
|
||||
pselect_timeout.tv_nsec = 500000; // ns in a 0.5 ms
|
||||
//pselect_timeout.tv_nsec = 500000;
|
||||
|
||||
struct timespec pselect_start;
|
||||
struct timespec pselect_stop;
|
||||
|
||||
//struct timespec sf_end;
|
||||
|
||||
long last_millisecond = -1;
|
||||
|
||||
|
||||
// struct timespec sf_duration; //Change to slot_duration?
|
||||
// sf_duration.tv_sec = 0;
|
||||
// sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR
|
||||
struct timespec slot_duration;
|
||||
slot_duration.tv_sec = 0;
|
||||
//slot_duration.tv_nsec = 0.5e6;
|
||||
slot_duration.tv_nsec = 0.5e6;
|
||||
|
||||
|
||||
// struct timespec sf_start; //Change to slot_start?
|
||||
struct timespec slot_start;
|
||||
// clock_gettime(CLOCK_MONOTONIC, &sf_start);
|
||||
clock_gettime(CLOCK_MONOTONIC, &slot_start);
|
||||
long millisecond = slot_start.tv_nsec / 1e6; //Check if we have to change
|
||||
//long millisecond = slot_start.tv_nsec / 0.5e6;
|
||||
// sf_start = timespec_add(sf_start, sf_duration);
|
||||
slot_start = timespec_add(slot_start, slot_duration);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", slot_start.tv_sec, slot_start.tv_nsec);
|
||||
|
||||
while(vnf_p7->terminate == 0)
|
||||
{
|
||||
fd_set rfds;
|
||||
int maxSock = 0;
|
||||
FD_ZERO(&rfds);
|
||||
int selectRetval = 0;
|
||||
|
||||
// Add the p7 socket
|
||||
FD_SET(vnf_p7->socket, &rfds);
|
||||
maxSock = vnf_p7->socket;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &pselect_start);
|
||||
//long millisecond = pselect_start.tv_nsec / 1e6;
|
||||
|
||||
if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) )
|
||||
{
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
|
||||
|
||||
|
||||
//if((pselect_start.tv_sec > sf_start.tv_sec) ||
|
||||
// ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
|
||||
if((pselect_start.tv_sec > slot_start.tv_sec) || ((pselect_start.tv_sec == slot_start.tv_sec) && (pselect_start.tv_nsec > slot_start.tv_nsec)))
|
||||
{
|
||||
// overran the end of the subframe we do not want to wait
|
||||
pselect_timeout.tv_sec = 0;
|
||||
pselect_timeout.tv_nsec = 0;
|
||||
|
||||
//struct timespec overrun = timespec_sub(pselect_start, sf_start);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec);
|
||||
}
|
||||
else
|
||||
{
|
||||
// still time before the end of the subframe wait
|
||||
//pselect_timeout = timespec_sub(sf_start, pselect_start);
|
||||
pselect_timeout = timespec_sub(slot_start, pselect_start);
|
||||
}
|
||||
|
||||
//original_pselect_timeout = pselect_timeout;
|
||||
|
||||
// detemine how long to sleep in ns before the start of the next 1ms
|
||||
//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
|
||||
|
||||
//uint8_t underrun_possible =0;
|
||||
|
||||
// if we are not sleeping until the next milisecond due to the
|
||||
// insycn minor adjment flag it so we don't consider it an error
|
||||
//uint8_t underrun_possible =0;
|
||||
/*
|
||||
{
|
||||
nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
|
||||
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0 && pselect_start.tv_nsec != 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %d (%d->%d)\n", phy->insync_minor_adjustment,
|
||||
pselect_timeout.tv_nsec, pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000))
|
||||
if(phy->insync_minor_adjustment > 0)
|
||||
{
|
||||
// todo check we don't go below 0
|
||||
if((phy->insync_minor_adjustment * 1000) > pselect_timeout.tv_nsec)
|
||||
pselect_timeout.tv_nsec = 0;
|
||||
else
|
||||
pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
|
||||
|
||||
|
||||
//underrun_possible = 1;
|
||||
}
|
||||
else if(phy->insync_minor_adjustment < 0)
|
||||
{
|
||||
// todo check we don't go below 0
|
||||
pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
|
||||
|
||||
|
||||
//phy->insync_minor_adjustment = 0;
|
||||
phy->insync_minor_adjustment_duration--;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//long wraps = pselect_timeout.tv_nsec % 1e9;
|
||||
|
||||
|
||||
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||
// selectRetval = pselect(120, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
|
||||
|
||||
nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
|
||||
|
||||
if (selectRetval==-1 && errno == 22)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
|
||||
// pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||
// phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||
// sf_duration.tv_sec, sf_duration.tv_nsec);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
|
||||
pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||
slot_duration.tv_sec, slot_duration.tv_nsec);
|
||||
|
||||
}
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
// calculate the start of the next slot
|
||||
//sf_start = timespec_add(sf_start, sf_duration);
|
||||
slot_start = timespec_add(slot_start, slot_duration);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||
|
||||
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
|
||||
{
|
||||
long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
|
||||
|
||||
//sf_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||
slot_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||
|
||||
#if 1
|
||||
/* if (sf_start.tv_nsec > 1e9) //Change to 0.5e6?
|
||||
{
|
||||
sf_start.tv_sec++;
|
||||
sf_start.tv_nsec-=1e9;
|
||||
}
|
||||
else if (sf_start.tv_nsec < 0)
|
||||
{
|
||||
sf_start.tv_sec--;
|
||||
sf_start.tv_nsec+=1e9;
|
||||
}*/
|
||||
if (slot_start.tv_nsec > 1e9)
|
||||
{
|
||||
slot_start.tv_sec++;
|
||||
slot_start.tv_nsec-=1e9;
|
||||
}
|
||||
else if (slot_start.tv_nsec < 0)
|
||||
{
|
||||
slot_start.tv_sec--;
|
||||
slot_start.tv_nsec+=1e9;
|
||||
}
|
||||
#else
|
||||
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
|
||||
if(phy->insync_minor_adjustment > 0)
|
||||
{
|
||||
// decrease the subframe duration a little
|
||||
if (sf_start.tv_nsec > insync_minor_adjustment_ns)
|
||||
sf_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
|
||||
sf_start.tv_sec--;
|
||||
sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
|
||||
}
|
||||
}
|
||||
else if(phy->insync_minor_adjustment < 0)
|
||||
{
|
||||
// todo check we don't go below 0
|
||||
// increase the subframe duration a little
|
||||
sf_start.tv_nsec += insync_minor_adjustment_ns;
|
||||
|
||||
if (sf_start.tv_nsec < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||
sf_start.tv_sec++;
|
||||
sf_start.tv_nsec += 1e9;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//phy->insync_minor_adjustment = 0;
|
||||
phy->insync_minor_adjustment_duration--;
|
||||
|
||||
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
|
||||
// phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
|
||||
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Slot minor adjustment %dus slot_start.tv_nsec:%d duration:%u\n",
|
||||
// phy->insync_minor_adjustment, slot_start.tv_nsec, phy->insync_minor_adjustment_duration);
|
||||
|
||||
if (phy->insync_minor_adjustment_duration==0)
|
||||
{
|
||||
phy->insync_minor_adjustment = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
|
||||
if(millisecond == pselect_stop_millisecond)
|
||||
{
|
||||
// we have woke up in the same subframe
|
||||
if(underrun_possible == 0)
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect underrun %ld (%d.%d)\n", millisecond, pselect_stop.tv_sec, pselect_stop.tv_nsec);
|
||||
}
|
||||
else if(((millisecond + 1) % 1000) != pselect_stop_millisecond)
|
||||
{
|
||||
// we have overrun the subframe
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect overrun %ld %ld\n", millisecond, pselect_stop_millisecond);
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe underrun %ld\n", millisecond);
|
||||
}
|
||||
last_millisecond = millisecond;
|
||||
*/
|
||||
|
||||
//millisecond ++;
|
||||
millisecond = millisecond + 1;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// we have overrun the subframe advance to go and collect $200
|
||||
|
||||
if((millisecond - last_millisecond) > 3)
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1);
|
||||
|
||||
last_millisecond = ( last_millisecond + 1 ) % 1000;
|
||||
selectRetval = 0;
|
||||
}
|
||||
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
//vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
|
||||
vnf_p7->slot_start_time_hr = vnf_get_current_time_hr();
|
||||
struct timespec current_time;
|
||||
clock_gettime(CLOCK_MONOTONIC, ¤t_time);
|
||||
// pselect timed out
|
||||
nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
|
||||
while(curr != 0)
|
||||
{
|
||||
if (curr->slot == 19)
|
||||
{ //curr->slot = 0;
|
||||
if(curr->sfn == 1023)
|
||||
curr->sfn=0;
|
||||
else
|
||||
curr->sfn++;
|
||||
curr->slot=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
curr->slot++;
|
||||
}
|
||||
vnf_nr_sync(vnf_p7, curr);
|
||||
curr = curr->next;
|
||||
}
|
||||
send_mac_slot_indications(vnf_p7);
|
||||
}
|
||||
else if(selectRetval > 0)
|
||||
{
|
||||
// have a p7 message
|
||||
if(FD_ISSET(vnf_p7->socket, &rfds))
|
||||
{
|
||||
vnf_nr_p7_read_dispatch_message(vnf_p7);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// pselect error
|
||||
if(selectRetval == -1 && errno == EINTR)
|
||||
{
|
||||
// a sigal was received.
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
|
||||
// should we exit now?
|
||||
if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
|
||||
{
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
|
||||
close(vnf_p7->socket);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() returning\n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
{
|
||||
if(config == 0)
|
||||
@@ -408,6 +771,7 @@ if (selectRetval==-1 && errno == 22)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config)
|
||||
{
|
||||
if(config == 0)
|
||||
@@ -434,17 +798,18 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr,
|
||||
memset(node, 0, sizeof(nfapi_vnf_p7_connection_info_t));
|
||||
node->phy_id = phy_id;
|
||||
node->in_sync = 0;
|
||||
node->dl_out_sync_offset = 30;
|
||||
node->dl_out_sync_offset = 30;//TODO: Values need to be changed for NR,How to set the values
|
||||
node->dl_out_sync_period = 10;
|
||||
node->dl_in_sync_offset = 30;
|
||||
node->dl_in_sync_period = 512;
|
||||
node->sfn_sf = 0;
|
||||
|
||||
//node->sfn_sf = 0;
|
||||
node->sfn = 0;
|
||||
node->slot = 0;
|
||||
node->min_sync_cycle_count = 8;
|
||||
|
||||
// save the remote endpoint information
|
||||
node->remote_addr.sin_family = AF_INET;
|
||||
node->remote_addr.sin_port = htons(pnf_p7_port);
|
||||
node->remote_addr.sin_port = pnf_p7_port;//htons(pnf_p7_port);
|
||||
node->remote_addr.sin_addr.s_addr = inet_addr(pnf_p7_addr);
|
||||
|
||||
vnf_p7_connection_info_list_add(vnf_p7, node);
|
||||
@@ -490,7 +855,16 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
|
||||
int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
|
||||
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req)
|
||||
@@ -501,6 +875,14 @@ int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_re
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
int nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
@@ -509,6 +891,14 @@ int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_reques
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
int nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
|
||||
+48
-12
@@ -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() {
|
||||
|
||||
@@ -381,6 +414,13 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Adding nr_schedule_handler
|
||||
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst)
|
||||
{
|
||||
if_inst->NR_PHY_config_req = nr_phy_config_request;
|
||||
if_inst->NR_Schedule_response = nr_schedule_response;
|
||||
}
|
||||
/*
|
||||
void install_schedule_handlers(IF_Module_t *if_inst)
|
||||
{
|
||||
@@ -448,7 +488,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;
|
||||
@@ -459,13 +498,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<<gNB_config->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];
|
||||
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;
|
||||
@@ -494,11 +529,12 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -335,7 +335,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
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( 4*fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
}
|
||||
|
||||
|
||||
@@ -350,7 +349,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_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]->rho[idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -357,9 +357,8 @@ 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);
|
||||
|
||||
@@ -418,10 +418,10 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue,
|
||||
|
||||
void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
||||
{
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i dft_in128[1][1200], dft_out128[1][1200];
|
||||
#if defined(__x86_64__) || +defined(__i386__)
|
||||
__m128i dft_in128[1][3240], dft_out128[1][3240];
|
||||
#elif defined(__arm__)
|
||||
int16x8_t dft_in128[1][1200], dft_out128[1][1200];
|
||||
int16x8_t dft_in128[1][3240], dft_out128[1][3240];
|
||||
#endif
|
||||
uint32_t *dft_in0 = (uint32_t*)dft_in128[0], *dft_out0 = (uint32_t*)dft_out128[0];
|
||||
|
||||
@@ -433,8 +433,10 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
||||
int16x8_t norm128;
|
||||
#endif
|
||||
|
||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
|
||||
dft_in0[ip] = d[i];
|
||||
if ((Msc_PUSCH % 1536) > 0) {
|
||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
|
||||
dft_in0[ip] = d[i];
|
||||
}
|
||||
}
|
||||
|
||||
switch (Msc_PUSCH) {
|
||||
@@ -573,7 +575,7 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
||||
break;
|
||||
|
||||
case 972:
|
||||
dft(DFT_960,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
dft(DFT_972,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1080:
|
||||
@@ -587,44 +589,159 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
|
||||
case 1200:
|
||||
dft(DFT_1200,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1296:
|
||||
dft(DFT_1296,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1440:
|
||||
dft(DFT_1440,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1500:
|
||||
dft(DFT_1500,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1536:
|
||||
//dft(DFT_1536,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
dft(DFT_1536,(int16_t*)d, (int16_t*)z, 1);
|
||||
break;
|
||||
|
||||
case 1620:
|
||||
dft(DFT_1620,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1728:
|
||||
dft(DFT_1728,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1800:
|
||||
dft(DFT_1800,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1920:
|
||||
dft(DFT_1920,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1944:
|
||||
dft(DFT_1944,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2160:
|
||||
dft(DFT_2160,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2304:
|
||||
dft(DFT_2304,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2400:
|
||||
dft(DFT_2400,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2592:
|
||||
dft(DFT_2592,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2700:
|
||||
dft(DFT_2700,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2880:
|
||||
dft(DFT_2880,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2916:
|
||||
dft(DFT_2916,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 3000:
|
||||
dft(DFT_3000,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
case 3072:
|
||||
//dft(DFT_3072,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
dft(DFT_3072,(int16_t*)d, (int16_t*)z, 1);
|
||||
break;
|
||||
|
||||
case 3240:
|
||||
dft(DFT_3240,(int16_t*)dft_in0, (int16_t*)dft_out0, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
// should not be reached
|
||||
LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
|
||||
z[i] = dft_out0[ip];
|
||||
|
||||
if ((Msc_PUSCH % 1536) > 0) {
|
||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4)
|
||||
z[i] = dft_out0[ip];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp,uint64_t CarrierFreq)
|
||||
{
|
||||
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
|
||||
|
||||
uint64_t dl_CarrierFreq = fp->dl_CarrierFreq;
|
||||
uint64_t ul_CarrierFreq = fp->ul_CarrierFreq;
|
||||
double f[2] = {(double)dl_CarrierFreq, (double)ul_CarrierFreq};
|
||||
|
||||
const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10;
|
||||
const double Tc=(1/480e3/4096);
|
||||
const double Nu=2048*64*(1/(float)(1<<fp->numerology_index));
|
||||
const double f0= (double)CarrierFreq;
|
||||
const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index)));
|
||||
const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index)));
|
||||
double tl=0,poff,exp_re,exp_im;
|
||||
double Ncp,Ncpm1=Ncp0;
|
||||
|
||||
poff = 2*M_PI*((Ncp0*Tc))*f0;
|
||||
exp_re = cos(poff);
|
||||
exp_im = sin(-poff);
|
||||
fp->symbol_rotation[0]=(int16_t)floor(exp_re*32767);
|
||||
fp->symbol_rotation[1]=(int16_t)floor(exp_im*32767);
|
||||
LOG_I(PHY,"Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n",f0,nsymb);
|
||||
LOG_I(PHY,"Symbol rotation %d/%d => (%d,%d)\n",0,nsymb,fp->symbol_rotation[0],fp->symbol_rotation[1]);
|
||||
for (uint8_t ll = 0; ll < 2; ll++){
|
||||
|
||||
for (int l=1; l<nsymb; l++) {
|
||||
if (l==(7*(1<<fp->numerology_index))) Ncp=Ncp0;
|
||||
else Ncp=Ncp1;
|
||||
tl += (Nu+Ncpm1)*Tc;
|
||||
poff = 2*M_PI*(tl + (Ncp*Tc))*f0;
|
||||
exp_re = cos(poff);
|
||||
exp_im = sin(-poff);
|
||||
fp->symbol_rotation[l<<1]=(int16_t)floor(exp_re*32767);
|
||||
fp->symbol_rotation[1+(l<<1)]=(int16_t)floor(exp_im*32767);
|
||||
LOG_I(PHY,"Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n", l, nsymb, tl, fp->symbol_rotation[l<<1], fp->symbol_rotation[1+(l<<1)], (poff/2/M_PI)-floor(poff/2/M_PI));
|
||||
Ncpm1=Ncp;
|
||||
double f0 = f[ll];
|
||||
double Ncpm1 = Ncp0;
|
||||
int16_t *symbol_rotation = fp->symbol_rotation[ll];
|
||||
|
||||
double tl = 0;
|
||||
double poff = 2 * M_PI * ((Ncp0 * Tc)) * f0;
|
||||
double exp_re = cos(poff);
|
||||
double exp_im = sin(-poff);
|
||||
symbol_rotation[0] = (int16_t)floor(exp_re * 32767);
|
||||
symbol_rotation[1] = (int16_t)floor(exp_im * 32767);
|
||||
LOG_I(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb);
|
||||
LOG_I(PHY, "Symbol rotation %d/%d => (%d,%d)\n",
|
||||
0,
|
||||
nsymb,
|
||||
symbol_rotation[0],
|
||||
symbol_rotation[1]);
|
||||
|
||||
for (int l = 1; l < nsymb; l++) {
|
||||
|
||||
double Ncp;
|
||||
if (l == (7 * (1 << fp->numerology_index))) {
|
||||
Ncp = Ncp0;
|
||||
} else {
|
||||
Ncp = Ncp1;
|
||||
}
|
||||
|
||||
tl += (Nu + Ncpm1) * Tc;
|
||||
poff = 2 * M_PI * (tl + (Ncp * Tc)) * f0;
|
||||
exp_re = cos(poff);
|
||||
exp_im = sin(-poff);
|
||||
symbol_rotation[l<<1] = (int16_t)floor(exp_re * 32767);
|
||||
symbol_rotation[1 + (l<<1)] = (int16_t)floor(exp_im * 32767);
|
||||
|
||||
LOG_I(PHY, "Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n",
|
||||
l,
|
||||
nsymb,
|
||||
tl,
|
||||
symbol_rotation[l<<1],
|
||||
symbol_rotation[1 + (l<<1)],
|
||||
(poff / 2 / M_PI) - floor(poff / 2 / M_PI));
|
||||
|
||||
Ncpm1 = Ncp;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
|
||||
int nsymb,
|
||||
int length);
|
||||
|
||||
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp,uint64_t CarrierFreq);
|
||||
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp);
|
||||
|
||||
void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t *rxdataF,
|
||||
|
||||
@@ -306,15 +306,23 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
|
||||
int length) {
|
||||
int symb_offset = (slot%fp->slots_per_subframe)*fp->symbols_per_slot;
|
||||
|
||||
int16_t *symbol_rotation = fp->symbol_rotation[0];
|
||||
|
||||
for (int sidx=0;sidx<nsymb;sidx++) {
|
||||
|
||||
LOG_D(PHY,"Rotating symbol %d, slot %d, symbol_subframe_index %d, length %d (%d,%d)\n",
|
||||
first_symbol+sidx,slot,sidx+first_symbol+symb_offset,length,
|
||||
fp->symbol_rotation[2*(sidx+first_symbol+symb_offset)],fp->symbol_rotation[1+2*(sidx+first_symbol+symb_offset)]);
|
||||
rotate_cpx_vector(trxdata+(sidx*length*2),
|
||||
&fp->symbol_rotation[2*(sidx+first_symbol+symb_offset)],
|
||||
trxdata+(sidx*length*2),
|
||||
length,
|
||||
15);
|
||||
first_symbol + sidx,
|
||||
slot,
|
||||
sidx + first_symbol + symb_offset,
|
||||
length,
|
||||
symbol_rotation[2 * (sidx + first_symbol + symb_offset)],
|
||||
symbol_rotation[1 + 2 * (sidx + first_symbol + symb_offset)]);
|
||||
|
||||
rotate_cpx_vector(trxdata + (sidx * length * 2),
|
||||
&symbol_rotation[2 * (sidx + first_symbol + symb_offset)],
|
||||
trxdata + (sidx * length * 2),
|
||||
length,
|
||||
15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
||||
#endif
|
||||
|
||||
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
|
||||
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset];
|
||||
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset];
|
||||
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
|
||||
rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
|
||||
(int16_t*)&rot2,
|
||||
@@ -386,7 +386,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
|
||||
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset];
|
||||
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset];
|
||||
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
@@ -513,7 +513,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
for (int symbol=0;symbol<nsymb;symbol++) {
|
||||
|
||||
uint32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset];
|
||||
uint32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[1])[symbol + symb_offset];
|
||||
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
|
||||
LOG_D(PHY,"slot %d, symb_offset %d rotating by %d.%d\n",slot,symb_offset,((int16_t*)&rot2)[0],((int16_t*)&rot2)[1]);
|
||||
rotate_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
|
||||
|
||||
@@ -61,8 +61,6 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
debug_ch_est = fopen("debug_ch_est.txt","w");
|
||||
#endif
|
||||
|
||||
//uint16_t Nid_cell = (eNB_offset == 0) ? gNB->frame_parms.Nid_cell : gNB->measurements.adj_cell_id[eNB_offset-1];
|
||||
|
||||
uint8_t nushift;
|
||||
int **ul_ch_estimates = gNB->pusch_vars[ul_id]->ul_ch_estimates;
|
||||
int **rxdataF = gNB->common_vars.rxdataF;
|
||||
@@ -79,12 +77,17 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
uint16_t nb_rb_pusch = pusch_pdu->rb_size;
|
||||
|
||||
/*
|
||||
#ifdef DEBUG_CH
|
||||
printf("PUSCH Channel Estimation : ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n", ,ch_offset,symbol_offset,gNB->frame_parms.ofdm_symbol_size,
|
||||
gNB->frame_parms.Ncp,l,Ns,k, symbol);
|
||||
LOG_D(PHY, "In %s: ch_offset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n",
|
||||
__FUNCTION__,
|
||||
ch_offset,
|
||||
symbol_offset,
|
||||
gNB->frame_parms.ofdm_symbol_size,
|
||||
Ns,
|
||||
k,
|
||||
symbol);
|
||||
#endif
|
||||
*/
|
||||
|
||||
switch (nushift) {
|
||||
case 0:
|
||||
fl = filt8_l0;
|
||||
@@ -124,9 +127,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
|
||||
//------------------generate DMRS------------------//
|
||||
|
||||
if (pusch_pdu->transform_precoding == transform_precoder_disabled)
|
||||
if (pusch_pdu->transform_precoding == transform_precoder_disabled) {
|
||||
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, pusch_pdu->rb_start*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type);
|
||||
|
||||
}
|
||||
else { // if transform precoding or SC-FDMA is enabled in Uplink
|
||||
|
||||
// NR_SC_FDMA supports type1 DMRS so only 6 DMRS REs per RB possible
|
||||
@@ -151,13 +154,19 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
//------------------------------------------------//
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
for (int i=0;i<(6*nb_rb_pusch);i++)
|
||||
printf("%d+j*(%d)\n",((int16_t*)pilot)[2*i],((int16_t*)pilot)[1+(2*i)]);
|
||||
for (int i = 0; i < (6 * nb_rb_pusch); i++) {
|
||||
LOG_I(PHY, "In %s: %d + j*(%d)\n",
|
||||
__FUNCTION__,
|
||||
((int16_t*)pilot)[2 * i],
|
||||
((int16_t*)pilot)[1 + (2 * i)]);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) {
|
||||
|
||||
re_offset = k; /* Initializing the Resource element offset for each Rx antenna */
|
||||
|
||||
pil = (int16_t *)&pilot[0];
|
||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+nushift)];
|
||||
ul_ch = (int16_t *)&ul_ch_estimates[aarx][ch_offset];
|
||||
@@ -166,11 +175,11 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size));
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("symbol_offset %d, nushift %d\n",symbol_offset,nushift);
|
||||
printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], gNB->frame_parms.N_RB_UL);
|
||||
printf("bwp_start_subcarrier %d, k %d, first_carrier %d, nb_rb_pusch %d\n",bwp_start_subcarrier,k,gNB->frame_parms.first_carrier_offset,nb_rb_pusch);
|
||||
printf("rxF addr %p p %d\n", rxF,p);
|
||||
printf("ul_ch addr %p nushift %d\n",ul_ch,nushift);
|
||||
LOG_I(PHY, "In %s symbol_offset %d, nushift %d\n", __FUNCTION__, symbol_offset, nushift);
|
||||
LOG_I(PHY, "In %s ch est pilot addr %p, N_RB_UL %d\n", __FUNCTION__, &pilot[0], gNB->frame_parms.N_RB_UL);
|
||||
LOG_I(PHY, "In %s bwp_start_subcarrier %d, k %d, first_carrier %d, nb_rb_pusch %d\n", __FUNCTION__, bwp_start_subcarrier, k, gNB->frame_parms.first_carrier_offset, nb_rb_pusch);
|
||||
LOG_I(PHY, "In %s rxF addr %p p %d\n", __FUNCTION__, rxF, p);
|
||||
LOG_I(PHY, "In %s ul_ch addr %p nushift %d\n", __FUNCTION__, ul_ch, nushift);
|
||||
#endif
|
||||
//if ((gNB->frame_parms.N_RB_UL&1)==0) {
|
||||
|
||||
@@ -181,9 +190,18 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
|
||||
printf("pilot 0 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]);
|
||||
printf("data 0 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3]));
|
||||
LOG_I(PHY, "In %s ch 0 %d\n", __FUNCTION__, ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
|
||||
LOG_I(PHY, "In %s pilot 0 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",
|
||||
__FUNCTION__,
|
||||
rxF[0],
|
||||
rxF[1],
|
||||
dBc(rxF[0],rxF[1]),
|
||||
ch[0],
|
||||
ch[1],
|
||||
dBc(ch[0],ch[1]),
|
||||
pil[0],
|
||||
pil[1]);
|
||||
LOG_I(PHY, "In %s data 0 : rxF - > (%d,%d) (%d)\n", __FUNCTION__, rxF[2], rxF[3], dBc(rxF[2],rxF[3]));
|
||||
#endif
|
||||
|
||||
multadd_real_vector_complex_scalar(fl,
|
||||
@@ -200,9 +218,23 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot 1 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]);
|
||||
printf("data 1 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3]));
|
||||
LOG_I(PHY, "In %s pilot 1 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",
|
||||
__FUNCTION__,
|
||||
rxF[0],
|
||||
rxF[1],
|
||||
dBc(rxF[0],rxF[1]),
|
||||
ch[0],
|
||||
ch[1],
|
||||
dBc(ch[0],ch[1]),
|
||||
pil[0],
|
||||
pil[1]);
|
||||
LOG_I(PHY, "In %s data 1 : rxF - > (%d,%d) (%d)\n",
|
||||
__FUNCTION__,
|
||||
rxF[2],
|
||||
rxF[3],
|
||||
dBc(rxF[2],rxF[3]));
|
||||
#endif
|
||||
|
||||
multadd_real_vector_complex_scalar(fml,
|
||||
ch,
|
||||
ul_ch,
|
||||
@@ -216,9 +248,23 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
|
||||
|
||||
#ifdef DEBUG_PUSCH
|
||||
printf("pilot 2 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]);
|
||||
printf("data 2 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3]));
|
||||
LOG_I(PHY, "In %s pilot 2 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",
|
||||
__FUNCTION__,
|
||||
rxF[0],
|
||||
rxF[1],
|
||||
dBc(rxF[0],rxF[1]),
|
||||
ch[0],
|
||||
ch[1],
|
||||
dBc(ch[0],ch[1]),
|
||||
pil[0],
|
||||
pil[1]);
|
||||
LOG_I(PHY, "In %s data 2 : rxF - > (%d,%d) (%d)\n",
|
||||
__FUNCTION__,
|
||||
rxF[2],
|
||||
rxF[3],
|
||||
dBc(rxF[2],rxF[3]));
|
||||
#endif
|
||||
|
||||
multadd_real_vector_complex_scalar(fmm,
|
||||
ch,
|
||||
ul_ch,
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
#include "PHY/defs_gNB.h"
|
||||
|
||||
/*Table 7.4.1.1.2-1/2 from 38.211 */
|
||||
int wf1[8][2] = {{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,1}};
|
||||
int wf1[8][2] = {{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1}};
|
||||
int wt1[8][2] = {{1,1},{1,1},{1,1},{1,1},{1,-1},{1,-1},{1,-1},{1,-1}};
|
||||
int wf2[12][2] = {{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,1},{1,1},{1,-1},{1,1},{1,1}};
|
||||
int wf2[12][2] = {{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1}};
|
||||
int wt2[12][2] = {{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,-1},{1,-1},{1,-1},{1,-1},{1,-1},{1,-1}};
|
||||
|
||||
// complex conjugate of mod table
|
||||
|
||||
@@ -51,7 +51,7 @@ void init_byte2m64(void) {
|
||||
((int16_t*)&byte2m64_re[s])[0],((int16_t*)&byte2m64_im[s])[0],
|
||||
((int16_t*)&byte2m64_re[s])[1],((int16_t*)&byte2m64_im[s])[1],
|
||||
((int16_t*)&byte2m64_re[s])[2],((int16_t*)&byte2m64_im[s])[2],
|
||||
((int16_t*)&byte2m64_re[s])[3],((int16_t*)&byte2m64_im[s])[3]);
|
||||
((int16_t*)&byte2m64_re[s])[3],((int16_t*)&byte2m64_im[s])[3]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,19 +148,18 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
uint16_t n_dmrs;
|
||||
if (rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1) {
|
||||
nb_re_dmrs = 6*rel15->numDmrsCdmGrpsNoData;
|
||||
n_dmrs = ((rel15->rbSize+rel15->rbStart)*6)<<1;
|
||||
}
|
||||
else {
|
||||
nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData;
|
||||
n_dmrs = ((rel15->rbSize+rel15->rbStart)*4)<<1;
|
||||
}
|
||||
n_dmrs = (rel15->rbSize+rel15->rbStart)*nb_re_dmrs;
|
||||
|
||||
uint16_t dmrs_symbol_map = rel15->dlDmrsSymbPos;//single DMRS: 010000100 Double DMRS 110001100
|
||||
uint8_t dmrs_len = get_num_dmrs(rel15->dlDmrsSymbPos);
|
||||
uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers;
|
||||
uint8_t Qm = rel15->qamModOrder[0];
|
||||
uint32_t encoded_length = nb_re*Qm;
|
||||
int16_t mod_dmrs[14][n_dmrs] __attribute__ ((aligned(16)));
|
||||
int16_t mod_dmrs[14][n_dmrs<<1] __attribute__ ((aligned(16)));
|
||||
|
||||
/* PTRS */
|
||||
uint16_t beta_ptrs = 1;
|
||||
@@ -269,10 +268,10 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
/// DMRS QPSK modulation
|
||||
for (int l=rel15->StartSymbolIndex; l<rel15->StartSymbolIndex+rel15->NrOfSymbols; l++) {
|
||||
if (rel15->dlDmrsSymbPos & (1 << l)) {
|
||||
nr_modulation(pdsch_dmrs[l][0], n_dmrs, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
nr_modulation(pdsch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
#ifdef DEBUG_DLSCH
|
||||
printf("DMRS modulation (symbol %d, %d symbols, type %d):\n", l, n_dmrs>>1, dmrs_Type);
|
||||
printf("DMRS modulation (symbol %d, %d symbols, type %d):\n", l, n_dmrs, dmrs_Type);
|
||||
for (int i=0; i<n_dmrs>>4; i++) {
|
||||
for (int j=0; j<8; j++) {
|
||||
printf("%d %d\t", mod_dmrs[l][((i<<3)+j)<<1], mod_dmrs[l][(((i<<3)+j)<<1)+1]);
|
||||
|
||||
@@ -16,10 +16,10 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
||||
{
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
__m128i idft_in128[1][1200], idft_out128[1][1200];
|
||||
__m128i idft_in128[1][3240], idft_out128[1][3240];
|
||||
__m128i norm128;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t idft_in128[1][1200], idft_out128[1][1200];
|
||||
int16x8_t idft_in128[1][3240], idft_out128[1][3240];
|
||||
int16x8_t norm128;
|
||||
#endif
|
||||
int16_t *idft_in0 = (int16_t*)idft_in128[0], *idft_out0 = (int16_t*)idft_out128[0];
|
||||
@@ -28,20 +28,19 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
||||
|
||||
LOG_T(PHY,"Doing lte_idft for Msc_PUSCH %d\n",Msc_PUSCH);
|
||||
|
||||
// conjugate input
|
||||
for (i = 0; i < (Msc_PUSCH>>2); i++) {
|
||||
if ((Msc_PUSCH % 1536) > 0) {
|
||||
// conjugate input
|
||||
for (i = 0; i < (Msc_PUSCH>>2); i++) {
|
||||
#if defined(__x86_64__)||defined(__i386__)
|
||||
*&(((__m128i*)z)[i]) = _mm_sign_epi16(*&(((__m128i*)z)[i]), *(__m128i*)&conjugate2[0]);
|
||||
*&(((__m128i*)z)[i]) = _mm_sign_epi16(*&(((__m128i*)z)[i]), *(__m128i*)&conjugate2[0]);
|
||||
#elif defined(__arm__)
|
||||
*&(((int16x8_t*)z)[i]) = vmulq_s16(*&(((int16x8_t*)z)[i]), *(int16x8_t*)&conjugate2[0]);
|
||||
*&(((int16x8_t*)z)[i]) = vmulq_s16(*&(((int16x8_t*)z)[i]), *(int16x8_t*)&conjugate2[0]);
|
||||
#endif
|
||||
}
|
||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4)
|
||||
((uint32_t*)idft_in0)[ip+0] = z[i];
|
||||
}
|
||||
|
||||
for (i=0,ip=0; i<Msc_PUSCH; i++, ip+=4) {
|
||||
((int32_t*)idft_in0)[ip+0] = z[i];
|
||||
}
|
||||
|
||||
|
||||
switch (Msc_PUSCH) {
|
||||
case 12:
|
||||
dft(DFT_12,(int16_t *)idft_in0, (int16_t *)idft_out0,0);
|
||||
@@ -194,25 +193,102 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
||||
dft(DFT_1200,idft_in0, idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1296:
|
||||
dft(DFT_1296,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1440:
|
||||
dft(DFT_1440,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1500:
|
||||
dft(DFT_1500,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1536:
|
||||
//dft(DFT_1536,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
idft(IDFT_1536,(int16_t*)z, (int16_t*)z, 1);
|
||||
break;
|
||||
|
||||
case 1620:
|
||||
dft(DFT_1620,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1728:
|
||||
dft(DFT_1728,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1800:
|
||||
dft(DFT_1800,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1920:
|
||||
dft(DFT_1920,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 1944:
|
||||
dft(DFT_1944,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2160:
|
||||
dft(DFT_2160,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2304:
|
||||
dft(DFT_2304,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2400:
|
||||
dft(DFT_2400,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2592:
|
||||
dft(DFT_2592,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2700:
|
||||
dft(DFT_2700,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2880:
|
||||
dft(DFT_2880,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 2916:
|
||||
dft(DFT_2916,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 3000:
|
||||
dft(DFT_3000,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
case 3072:
|
||||
//dft(DFT_3072,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
idft(IDFT_3072,(int16_t*)z, (int16_t*)z, 1);
|
||||
break;
|
||||
|
||||
case 3240:
|
||||
dft(DFT_3240,(int16_t*)idft_in0, (int16_t*)idft_out0, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
// should not be reached
|
||||
LOG_E( PHY, "Unsupported Msc_PUSCH value of %"PRIu16"\n", Msc_PUSCH );
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Msc_PUSCH % 1536) > 0) {
|
||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4)
|
||||
z[i] = ((uint32_t*)idft_out0)[ip];
|
||||
|
||||
|
||||
for (i = 0, ip = 0; i < Msc_PUSCH; i++, ip+=4) {
|
||||
z[i] = ((int32_t*)idft_out0)[ip];
|
||||
}
|
||||
|
||||
// conjugate output
|
||||
for (i = 0; i < (Msc_PUSCH>>2); i++) {
|
||||
// conjugate output
|
||||
for (i = 0; i < (Msc_PUSCH>>2); i++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
((__m128i*)z)[i] = _mm_sign_epi16(((__m128i*)z)[i], *(__m128i*)&conjugate2[0]);
|
||||
((__m128i*)z)[i] = _mm_sign_epi16(((__m128i*)z)[i], *(__m128i*)&conjugate2[0]);
|
||||
#elif defined(__arm__)
|
||||
*&(((int16x8_t*)z)[i]) = vmulq_s16(*&(((int16x8_t*)z)[i]), *(int16x8_t*)&conjugate2[0]);
|
||||
*&(((int16x8_t*)z)[i]) = vmulq_s16(*&(((int16x8_t*)z)[i]), *(int16x8_t*)&conjugate2[0]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
@@ -222,6 +298,7 @@ void nr_idft(int32_t *z, uint32_t Msc_PUSCH)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void nr_ulsch_extract_rbs_single(int32_t **rxdataF,
|
||||
NR_gNB_PUSCH *pusch_vars,
|
||||
unsigned char symbol,
|
||||
|
||||
@@ -158,7 +158,6 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
|
||||
if ((reg % reg_bundle_size_L) == 0) r++;
|
||||
}
|
||||
|
||||
|
||||
// Get cce_list indices by reg_idx in ascending order
|
||||
int f_bundle_j_list_id = 0;
|
||||
int f_bundle_j_list_ord[NR_MAX_PDCCH_AGG_LEVEL] = {};
|
||||
@@ -175,7 +174,6 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(int reg=0; reg<((coreset_nbr_rb*coreset_time_dur)); reg++) {
|
||||
|
||||
f_reg = (f_bundle_j_list_ord[reg/6]*reg_bundle_size_L)+(reg%reg_bundle_size_L);
|
||||
|
||||
@@ -975,8 +975,8 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
|
||||
//rho[aarx][nb_aatx*nb_aatx] = [cov(H_aarx_0,H_aarx_0) cov(H_aarx_0,H_aarx_1)
|
||||
// cov(H_aarx_1,H_aarx_0) cov(H_aarx_1,H_aarx_1)], aarx=0,...,nb_antennas_rx-1
|
||||
|
||||
int avg_rho_re[frame_parms->nb_antennas_rx][nb_aatx];
|
||||
int avg_rho_im[frame_parms->nb_antennas_rx][nb_aatx];
|
||||
int avg_rho_re[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx];
|
||||
int avg_rho_im[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx];
|
||||
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
|
||||
@@ -1085,7 +1085,7 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext,
|
||||
//measurements->rx_correlation[0][0][aarx] = signal_energy(&rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12],rb*12);
|
||||
avg_rho_re[aarx][aatx*nb_aatx+atx] = 16*avg_rho_re[aarx][aatx*nb_aatx+atx]/(nb_rb*12);
|
||||
avg_rho_im[aarx][aatx*nb_aatx+atx] = 16*avg_rho_im[aarx][aatx*nb_aatx+atx]/(nb_rb*12);
|
||||
printf("rho[rx]%d tx%d tx%d = Re: %d Im: %d\n",aarx, aatx,atx, avg_rho_re[aatx*nb_aatx+atx], avg_rho_im[aatx*nb_aatx+atx]);
|
||||
printf("rho[rx]%d tx%d tx%d = Re: %d Im: %d\n",aarx, aatx,atx, avg_rho_re[aarx][aatx*nb_aatx+atx], avg_rho_im[aarx][aatx*nb_aatx+atx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2247,7 +2247,7 @@ unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF,
|
||||
}
|
||||
|
||||
void nr_dlsch_detection_mrc(int **rxdataF_comp,
|
||||
int **rho,
|
||||
int ***rho,
|
||||
int **dl_ch_mag,
|
||||
int **dl_ch_magb,
|
||||
short n_tx,
|
||||
|
||||
@@ -891,7 +891,7 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext,
|
||||
int start_point);
|
||||
|
||||
void nr_dlsch_detection_mrc(int **rxdataF_comp,
|
||||
int **rho,
|
||||
int ***rho,
|
||||
int **dl_ch_mag,
|
||||
int **dl_ch_magb,
|
||||
short n_tx,
|
||||
|
||||
@@ -105,6 +105,8 @@ typedef struct {
|
||||
uint8_t O_ACK;
|
||||
/// Index of current HARQ round for this ULSCH
|
||||
uint8_t round;
|
||||
/// Last Ndi for this harq process
|
||||
uint8_t ndi;
|
||||
/// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
|
||||
unsigned char *a;
|
||||
/// Pointer to the payload + CRC
|
||||
|
||||
@@ -78,13 +78,15 @@ void nr_rf_card_config(openair0_config_t *openair0_cfg,
|
||||
|
||||
openair0_cfg->autocal[i] = 1;
|
||||
|
||||
LOG_I(PHY, "HW: Configuring channel %d (rf_chain %d): setting tx_gain %f, rx_gain %f, tx_freq %f Hz, rx_freq %f Hz\n",
|
||||
i,
|
||||
rf_chain,
|
||||
openair0_cfg->tx_gain[i],
|
||||
openair0_cfg->rx_gain[i],
|
||||
openair0_cfg->tx_freq[i],
|
||||
openair0_cfg->rx_freq[i]);
|
||||
if (i < openair0_cfg->rx_num_channels) {
|
||||
LOG_I(PHY, "HW: Configuring channel %d (rf_chain %d): setting tx_gain %f, rx_gain %f, tx_freq %f Hz, rx_freq %f Hz\n",
|
||||
i,
|
||||
rf_chain,
|
||||
openair0_cfg->tx_gain[i],
|
||||
openair0_cfg->rx_gain[i],
|
||||
openair0_cfg->tx_freq[i],
|
||||
openair0_cfg->rx_freq[i]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,6 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
|
||||
for (i=0; i<number_of_harq_pids; i++) {
|
||||
ulsch->harq_processes[i]->round=0;
|
||||
}
|
||||
|
||||
return(ulsch);
|
||||
}
|
||||
}
|
||||
@@ -257,7 +256,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
|
||||
Ilbrm = 0;
|
||||
Tbslbrm = 950984; //max tbs
|
||||
Coderate = 0.0;
|
||||
harq_process->round = nr_rv_round_map_ue[harq_process->pusch_pdu.pusch_data.rv_index];
|
||||
|
||||
///////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -267,8 +265,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
|
||||
LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers);
|
||||
LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
|
||||
|
||||
// if (harq_process->Ndi == 1) { // this is a new packet
|
||||
if (harq_process->round == 0) { // this is a new packet
|
||||
if (harq_process->ndi != harq_process->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("encoding thinks this is a new packet \n");
|
||||
#endif
|
||||
@@ -415,7 +412,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
|
||||
|
||||
///////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
harq_process->ndi = harq_process->pusch_pdu.pusch_data.new_data_indicator;
|
||||
}
|
||||
F = harq_process->F;
|
||||
Kr = harq_process->K;
|
||||
|
||||
@@ -496,13 +496,19 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
|
||||
int symb_offset = (slot%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
|
||||
for(ap = 0; ap < Nl; ap++) {
|
||||
for (int s=0;s<NR_NUMBER_OF_SYMBOLS_PER_SLOT;s++){
|
||||
LOG_D(PHY,"rotating txdataF symbol %d (%d) => (%d.%d)\n",
|
||||
s,s+symb_offset,frame_parms->symbol_rotation[2*(s+symb_offset)],frame_parms->symbol_rotation[1+(2*(s+symb_offset))]);
|
||||
rotate_cpx_vector((int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size*s],
|
||||
&frame_parms->symbol_rotation[2*(s+symb_offset)],
|
||||
(int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size*s],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
15);
|
||||
|
||||
LOG_D(PHY,"In %s: rotating txdataF symbol %d (%d) => (%d.%d)\n",
|
||||
__FUNCTION__,
|
||||
s,
|
||||
s + symb_offset,
|
||||
frame_parms->symbol_rotation[1][2 * (s + symb_offset)],
|
||||
frame_parms->symbol_rotation[1][1 + (2 * (s + symb_offset))]);
|
||||
|
||||
rotate_cpx_vector((int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size * s],
|
||||
&frame_parms->symbol_rotation[1][2 * (s + symb_offset)],
|
||||
(int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size * s],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
15);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,6 +225,8 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye
|
||||
}
|
||||
|
||||
static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) {
|
||||
if ( values == NULL )
|
||||
return;
|
||||
fl_winset(FL_ObjWin(graph->graph));
|
||||
const int samplesPerPixel=datasize/graph->w;
|
||||
int displayPart=graph->waterFallh-ScaleZone;
|
||||
@@ -280,30 +282,6 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in
|
||||
graph->iteration++;
|
||||
}
|
||||
|
||||
static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
|
||||
float *values, *time;
|
||||
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
||||
|
||||
for (int ant=0; ant<nb_ant; ant++) {
|
||||
if (data[ant] != NULL) {
|
||||
float *values, *time;
|
||||
oai_xygraph_getbuff(graph, &time, &values, len, ant);
|
||||
|
||||
for (int i=0; i<len; i+=8) {
|
||||
float *vals=values+i;
|
||||
const scopeSample_t *in=&(data[ant][i]);
|
||||
|
||||
// TRY AUTOMATIC simd BY GCC
|
||||
for (int k=0; k<8; k++ ) {
|
||||
vals[k] = 10*log10(1.0+SquaredNorm(in[k]));
|
||||
}
|
||||
}
|
||||
|
||||
oai_xygraph(graph,time,values, len, ant, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
|
||||
float *values, *time;
|
||||
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
||||
|
||||
@@ -5952,8 +5952,6 @@ void idft32768(int16_t *x,int16_t *y,unsigned char scale)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int16_t twa1536[1024],twb1536[1024];
|
||||
|
||||
// 512 x 3
|
||||
@@ -9471,6 +9469,919 @@ void dft1200(int16_t *x,int16_t *y,unsigned char scale_flag)
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int16_t twa1296[431*2*4];
|
||||
static int16_t twb1296[431*2*4];
|
||||
|
||||
void dft1296(int16_t *x,int16_t *y,unsigned char scale_flag) //432 * 3
|
||||
{
|
||||
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa1296[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb1296[0];
|
||||
simd_q15_t x2128[1296];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[1296];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<432; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+432] = x128[j+1];
|
||||
x2128[i+864] = x128[j+2];
|
||||
}
|
||||
|
||||
dft432((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft432((int16_t *)(x2128+432),(int16_t *)(ytmp128+432),1);
|
||||
dft432((int16_t *)(x2128+864),(int16_t *)(ytmp128+864),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+432,ytmp128+864,y128,y128+432,y128+864);
|
||||
|
||||
for (i=1,j=0; i<432; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+432+i,
|
||||
ytmp128+864+i,
|
||||
y128+i,
|
||||
y128+432+i,
|
||||
y128+864+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<1296; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
|
||||
static int16_t twa1440[479*2*4];
|
||||
static int16_t twb1440[479*2*4];
|
||||
|
||||
void dft1440(int16_t *x,int16_t *y,unsigned char scale_flag) // 480 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa1440[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb1440[0];
|
||||
simd_q15_t x2128[1440];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[1440];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<480; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+480] = x128[j+1];
|
||||
x2128[i+960] = x128[j+2];
|
||||
}
|
||||
|
||||
dft480((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft480((int16_t *)(x2128+480),(int16_t *)(ytmp128+480),1);
|
||||
dft480((int16_t *)(x2128+960),(int16_t *)(ytmp128+960),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+480,ytmp128+960,y128,y128+480,y128+960);
|
||||
|
||||
for (i=1,j=0; i<480; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+480+i,
|
||||
ytmp128+960+i,
|
||||
y128+i,
|
||||
y128+480+i,
|
||||
y128+960+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<1440; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa1500[2392]__attribute__((aligned(32)));
|
||||
static int16_t twb1500[2392]__attribute__((aligned(32)));
|
||||
static int16_t twc1500[2392]__attribute__((aligned(32)));
|
||||
static int16_t twd1500[2392]__attribute__((aligned(32)));
|
||||
|
||||
void dft1500(int16_t *x,int16_t *y,unsigned char scale_flag)
|
||||
{
|
||||
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa1500[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb1500[0];
|
||||
simd_q15_t *twc128=(simd_q15_t *)&twc1500[0];
|
||||
simd_q15_t *twd128=(simd_q15_t *)&twd1500[0];
|
||||
simd_q15_t x2128[1500];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[1500];//=&ytmp128array2[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<300; i++,j+=5) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+300] = x128[j+1];
|
||||
x2128[i+600] = x128[j+2];
|
||||
x2128[i+900] = x128[j+3];
|
||||
x2128[i+1200] = x128[j+4];
|
||||
}
|
||||
|
||||
dft300((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft300((int16_t *)(x2128+300),(int16_t *)(ytmp128+300),1);
|
||||
dft300((int16_t *)(x2128+600),(int16_t *)(ytmp128+600),1);
|
||||
dft300((int16_t *)(x2128+900),(int16_t *)(ytmp128+900),1);
|
||||
dft300((int16_t *)(x2128+1200),(int16_t *)(ytmp128+1200),1);
|
||||
|
||||
bfly5_tw1(ytmp128,ytmp128+300,ytmp128+600,ytmp128+900,ytmp128+1200,y128,y128+300,y128+600,y128+900,y128+1200);
|
||||
|
||||
for (i=1,j=0; i<300; i++,j++) {
|
||||
bfly5(ytmp128+i,
|
||||
ytmp128+300+i,
|
||||
ytmp128+600+i,
|
||||
ytmp128+900+i,
|
||||
ytmp128+1200+i,
|
||||
y128+i,
|
||||
y128+300+i,
|
||||
y128+600+i,
|
||||
y128+900+i,
|
||||
y128+1200+i,
|
||||
twa128+j,
|
||||
twb128+j,
|
||||
twc128+j,
|
||||
twd128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[15]);
|
||||
|
||||
for (i=0; i<1500; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
static int16_t twa1620[539*2*4];
|
||||
static int16_t twb1620[539*2*4];
|
||||
|
||||
void dft1620(int16_t *x,int16_t *y,unsigned char scale_flag) // 540 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa1620[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb1620[0];
|
||||
simd_q15_t x2128[1620];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[1620];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<540; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+540] = x128[j+1];
|
||||
x2128[i+1080] = x128[j+2];
|
||||
}
|
||||
|
||||
dft540((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft540((int16_t *)(x2128+540),(int16_t *)(ytmp128+540),1);
|
||||
dft540((int16_t *)(x2128+1080),(int16_t *)(ytmp128+1080),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+540,ytmp128+1080,y128,y128+540,y128+1080);
|
||||
|
||||
for (i=1,j=0; i<540; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+540+i,
|
||||
ytmp128+1080+i,
|
||||
y128+i,
|
||||
y128+540+i,
|
||||
y128+1080+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<1620; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa1728[575*2*4];
|
||||
static int16_t twb1728[575*2*4];
|
||||
|
||||
void dft1728(int16_t *x,int16_t *y,unsigned char scale_flag) // 576 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa1728[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb1728[0];
|
||||
simd_q15_t x2128[1728];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[1728];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<576; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+576] = x128[j+1];
|
||||
x2128[i+1152] = x128[j+2];
|
||||
}
|
||||
|
||||
dft576((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft576((int16_t *)(x2128+576),(int16_t *)(ytmp128+576),1);
|
||||
dft576((int16_t *)(x2128+1152),(int16_t *)(ytmp128+1152),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+576,ytmp128+1152,y128,y128+576,y128+1152);
|
||||
|
||||
for (i=1,j=0; i<576; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+576+i,
|
||||
ytmp128+1152+i,
|
||||
y128+i,
|
||||
y128+576+i,
|
||||
y128+1152+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<1728; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa1800[599*2*4];
|
||||
static int16_t twb1800[599*2*4];
|
||||
|
||||
void dft1800(int16_t *x,int16_t *y,unsigned char scale_flag) // 600 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa1800[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb1800[0];
|
||||
simd_q15_t x2128[1800];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[1800];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<600; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+600] = x128[j+1];
|
||||
x2128[i+1200] = x128[j+2];
|
||||
}
|
||||
|
||||
dft600((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft600((int16_t *)(x2128+600),(int16_t *)(ytmp128+600),1);
|
||||
dft600((int16_t *)(x2128+1200),(int16_t *)(ytmp128+1200),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+600,ytmp128+1200,y128,y128+600,y128+1200);
|
||||
|
||||
for (i=1,j=0; i<600; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+600+i,
|
||||
ytmp128+1200+i,
|
||||
y128+i,
|
||||
y128+600+i,
|
||||
y128+1200+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<1800; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa1920[479*2*4];
|
||||
static int16_t twb1920[479*2*4];
|
||||
static int16_t twc1920[479*2*4];
|
||||
|
||||
void dft1920(int16_t *x,int16_t *y,unsigned char scale_flag) // 480 x 4
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa1920[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb1920[0];
|
||||
simd_q15_t *twc128=(simd_q15_t *)&twc1920[0];
|
||||
simd_q15_t x2128[1920];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[1920];//=&ytmp128array2[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<480; i++,j+=4) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+480] = x128[j+1];
|
||||
x2128[i+960] = x128[j+2];
|
||||
x2128[i+1440] = x128[j+3];
|
||||
}
|
||||
|
||||
dft480((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft480((int16_t *)(x2128+480),(int16_t *)(ytmp128+480),1);
|
||||
dft480((int16_t *)(x2128+960),(int16_t *)(ytmp128+960),1);
|
||||
dft480((int16_t *)(x2128+1440),(int16_t *)(ytmp128+1440),1);
|
||||
|
||||
bfly4_tw1(ytmp128,ytmp128+480,ytmp128+960,ytmp128+1440,y128,y128+480,y128+960,y128+1440);
|
||||
|
||||
for (i=1,j=0; i<480; i++,j++) {
|
||||
bfly4(ytmp128+i,
|
||||
ytmp128+480+i,
|
||||
ytmp128+960+i,
|
||||
ytmp128+1440+i,
|
||||
y128+i,
|
||||
y128+480+i,
|
||||
y128+960+i,
|
||||
y128+1440+i,
|
||||
twa128+j,
|
||||
twb128+j,
|
||||
twc128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[13]);
|
||||
for (i=0; i<1920; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa1944[647*2*4];
|
||||
static int16_t twb1944[647*2*4];
|
||||
|
||||
void dft1944(int16_t *x,int16_t *y,unsigned char scale_flag) // 648 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa1944[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb1944[0];
|
||||
simd_q15_t x2128[1944];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[1944];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<648; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+648] = x128[j+1];
|
||||
x2128[i+1296] = x128[j+2];
|
||||
}
|
||||
|
||||
dft648((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft648((int16_t *)(x2128+648),(int16_t *)(ytmp128+648),1);
|
||||
dft648((int16_t *)(x2128+1296),(int16_t *)(ytmp128+1296),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+648,ytmp128+1296,y128,y128+648,y128+1296);
|
||||
|
||||
for (i=1,j=0; i<648; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+648+i,
|
||||
ytmp128+1296+i,
|
||||
y128+i,
|
||||
y128+648+i,
|
||||
y128+1296+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<1944; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa2160[719*2*4];
|
||||
static int16_t twb2160[719*2*4];
|
||||
|
||||
void dft2160(int16_t *x,int16_t *y,unsigned char scale_flag) // 720 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa2160[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb2160[0];
|
||||
simd_q15_t x2128[2160];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[2160];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<720; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+720] = x128[j+1];
|
||||
x2128[i+1440] = x128[j+2];
|
||||
}
|
||||
|
||||
dft720((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft720((int16_t *)(x2128+720),(int16_t *)(ytmp128+720),1);
|
||||
dft720((int16_t *)(x2128+1440),(int16_t *)(ytmp128+1440),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+720,ytmp128+1440,y128,y128+720,y128+1440);
|
||||
|
||||
for (i=1,j=0; i<720; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+720+i,
|
||||
ytmp128+1440+i,
|
||||
y128+i,
|
||||
y128+720+i,
|
||||
y128+1440+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<2160; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa2304[767*2*4];
|
||||
static int16_t twb2304[767*2*4];
|
||||
|
||||
void dft2304(int16_t *x,int16_t *y,unsigned char scale_flag) // 768 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa2304[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb2304[0];
|
||||
simd_q15_t x2128[2304];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[2304];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<768; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+768] = x128[j+1];
|
||||
x2128[i+1536] = x128[j+2];
|
||||
}
|
||||
|
||||
dft768((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft768((int16_t *)(x2128+768),(int16_t *)(ytmp128+768),1);
|
||||
dft768((int16_t *)(x2128+1536),(int16_t *)(ytmp128+1536),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+768,ytmp128+1536,y128,y128+768,y128+1536);
|
||||
|
||||
for (i=1,j=0; i<768; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+768+i,
|
||||
ytmp128+1536+i,
|
||||
y128+i,
|
||||
y128+768+i,
|
||||
y128+1536+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<2304; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa2400[599*2*4];
|
||||
static int16_t twb2400[599*2*4];
|
||||
static int16_t twc2400[599*2*4];
|
||||
|
||||
void dft2400(int16_t *x,int16_t *y,unsigned char scale_flag) // 600 x 4
|
||||
{
|
||||
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa2400[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb2400[0];
|
||||
simd_q15_t *twc128=(simd_q15_t *)&twc2400[0];
|
||||
simd_q15_t x2128[2400];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[2400];//=&ytmp128array2[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<600; i++,j+=4) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+600] = x128[j+1];
|
||||
x2128[i+1200] = x128[j+2];
|
||||
x2128[i+1800] = x128[j+3];
|
||||
}
|
||||
|
||||
dft600((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft600((int16_t *)(x2128+600),(int16_t *)(ytmp128+600),1);
|
||||
dft600((int16_t *)(x2128+1200),(int16_t *)(ytmp128+1200),1);
|
||||
dft600((int16_t *)(x2128+1800),(int16_t *)(ytmp128+1800),1);
|
||||
|
||||
bfly4_tw1(ytmp128,ytmp128+600,ytmp128+1200,ytmp128+1800,y128,y128+600,y128+1200,y128+1800);
|
||||
|
||||
for (i=1,j=0; i<600; i++,j++) {
|
||||
bfly4(ytmp128+i,
|
||||
ytmp128+600+i,
|
||||
ytmp128+1200+i,
|
||||
ytmp128+1800+i,
|
||||
y128+i,
|
||||
y128+600+i,
|
||||
y128+1200+i,
|
||||
y128+1800+i,
|
||||
twa128+j,
|
||||
twb128+j,
|
||||
twc128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[13]);
|
||||
for (i=0; i<2400; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa2592[863*2*4];
|
||||
static int16_t twb2592[863*2*4];
|
||||
|
||||
void dft2592(int16_t *x,int16_t *y,unsigned char scale_flag) // 864 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa2592[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb2592[0];
|
||||
simd_q15_t x2128[2592];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[2592];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<864; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+864] = x128[j+1];
|
||||
x2128[i+1728] = x128[j+2];
|
||||
}
|
||||
|
||||
dft864((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft864((int16_t *)(x2128+864),(int16_t *)(ytmp128+864),1);
|
||||
dft864((int16_t *)(x2128+1728),(int16_t *)(ytmp128+1728),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+864,ytmp128+1728,y128,y128+864,y128+1728);
|
||||
|
||||
for (i=1,j=0; i<864; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+864+i,
|
||||
ytmp128+1728+i,
|
||||
y128+i,
|
||||
y128+864+i,
|
||||
y128+1728+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<2592; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa2700[899*2*4];
|
||||
static int16_t twb2700[899*2*4];
|
||||
|
||||
void dft2700(int16_t *x,int16_t *y,unsigned char scale_flag) // 900 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa2700[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb2700[0];
|
||||
simd_q15_t x2128[2700];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[2700];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<900; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+900] = x128[j+1];
|
||||
x2128[i+1800] = x128[j+2];
|
||||
}
|
||||
|
||||
dft900((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft900((int16_t *)(x2128+900),(int16_t *)(ytmp128+900),1);
|
||||
dft900((int16_t *)(x2128+1800),(int16_t *)(ytmp128+1800),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+900,ytmp128+1800,y128,y128+900,y128+1800);
|
||||
|
||||
for (i=1,j=0; i<900; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+900+i,
|
||||
ytmp128+1800+i,
|
||||
y128+i,
|
||||
y128+900+i,
|
||||
y128+1800+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<2700; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa2880[959*2*4];
|
||||
static int16_t twb2880[959*2*4];
|
||||
|
||||
void dft2880(int16_t *x,int16_t *y,unsigned char scale_flag) // 960 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa2880[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb2880[0];
|
||||
simd_q15_t x2128[2880];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[2880];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<960; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+960] = x128[j+1];
|
||||
x2128[i+1920] = x128[j+2];
|
||||
}
|
||||
|
||||
dft960((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft960((int16_t *)(x2128+960),(int16_t *)(ytmp128+960),1);
|
||||
dft960((int16_t *)(x2128+1920),(int16_t *)(ytmp128+1920),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+960,ytmp128+1920,y128,y128+960,y128+1920);
|
||||
|
||||
for (i=1,j=0; i<960; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+960+i,
|
||||
ytmp128+1920+i,
|
||||
y128+i,
|
||||
y128+960+i,
|
||||
y128+1920+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<2880; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa2916[971*2*4];
|
||||
static int16_t twb2916[971*2*4];
|
||||
|
||||
void dft2916(int16_t *x,int16_t *y,unsigned char scale_flag) // 972 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa2916[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb2916[0];
|
||||
simd_q15_t x2128[2916];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[2916];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<972; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+972] = x128[j+1];
|
||||
x2128[i+1944] = x128[j+2];
|
||||
}
|
||||
|
||||
dft972((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft972((int16_t *)(x2128+972),(int16_t *)(ytmp128+972),1);
|
||||
dft972((int16_t *)(x2128+1944),(int16_t *)(ytmp128+1944),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+972,ytmp128+1944,y128,y128+972,y128+1944);
|
||||
|
||||
for (i=1,j=0; i<972; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+972+i,
|
||||
ytmp128+1944+i,
|
||||
y128+i,
|
||||
y128+972+i,
|
||||
y128+1944+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<2916; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
static int16_t twa3000[599*8]__attribute__((aligned(32)));
|
||||
static int16_t twb3000[599*8]__attribute__((aligned(32)));
|
||||
static int16_t twc3000[599*8]__attribute__((aligned(32)));
|
||||
static int16_t twd3000[599*8]__attribute__((aligned(32)));
|
||||
|
||||
void dft3000(int16_t *x,int16_t *y,unsigned char scale_flag) // 600 * 5
|
||||
{
|
||||
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa3000[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb3000[0];
|
||||
simd_q15_t *twc128=(simd_q15_t *)&twc3000[0];
|
||||
simd_q15_t *twd128=(simd_q15_t *)&twd3000[0];
|
||||
simd_q15_t x2128[3000];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[3000];//=&ytmp128array2[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<600; i++,j+=5) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+600] = x128[j+1];
|
||||
x2128[i+1200] = x128[j+2];
|
||||
x2128[i+1800] = x128[j+3];
|
||||
x2128[i+2400] = x128[j+4];
|
||||
}
|
||||
|
||||
dft600((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft600((int16_t *)(x2128+600),(int16_t *)(ytmp128+600),1);
|
||||
dft600((int16_t *)(x2128+1200),(int16_t *)(ytmp128+1200),1);
|
||||
dft600((int16_t *)(x2128+1800),(int16_t *)(ytmp128+1800),1);
|
||||
dft600((int16_t *)(x2128+2400),(int16_t *)(ytmp128+2400),1);
|
||||
|
||||
bfly5_tw1(ytmp128,ytmp128+600,ytmp128+1200,ytmp128+1800,ytmp128+2400,y128,y128+600,y128+1200,y128+1800,y128+2400);
|
||||
|
||||
for (i=1,j=0; i<600; i++,j++) {
|
||||
bfly5(ytmp128+i,
|
||||
ytmp128+600+i,
|
||||
ytmp128+1200+i,
|
||||
ytmp128+1800+i,
|
||||
ytmp128+2400+i,
|
||||
y128+i,
|
||||
y128+600+i,
|
||||
y128+1200+i,
|
||||
y128+1800+i,
|
||||
y128+2400+i,
|
||||
twa128+j,
|
||||
twb128+j,
|
||||
twc128+j,
|
||||
twd128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[15]);
|
||||
|
||||
for (i=0; i<3000; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
}
|
||||
|
||||
static int16_t twa3240[1079*2*4];
|
||||
static int16_t twb3240[1079*2*4];
|
||||
|
||||
void dft3240(int16_t *x,int16_t *y,unsigned char scale_flag) // 1080 x 3
|
||||
{
|
||||
int i,j;
|
||||
simd_q15_t *x128=(simd_q15_t *)x;
|
||||
simd_q15_t *y128=(simd_q15_t *)y;
|
||||
simd_q15_t *twa128=(simd_q15_t *)&twa3240[0];
|
||||
simd_q15_t *twb128=(simd_q15_t *)&twb3240[0];
|
||||
simd_q15_t x2128[3240];// = (simd_q15_t *)&x2128array[0];
|
||||
simd_q15_t ytmp128[3240];//=&ytmp128array3[0];
|
||||
|
||||
|
||||
|
||||
for (i=0,j=0; i<1080; i++,j+=3) {
|
||||
x2128[i] = x128[j];
|
||||
x2128[i+1080] = x128[j+1];
|
||||
x2128[i+2160] = x128[j+2];
|
||||
}
|
||||
|
||||
dft1080((int16_t *)x2128,(int16_t *)ytmp128,1);
|
||||
dft1080((int16_t *)(x2128+1080),(int16_t *)(ytmp128+1080),1);
|
||||
dft1080((int16_t *)(x2128+2160),(int16_t *)(ytmp128+2160),1);
|
||||
|
||||
bfly3_tw1(ytmp128,ytmp128+1080,ytmp128+2160,y128,y128+1080,y128+2160);
|
||||
|
||||
for (i=1,j=0; i<1080; i++,j++) {
|
||||
bfly3(ytmp128+i,
|
||||
ytmp128+1080+i,
|
||||
ytmp128+2160+i,
|
||||
y128+i,
|
||||
y128+1080+i,
|
||||
y128+2160+i,
|
||||
twa128+j,
|
||||
twb128+j);
|
||||
}
|
||||
|
||||
if (scale_flag==1) {
|
||||
norm128 = set1_int16(dft_norm_table[14]);
|
||||
|
||||
for (i=0; i<3240; i++) {
|
||||
y128[i] = mulhi_int16(y128[i],norm128);
|
||||
}
|
||||
}
|
||||
|
||||
_mm_empty();
|
||||
_m_empty();
|
||||
|
||||
};
|
||||
|
||||
void init_rad4(int N,int16_t *tw) {
|
||||
|
||||
int16_t *twa = tw;
|
||||
@@ -9492,7 +10403,7 @@ void init_rad4_rep(int N,int16_t *twa,int16_t *twb,int16_t *twc) {
|
||||
int i,j;
|
||||
|
||||
for (i=1;i<(N/4);i++) {
|
||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
||||
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
||||
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
||||
@@ -9525,7 +10436,7 @@ void init_rad2_rep(int N,int16_t *twa) {
|
||||
int i,j;
|
||||
|
||||
for (i=1;i<(N/2);i++) {
|
||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
||||
for (j=1;j<4;j++) {
|
||||
((int32_t*)twa)[j]=((int32_t*)twa)[0];
|
||||
@@ -9551,7 +10462,7 @@ void init_rad3_rep(int N,int16_t *twa,int16_t *twb) {
|
||||
int i,j;
|
||||
|
||||
for (i=1;i<(N/3);i++) {
|
||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
||||
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
||||
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
||||
@@ -9569,7 +10480,7 @@ void init_rad5_rep(int N,int16_t *twa,int16_t *twb,int16_t *twc,int16_t *twd) {
|
||||
int i,j;
|
||||
|
||||
for (i=1;i<(N/5);i++) {
|
||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||
twa[0] = (int16_t)round(32767.0*cos(2*M_PI*i/N));
|
||||
twa[1] = -(int16_t)round(32767.0*sin(2*M_PI*i/N));
|
||||
twb[0] = (int16_t)round(32767.0*cos(2*M_PI*2*i/N));
|
||||
twb[1] = -(int16_t)round(32767.0*sin(2*M_PI*2*i/N));
|
||||
@@ -9586,7 +10497,7 @@ void init_rad5_rep(int N,int16_t *twa,int16_t *twb,int16_t *twc,int16_t *twd) {
|
||||
twa+=8;
|
||||
twb+=8;
|
||||
twc+=8;
|
||||
twd+=8;
|
||||
twd+=8;
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------*/
|
||||
@@ -9600,7 +10511,7 @@ int dfts_autoinit(void)
|
||||
init_rad2(8192,tw8192);
|
||||
init_rad4(16384,tw16384);
|
||||
init_rad2(32768,tw32768);
|
||||
|
||||
|
||||
init_rad3(1536,twa1536,twb1536);
|
||||
init_rad3(3072,twa3072,twb3072);
|
||||
init_rad3(6144,twa6144,twb6144);
|
||||
@@ -9645,6 +10556,24 @@ int dfts_autoinit(void)
|
||||
init_rad3_rep(1080,twa1080,twb1080);
|
||||
init_rad4_rep(1152,twa1152,twb1152,twc1152);
|
||||
init_rad4_rep(1200,twa1200,twb1200,twc1200);
|
||||
init_rad3_rep(1296,twa1296,twb1296);
|
||||
init_rad3_rep(1440,twa1440,twb1440);
|
||||
init_rad5_rep(1500,twa1500,twb1500,twc1500,twd1500);
|
||||
init_rad3_rep(1620,twa1620,twb1620);
|
||||
init_rad3_rep(1728,twa1728,twb1728);
|
||||
init_rad3_rep(1800,twa1800,twb1800);
|
||||
init_rad4_rep(1920,twa1920,twb1920, twc1920);
|
||||
init_rad3_rep(1944,twa1944,twb1944);
|
||||
init_rad3_rep(2160,twa2160,twb2160);
|
||||
init_rad3_rep(2304,twa2304,twb2304);
|
||||
init_rad4_rep(2400,twa2400,twb2400,twc2400);
|
||||
init_rad3_rep(2592,twa2592,twb2592);
|
||||
init_rad3_rep(2700,twa2700,twb2700);
|
||||
init_rad3_rep(2880,twa2880,twb2880);
|
||||
init_rad3_rep(2916,twa2916,twb2916);
|
||||
init_rad5_rep(3000,twa3000,twb3000,twc3000,twd3000);
|
||||
init_rad3_rep(3240,twa3240,twb3240);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,9 +226,26 @@ void dft1024(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1080(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1152(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1200(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1296(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1440(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1500(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1536(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
||||
void dft1620(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1728(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1800(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1920(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft1944(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft2048(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft2160(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft2304(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft2400(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft2592(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft2700(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft2880(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft2916(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft3000(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft3072(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
||||
void dft3240(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft4096(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
void dft6144(int16_t *sigF,int16_t *sig,uint8_t scale_flag);
|
||||
void dft8192(int16_t *x,int16_t *y,uint8_t scale_flag);
|
||||
@@ -283,21 +300,25 @@ typedef enum DFT_size_idx {
|
||||
DFT_108, DFT_120, DFT_128, DFT_144, DFT_180, DFT_192, DFT_216, DFT_240,
|
||||
DFT_256, DFT_288, DFT_300, DFT_324, DFT_360, DFT_384, DFT_432, DFT_480,
|
||||
DFT_512, DFT_540, DFT_576, DFT_600, DFT_648, DFT_720, DFT_768, DFT_864,
|
||||
DFT_900, DFT_960, DFT_972, DFT_1024, DFT_1080, DFT_1152, DFT_1200, DFT_1536,
|
||||
DFT_2048, DFT_3072, DFT_4096, DFT_6144, DFT_8192, DFT_9216, DFT_12288, DFT_18432,
|
||||
DFT_24576, DFT_36864, DFT_49152, DFT_73728, DFT_98304,
|
||||
DFT_900, DFT_960, DFT_972, DFT_1024, DFT_1080, DFT_1152, DFT_1200, DFT_1296,
|
||||
DFT_1440, DFT_1500, DFT_1536, DFT_1620, DFT_1728, DFT_1800, DFT_1920, DFT_1944,
|
||||
DFT_2048, DFT_2160, DFT_2304, DFT_2400, DFT_2592, DFT_2700, DFT_2880, DFT_2916,
|
||||
DFT_3000, DFT_3072, DFT_3240, DFT_4096, DFT_6144, DFT_8192, DFT_9216, DFT_12288,
|
||||
DFT_18432, DFT_24576, DFT_36864, DFT_49152, DFT_73728, DFT_98304,
|
||||
DFT_SIZE_IDXTABLESIZE
|
||||
} dft_size_idx_t;
|
||||
|
||||
#ifdef OAIDFTS_MAIN
|
||||
adftfunc_t dft_ftab[]={
|
||||
dft12, dft24, dft36, dft48, dft60, dft72, dft96,
|
||||
dft108, dft120, dft128, dft144, dft180, dft192, dft216, dft240,
|
||||
dft108, dft120, dft128, dft144, dft180, dft192, dft216, dft240,
|
||||
dft256, dft288, dft300, dft324, dft360, dft384, dft432, dft480,
|
||||
dft512, dft540, dft576, dft600, dft648, dft720, dft768, dft864,
|
||||
dft900, dft960, dft972, dft1024, dft1080, dft1152, dft1200, dft1536,
|
||||
dft2048, dft3072, dft4096, dft6144, dft8192, dft9216, dft12288, dft18432,
|
||||
dft24576, dft36864, dft49152, dft73728, dft98304
|
||||
dft900, dft960, dft972, dft1024, dft1080, dft1152, dft1200, dft1296,
|
||||
dft1440, dft1500, dft1536, dft1620, dft1728, dft1800, dft1920, dft1944,
|
||||
dft2048, dft2160, dft2304, dft2400, dft2592, dft2700, dft2880, dft2916,
|
||||
dft3000, dft3072, dft3240, dft4096, dft6144, dft8192, dft9216, dft12288,
|
||||
dft18432, dft24576, dft36864, dft49152, dft73728, dft98304
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -309,9 +330,9 @@ typedef enum idft_size_idx {
|
||||
} idft_size_idx_t;
|
||||
#ifdef OAIDFTS_MAIN
|
||||
aidftfunc_t idft_ftab[]={
|
||||
idft128, idft256, idft512, idft1024, idft1536, idft2048, idft3072, idft4096,
|
||||
idft6144, idft8192, idft9216, idft12288, idft18432, idft24576, idft36864, idft49152,
|
||||
idft73728, idft98304
|
||||
idft128, idft256, idft512, idft1024, idft1536, idft2048, idft3072, idft4096,
|
||||
idft6144, idft8192, idft9216, idft12288, idft18432, idft24576, idft36864, idft49152,
|
||||
idft73728, idft98304
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -741,4 +741,10 @@ typedef struct RRU_config_s {
|
||||
MBSFN_config_t MBSFN_config[8];
|
||||
} RRU_config_t;
|
||||
|
||||
typedef struct processingData_RU {
|
||||
int frame_tx;
|
||||
int slot_tx;
|
||||
openair0_timestamp timestamp_tx;
|
||||
RU_t *ru;
|
||||
} processingData_RU_t;
|
||||
#endif //__PHY_DEFS_RU__H__
|
||||
|
||||
@@ -832,6 +832,9 @@ typedef struct PHY_VARS_gNB_s {
|
||||
time_stats_t ulsch_freq_offset_estimation_stats;
|
||||
*/
|
||||
notifiedFIFO_t *respDecode;
|
||||
notifiedFIFO_t *resp_L1;
|
||||
notifiedFIFO_t *resp_L1_tx;
|
||||
notifiedFIFO_t *resp_RU_tx;
|
||||
tpool_t *threadPool;
|
||||
int nbDecode;
|
||||
uint8_t pusch_proc_threads;
|
||||
@@ -873,4 +876,13 @@ union ldpcReqUnion {
|
||||
uint64_t p;
|
||||
};
|
||||
|
||||
typedef struct processingData_L1 {
|
||||
int frame_rx;
|
||||
int frame_tx;
|
||||
int slot_rx;
|
||||
int slot_tx;
|
||||
openair0_timestamp timestamp_tx;
|
||||
PHY_VARS_gNB *gNB;
|
||||
} processingData_L1_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -335,9 +335,7 @@ typedef struct {
|
||||
/// \brief Cross-correlation Matrix of the gNB Tx channel signals.
|
||||
/// - first index: aatx*n_rx+aarx for all aatx=[0..n_tx[ and aarx=[0..nb_rx[
|
||||
/// - second index: symbol [0..]
|
||||
int32_t **rho;
|
||||
/// never used... always send dl_ch_rho_ext instead...
|
||||
int32_t **rho_i;
|
||||
int32_t ***rho;
|
||||
/// \brief Pointers to llr vectors (2 TBs).
|
||||
/// - first index: ? [0..1] (hard coded)
|
||||
/// - second index: ? [0..1179743] (hard coded)
|
||||
|
||||
@@ -327,7 +327,8 @@ struct NR_DL_FRAME_PARMS {
|
||||
/// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP)
|
||||
lte_prefix_type_t Ncp;
|
||||
/// sequence which is computed based on carrier frequency and numerology to rotate/derotate each OFDM symbol according to Section 5.3 in 38.211
|
||||
int16_t symbol_rotation[224*2];
|
||||
/// First dimension is for the direction of the link (0 DL, 1 UL)
|
||||
int16_t symbol_rotation[2][224*2];
|
||||
/// shift of pilot position in one RB
|
||||
uint8_t nushift;
|
||||
/// SRS configuration from TS 38.331 RRC
|
||||
@@ -368,20 +369,4 @@ struct NR_DL_FRAME_PARMS {
|
||||
#define KHz (1000UL)
|
||||
#define MHz (1000*KHz)
|
||||
|
||||
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;
|
||||
|
||||
typedef struct nr_band_info_s {
|
||||
int nbands;
|
||||
nr_bandentry_t band_info[100];
|
||||
} nr_band_info_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//Dummy NR defs to avoid linking errors
|
||||
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
|
||||
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
#include "openair1/PHY/LTE_TRANSPORT/transport_common.h"
|
||||
|
||||
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu){}
|
||||
|
||||
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
|
||||
|
||||
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;}
|
||||
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint8_t *sdu){
|
||||
}
|
||||
int l1_north_init_gNB(void){return 0;}
|
||||
|
||||
uint8_t slot_ahead=6;
|
||||
//uint8_t nfapi_mode=0;
|
||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return NULL;}
|
||||
|
||||
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu){}
|
||||
void nr_fill_ulsch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_pusch_pdu_t *ulsch_pdu){}
|
||||
void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu){}
|
||||
void nr_fill_prach(PHY_VARS_gNB *gNB,
|
||||
int SFN,
|
||||
int Slot,
|
||||
nfapi_nr_prach_pdu_t *prach_pdu){}
|
||||
void nr_fill_prach_ru(RU_t *ru,
|
||||
int SFN,
|
||||
int Slot,
|
||||
nfapi_nr_prach_pdu_t *prach_pdu){}
|
||||
|
||||
void nr_phy_config_request(NR_PHY_Config_t *gNB){}
|
||||
|
||||
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst){}
|
||||
|
||||
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp){}
|
||||
@@ -0,0 +1,52 @@
|
||||
//Dummy NR defs to avoid linking errors
|
||||
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
|
||||
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
|
||||
#include "openair1/PHY/LTE_TRANSPORT/transport_common.h"
|
||||
|
||||
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu){}
|
||||
|
||||
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
|
||||
|
||||
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;}
|
||||
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint8_t *sdu){
|
||||
}
|
||||
int l1_north_init_gNB(void){return 0;}
|
||||
|
||||
uint8_t slot_ahead=6;
|
||||
//uint8_t nfapi_mode=0;
|
||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return NULL;}
|
||||
|
||||
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu){}
|
||||
void nr_fill_ulsch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_pusch_pdu_t *ulsch_pdu){}
|
||||
void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu){}
|
||||
void nr_fill_prach(PHY_VARS_gNB *gNB,
|
||||
int SFN,
|
||||
int Slot,
|
||||
nfapi_nr_prach_pdu_t *prach_pdu){}
|
||||
void nr_fill_prach_ru(RU_t *ru,
|
||||
int SFN,
|
||||
int Slot,
|
||||
nfapi_nr_prach_pdu_t *prach_pdu){}
|
||||
|
||||
void nr_phy_config_request(NR_PHY_Config_t *gNB){}
|
||||
|
||||
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst){}
|
||||
|
||||
//void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp){}
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dci.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
extern int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
|
||||
extern int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
|
||||
extern int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
|
||||
extern int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
|
||||
|
||||
|
||||
extern uint8_t nfapi_mode;
|
||||
@@ -126,7 +132,7 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
}
|
||||
|
||||
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
|
||||
|
||||
PHY_VARS_gNB *gNB;
|
||||
// copy data from L2 interface into L1 structures
|
||||
module_id_t Mod_id = Sched_INFO->module_id;
|
||||
@@ -169,6 +175,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
|
||||
gNB->pbch_configured=1;
|
||||
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||
handle_nr_nfapi_ssb_pdu(gNB,frame,slot,
|
||||
dl_tti_pdu);
|
||||
|
||||
@@ -176,7 +183,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
|
||||
case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
|
||||
AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n");
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||
handle_nfapi_nr_pdcch_pdu(gNB,
|
||||
frame, slot,
|
||||
&dl_tti_pdu->pdcch_pdu);
|
||||
@@ -193,33 +200,61 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
|
||||
pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
|
||||
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||
handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (UL_tti_req!=NULL) memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t));
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||
for (int i=0;i<number_ul_dci_pdu;i++) {
|
||||
handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]);
|
||||
}
|
||||
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||
for (int i = 0; i < number_ul_tti_pdu; i++) {
|
||||
switch (UL_tti_req->pdus_list[i].pdu_type) {
|
||||
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUSCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
nr_fill_ulsch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pusch_pdu);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUCCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
nr_fill_pucch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pucch_pdu);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
|
||||
nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||
if (gNB->RU_list[0]->if_south == LOCAL_RF) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(NFAPI_MODE != NFAPI_MONOLITHIC && number_ul_tti_pdu>0)
|
||||
{
|
||||
oai_nfapi_ul_tti_req(UL_tti_req);
|
||||
}
|
||||
|
||||
for (int i=0;i<number_ul_dci_pdu;i++) {
|
||||
handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]);
|
||||
if (NFAPI_MODE != NFAPI_MONOLITHIC && Sched_INFO->UL_dci_req->numPdus!=0)
|
||||
{
|
||||
oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req);
|
||||
}
|
||||
|
||||
if (NFAPI_MODE != NFAPI_MONOLITHIC)
|
||||
{
|
||||
if(Sched_INFO->DL_req->dl_tti_request_body.nPDUs>0)
|
||||
{
|
||||
Sched_INFO->DL_req->SFN = frame;
|
||||
Sched_INFO->DL_req->Slot = slot;
|
||||
oai_nfapi_dl_tti_req(Sched_INFO->DL_req);
|
||||
}
|
||||
if (Sched_INFO->TX_req->Number_of_PDUs > 0)
|
||||
{
|
||||
oai_nfapi_tx_data_req(Sched_INFO->TX_req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < number_ul_tti_pdu; i++) {
|
||||
switch (UL_tti_req->pdus_list[i].pdu_type) {
|
||||
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUSCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
nr_fill_ulsch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pusch_pdu);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUCCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
nr_fill_pucch(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].pucch_pdu);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
|
||||
nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||
if (gNB->RU_list[0]->if_south == LOCAL_RF) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,11 @@
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
|
||||
// added
|
||||
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame,int slot,
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu);
|
||||
|
||||
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO);
|
||||
|
||||
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||
@@ -48,3 +53,8 @@ void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
|
||||
|
||||
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t harq_pid, uint8_t crc_flag);
|
||||
//added
|
||||
|
||||
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu);
|
||||
|
||||
@@ -161,7 +161,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
|
||||
if (nfapi_mode == 0 || nfapi_mode == 1) {
|
||||
if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) {
|
||||
if ((!(frame%ssb_frame_periodicity))) // generate SSB only for given frames according to SSB periodicity
|
||||
nr_common_signal_procedures(gNB,frame, slot);
|
||||
}
|
||||
@@ -544,6 +544,9 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
}
|
||||
|
||||
void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
/* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */
|
||||
int pucch_decode_done = 0;
|
||||
int pusch_decode_done = 0;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1);
|
||||
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
|
||||
@@ -553,6 +556,11 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
|
||||
gNB_I0_measurements(gNB);
|
||||
|
||||
// measure enegry in SS=10 L=4, nb_rb = 18, first_rb = 0 (corresponds to msg3)
|
||||
int offset = 10*gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset;
|
||||
int power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12*18);
|
||||
LOG_D(PHY,"frame %d, slot %d: UL signal energy %d\n",frame_rx,slot_rx,power_rxF);
|
||||
|
||||
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||
if (pucch) {
|
||||
@@ -560,6 +568,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
(pucch->frame == frame_rx) &&
|
||||
(pucch->slot == slot_rx) ) {
|
||||
|
||||
pucch_decode_done = 1;
|
||||
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu;
|
||||
uint16_t num_ucis;
|
||||
switch (pucch_pdu->format_type) {
|
||||
@@ -648,6 +658,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
}
|
||||
#endif
|
||||
|
||||
pusch_decode_done = 1;
|
||||
|
||||
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,1);
|
||||
@@ -675,5 +687,9 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
// figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS
|
||||
if ((frame_rx&127) == 0 && slot_rx==19) dump_pusch_stats(gNB);
|
||||
|
||||
if (pucch_decode_done || pusch_decode_done) {
|
||||
T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4));
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0);
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
|
||||
|
||||
/* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */
|
||||
if ((ulsch->harq_processes[harq_pid]->first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */
|
||||
ulsch->harq_processes[harq_pid]->first_tx = 0;
|
||||
ulsch->harq_processes[harq_pid]->first_tx = 0;
|
||||
ulsch->harq_processes[harq_pid]->pusch_pdu.pusch_data.new_data_indicator = ndi; /* store first value of ndi */
|
||||
ulsch->harq_processes[harq_pid]->round = 0;
|
||||
ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user