diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index 0a033cf760..118eb844d4 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -405,6 +405,26 @@ pipeline { } } } + stage ("SA-AW2S-CN5G") { + when { expression {do5Gtest} } + steps { + script { + triggerSlaveJob ('RAN-SA-AW2S-CN5G', 'SA-AW2S-CN5G') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-SA-AW2S-CN5G') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } //avra is offline, re-enable once it is available //stage ("T1-Offload-Test") { diff --git a/ci-scripts/Jenkinsfile-physim-deploy b/ci-scripts/Jenkinsfile-physim-deploy index 2bdcac42aa..ef5b1f2852 100644 --- a/ci-scripts/Jenkinsfile-physim-deploy +++ b/ci-scripts/Jenkinsfile-physim-deploy @@ -211,10 +211,16 @@ pipeline { script { dir ('ci-scripts') { // Zipping all archived log files - sh "zip -r -qq physim_deploytest_logs_${env.BUILD_ID}.zip physim_test_logs_*/*" - sh "rm -rf physim_test_logs_*/" - if (fileExists("physim_deploytest_logs_${env.BUILD_ID}.zip")) { - archiveArtifacts artifacts: "physim_deploytest_logs_${env.BUILD_ID}.zip" + sh "mkdir test_logs" + sh "mv *.log* test_logs || true" + sh "zip -r -qq test_logs_${env.BUILD_ID}.zip *test_log*/" + sh "rm -rf *test_log*/" + if (fileExists("test_logs_${env.BUILD_ID}.zip")) { + archiveArtifacts artifacts: "test_logs_${env.BUILD_ID}.zip" + } + if (fileExists("test_logs_CN.zip")){ + sh "mv test_logs_CN.zip test_logs_CN_${env.BUILD_ID}.zip" + archiveArtifacts artifacts: "test_logs_CN_${env.BUILD_ID}.zip" } if (fileExists("test_results.html")) { sh "mv test_results.html test_results-${env.JOB_NAME}.html" diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index 07c1ce5db0..7196d266d8 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -197,6 +197,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST SCA.eNBSourceCodePath=matchReg.group(1) PHYSIM.eNBSourceCodePath=matchReg.group(1) CLUSTER.eNBSourceCodePath=matchReg.group(1) + EPC.eNBSourceCodePath=matchReg.group(1) elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1SourceCodePath=matchReg.group(1) @@ -219,10 +220,10 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST EPC.SourceCodePath=matchReg.group(1) elif re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-EPCType=(.+)$', myArgv, re.IGNORECASE) - if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE): + if re.match('OAI', matchReg.group(1), re.IGNORECASE) or re.match('ltebox', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-CUPS', matchReg.group(1), re.IGNORECASE) or re.match('OAI-Rel14-Docker', matchReg.group(1), re.IGNORECASE) or re.match('OC-OAI-CN5G', matchReg.group(1), re.IGNORECASE): EPC.Type=matchReg.group(1) else: - sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker)') + sys.exit('Invalid EPC Type: ' + matchReg.group(1) + ' -- (should be OAI or ltebox or OAI-Rel14-CUPS or OAI-Rel14-Docker or OC-OAI-CN5G)') elif re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-EPCContainerPrefix=(.+)$', myArgv, re.IGNORECASE) EPC.ContainerPrefix=matchReg.group(1) @@ -260,14 +261,17 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUST matchReg = re.match('^\-\-OCUserName=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCUserName = matchReg.group(1) CLUSTER.OCUserName = matchReg.group(1) + EPC.OCUserName = matchReg.group(1) elif re.match('^\-\-OCPassword=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCPassword=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCPassword = matchReg.group(1) CLUSTER.OCPassword = matchReg.group(1) + EPC.OCPassword = matchReg.group(1) elif re.match('^\-\-OCProjectName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCProjectName=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCProjectName = matchReg.group(1) CLUSTER.OCProjectName = matchReg.group(1) + EPC.OCProjectName = matchReg.group(1) elif re.match('^\-\-OCUrl=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCUrl=(.+)$', myArgv, re.IGNORECASE) CLUSTER.OCUrl = matchReg.group(1) diff --git a/ci-scripts/as_ue/aw2s-asue.cfg b/ci-scripts/as_ue/aw2s-asue.cfg new file mode 100644 index 0000000000..805c794b0d --- /dev/null +++ b/ci-scripts/as_ue/aw2s-asue.cfg @@ -0,0 +1,183 @@ +/* UE simulator configuration file version 2021-06-17 + * LTE / 5G Non StandAlone + * Copyright (C) 2019-2021 Amarisoft + */ +{ +#define N_ANTENNA_DL 1 +#define TDD 1 + +log_options: "all.level=warn,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1", +log_filename: "/tmp/ue1.log", + +/* Enable remote API and Web interface */ +com_addr: "0.0.0.0:9002", + +include "rf_driver/1chan.cfg", + +/* If true, allow the simulation of several UEs at the same time and +allow dynamic UE creation from remote API */ + +cell_groups: [{ + group_type: "nr", + multi_ue: true, + cells: [{ + rf_port: 0, + bandwidth: 20, +#if TDD == 1 + band: 78, + dl_nr_arfcn:627360, + ssb_nr_arfcn:627360, +#else + band: 7, + dl_nr_arfcn: 536020, + ssb_nr_arfcn: 535930, + ssb_subcarrier_spacing: 15, +#endif + subcarrier_spacing: 30, + n_antenna_dl: N_ANTENNA_DL, + n_antenna_ul: 1, + rx_to_tx_latency:2, + }], + }], + + ue_list: [ + { + /* UE capabilities */ + /* USIM data */ + "ue_id" : 1, + "imsi": "001010000000100", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + + /* Enable it to create a TUN interface for each UE PDN */ + tun_setup_script: "ue-ifup", + }, + { + /* UE capabilities */ + /* USIM data */ + "ue_id" : 2, + "imsi": "001010000000101", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, }, ], + default_pdu_session_snssai: { sst: 1, }, + + /* Enable it to create a TUN interface for each UE PDN */ + tun_setup_script: "ue-ifup", + }, + { + /* UE capabilities */ + /* USIM data */ + "ue_id" : 3, + "imsi": "001010000000102", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, sd: 66051, }, ], + default_pdu_session_snssai: { sst: 1, sd: 66051, }, + + /* Enable it to create a TUN interface for each UE PDN */ + tun_setup_script: "ue-ifup", + }, + { + /* UE capabilities */ + /* USIM data */ + "ue_id" : 4, + "imsi": "001010000000103", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, sd: 66051, }, ], + default_pdu_session_snssai: { sst: 1, sd: 66051, }, + + /* Enable it to create a TUN interface for each UE PDN */ + tun_setup_script: "ue-ifup", + }, + { + /* UE capabilities */ + /* USIM data */ + "ue_id" : 5, + "imsi": "001010000000104", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, sd: 66051, }, ], + default_pdu_session_snssai: { sst: 1, sd: 66051, }, + + /* Enable it to create a TUN interface for each UE PDN */ + tun_setup_script: "ue-ifup", + }, + { + /* UE capabilities */ + /* USIM data */ + "ue_id" : 6, + "imsi": "001010000000105", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, sd: 66051, }, ], + default_pdu_session_snssai: { sst: 1, sd: 66051, }, + + /* Enable it to create a TUN interface for each UE PDN */ + tun_setup_script: "ue-ifup", + }, + { + /* UE capabilities */ + + /* USIM data */ + "ue_id" : 7, + "imsi": "001010000000106", + "K": "fec86ba6eb707ed08905757b1bb44b8f", + "sim_algo":"milenage", + "op": "1006020f0a478bf6b699f15c062e42b3", + + as_release: 15, + ue_category: "nr", + apn:"oai", + attach_pdn_type:"ipv4", + default_nssai: [ { sst: 1, sd: 66051, }, ], + default_pdu_session_snssai: { sst: 1, sd: 66051, }, + + + /* Enable it to allow sim_events to be handled remotely */ + //rue_addr: "127.1.0.0", + /* Enable it to create a TUN interface for each UE PDN */ + tun_setup_script: "ue-ifup", + }, + ], +} + diff --git a/ci-scripts/as_ue/oaicicd-3xue-noPing-SATest.cfg b/ci-scripts/as_ue/oaicicd-3xue-noPing-SATest.cfg deleted file mode 100644 index a9299b67e3..0000000000 --- a/ci-scripts/as_ue/oaicicd-3xue-noPing-SATest.cfg +++ /dev/null @@ -1,172 +0,0 @@ -/* UE simulator configuration */ - - -/* UE simulator configuration file version 2021-06-17 - * LTE / 5G Non StandAlone - * Copyright (C) 2019-2021 Amarisoft - */ -{ -#define N_ANTENNA_DL 1 -#define TDD 1 -#define CELL_BANDWIDTH 40 -#define UE_COUNT 3 // number of simulated UEs 208970100001127, 208970100001128, 208970100001129 - - -log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1", -log_filename: "/tmp/ue0.log", - -/* Enable remote API and Web interface */ -com_addr: "0.0.0.0:9002", - -include "rf_driver/1chan.cfg", - -/* If true, allow the simulation of several UEs at the same time and allow dynamic UE creation from remote API */ - -cell_groups: [{ - group_type: "nr", - multi_ue: true, - cells: [{ - rf_port: 0, - bandwidth: CELL_BANDWIDTH, -#if TDD == 1 - band: 78, - dl_nr_arfcn:621312, - ssb_nr_arfcn:621312, - - //band: 41, - //dl_nr_arfcn:517020, - //ssb_nr_arfcn:516990, -#else - band: 7, - dl_nr_arfcn: 536020, - ssb_nr_arfcn: 535930, - ssb_subcarrier_spacing: 15, -#endif - subcarrier_spacing: 30, - n_antenna_dl: N_ANTENNA_DL, - n_antenna_ul: 1, - rx_to_tx_latency:2, - }], -}], - - -/* Enable it to allow sim_events to be handled remotely */ -//rue_bind_addr: "127.0.10.11", - - - -ue_list: [ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 0, - "imsi": "208970100001127", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - event: "power_off", - start_time: 30, - } - ] /*end sim events */ - }, /*end UE object 0*/ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 1, - "imsi": "208970100001128", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - event: "power_off", - start_time: 30, - } - ] /*end sim events */ - }, /*end UE object 1*/ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 2, - "imsi": "208970100001129", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - event: "power_off", - start_time: 30, - } - ] /*end sim events */ - } /*end UE object 2*/ - ],/*end UE list*/ -}/*end json*/ - diff --git a/ci-scripts/as_ue/oaicicd-multi-ue-1xPing-SATest.cfg b/ci-scripts/as_ue/oaicicd-multi-ue-1xPing-SATest.cfg deleted file mode 100644 index 3405f99a59..0000000000 --- a/ci-scripts/as_ue/oaicicd-multi-ue-1xPing-SATest.cfg +++ /dev/null @@ -1,142 +0,0 @@ -/* UE simulator configuration */ - - -/* UE simulator configuration file version 2021-06-17 - * LTE / 5G Non StandAlone - * Copyright (C) 2019-2021 Amarisoft - */ -{ -#define N_ANTENNA_DL 1 -#define TDD 1 -#define CELL_BANDWIDTH 40 -#define UE_COUNT 2 // number of simulated UEs 208970100001127, 208970100001128, 208970100001129 - - -log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1", -log_filename: "/tmp/ue0.log", - -/* Enable remote API and Web interface */ -com_addr: "0.0.0.0:9002", - -include "rf_driver/1chan.cfg", - -/* If true, allow the simulation of several UEs at the same time and allow dynamic UE creation from remote API */ - -cell_groups: [{ - group_type: "nr", - multi_ue: true, - cells: [{ - rf_port: 0, - bandwidth: CELL_BANDWIDTH, -#if TDD == 1 - band: 78, - dl_nr_arfcn:621312, - ssb_nr_arfcn:621312, - - //band: 41, - //dl_nr_arfcn:517020, - //ssb_nr_arfcn:516990, -#else - band: 7, - dl_nr_arfcn: 536020, - ssb_nr_arfcn: 535930, - ssb_subcarrier_spacing: 15, -#endif - subcarrier_spacing: 30, - n_antenna_dl: N_ANTENNA_DL, - n_antenna_ul: 1, - rx_to_tx_latency:2, - }], -}], - - -/* Enable it to allow sim_events to be handled remotely */ -//rue_bind_addr: "127.0.10.11", - - - -ue_list: [ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 1, - "imsi": "208970100001127", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - event: "power_off", - start_time: 30, - } - ] /*end sim events */ - }, /*end UE object 0*/ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 2, - "imsi": "208970100001128", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - "tag": "ping", - "prog":"oai_ext_app.sh", - start_time: 15, - end_time: 25, - "args":["ping 192.168.70.136"], - "event":"ext_app" - }, - { - event: "power_off", - start_time: 30, - } - ] /*end sim events */ - } /*end UE object 1*/ - ],/*end UE list*/ -}/*end json*/ diff --git a/ci-scripts/as_ue/oaicicd-multi-ue-2xPing-SATest.cfg b/ci-scripts/as_ue/oaicicd-multi-ue-2xPing-SATest.cfg deleted file mode 100644 index eaa9b894fc..0000000000 --- a/ci-scripts/as_ue/oaicicd-multi-ue-2xPing-SATest.cfg +++ /dev/null @@ -1,150 +0,0 @@ -/* UE simulator configuration */ - - -/* UE simulator configuration file version 2021-06-17 - * LTE / 5G Non StandAlone - * Copyright (C) 2019-2021 Amarisoft - */ -{ -#define N_ANTENNA_DL 1 -#define TDD 1 -#define CELL_BANDWIDTH 40 -#define UE_COUNT 2 // number of simulated UEs 208970100001127, 208970100001128, 208970100001129 - - -log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1", -log_filename: "/tmp/ue0.log", - -/* Enable remote API and Web interface */ -com_addr: "0.0.0.0:9002", - -include "rf_driver/1chan.cfg", - -/* If true, allow the simulation of several UEs at the same time and allow dynamic UE creation from remote API */ - -cell_groups: [{ - group_type: "nr", - multi_ue: true, - cells: [{ - rf_port: 0, - bandwidth: CELL_BANDWIDTH, -#if TDD == 1 - band: 78, - dl_nr_arfcn:621312, - ssb_nr_arfcn:621312, - - //band: 41, - //dl_nr_arfcn:517020, - //ssb_nr_arfcn:516990, -#else - band: 7, - dl_nr_arfcn: 536020, - ssb_nr_arfcn: 535930, - ssb_subcarrier_spacing: 15, -#endif - subcarrier_spacing: 30, - n_antenna_dl: N_ANTENNA_DL, - n_antenna_ul: 1, - rx_to_tx_latency:2, - }], -}], - - -/* Enable it to allow sim_events to be handled remotely */ -//rue_bind_addr: "127.0.10.11", - - - -ue_list: [ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 1, - "imsi": "208970100001127", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - "tag": "ping", - "prog":"oai_ext_app.sh", - start_time: 15, - end_time: 25, - "args":["ping 192.168.70.136"], - "event":"ext_app" - }, - { - event: "power_off", - start_time: 30, - } - ] /*end sim events */ - }, /*end UE object 0*/ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 2, - "imsi": "208970100001128", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - "tag": "ping", - "prog":"oai_ext_app.sh", - start_time: 15, - end_time: 25, - "args":["ping 192.168.70.136"], - "event":"ext_app" - }, - { - event: "power_off", - start_time: 30, - } - ] /*end sim events */ - } /*end UE object 1*/ - ],/*end UE list*/ -}/*end json*/ diff --git a/ci-scripts/as_ue/oaicicd-multi-ue-2xPingSeq-SATest.cfg b/ci-scripts/as_ue/oaicicd-multi-ue-2xPingSeq-SATest.cfg deleted file mode 100644 index 9ebb3e01c5..0000000000 --- a/ci-scripts/as_ue/oaicicd-multi-ue-2xPingSeq-SATest.cfg +++ /dev/null @@ -1,150 +0,0 @@ -/* UE simulator configuration */ - - -/* UE simulator configuration file version 2021-06-17 - * LTE / 5G Non StandAlone - * Copyright (C) 2019-2021 Amarisoft - */ -{ -#define N_ANTENNA_DL 1 -#define TDD 1 -#define CELL_BANDWIDTH 40 -#define UE_COUNT 2 // number of simulated UEs 208970100001127, 208970100001128, 208970100001129 - - -log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1", -log_filename: "/tmp/ue0.log", - -/* Enable remote API and Web interface */ -com_addr: "0.0.0.0:9002", - -include "rf_driver/1chan.cfg", - -/* If true, allow the simulation of several UEs at the same time and allow dynamic UE creation from remote API */ - -cell_groups: [{ - group_type: "nr", - multi_ue: true, - cells: [{ - rf_port: 0, - bandwidth: CELL_BANDWIDTH, -#if TDD == 1 - band: 78, - dl_nr_arfcn:621312, - ssb_nr_arfcn:621312, - - //band: 41, - //dl_nr_arfcn:517020, - //ssb_nr_arfcn:516990, -#else - band: 7, - dl_nr_arfcn: 536020, - ssb_nr_arfcn: 535930, - ssb_subcarrier_spacing: 15, -#endif - subcarrier_spacing: 30, - n_antenna_dl: N_ANTENNA_DL, - n_antenna_ul: 1, - rx_to_tx_latency:2, - }], -}], - - -/* Enable it to allow sim_events to be handled remotely */ -//rue_bind_addr: "127.0.10.11", - - - -ue_list: [ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 1, - "imsi": "208970100001127", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - "tag": "ping", - "prog":"oai_ext_app.sh", - start_time: 20, - end_time: 30, - "args":["ping 192.168.70.136"], - "event":"ext_app" - }, - { - event: "power_off", - start_time: 60, - } - ] /*end sim events */ - }, /*end UE object 0*/ - { - /* UE capabilities */ - /* USIM data */ - "ue_id" : 2, - "imsi": "208970100001128", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - sim_events: [ - { - event: "power_on", - start_time: 5, - }, - { - "tag": "ping", - "prog":"oai_ext_app.sh", - start_time: 40, - end_time: 50, - "args":["ping 192.168.70.136"], - "event":"ext_app" - }, - { - event: "power_off", - start_time: 60, - } - ] /*end sim events */ - } /*end UE object 1*/ - ],/*end UE list*/ -}/*end json*/ diff --git a/ci-scripts/as_ue/oaicicd-ue-Ping-SATest.cfg b/ci-scripts/as_ue/oaicicd-ue-Ping-SATest.cfg deleted file mode 100644 index ba22cbb233..0000000000 --- a/ci-scripts/as_ue/oaicicd-ue-Ping-SATest.cfg +++ /dev/null @@ -1,113 +0,0 @@ -/* UE simulator configuration */ - - - -/* UE simulator configuration file version 2021-06-17 - * LTE / 5G Non StandAlone - * Copyright (C) 2019-2021 Amarisoft - */ -{ -#define N_ANTENNA_DL 1 -#define TDD 1 -#define CELL_BANDWIDTH 40 - - - log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1", - log_filename: "/tmp/ue1.log", - - /* Enable remote API and Web interface */ - com_addr: "0.0.0.0:9002", - - include "rf_driver/1chan.cfg", - - /* If true, allow the simulation of several UEs at the same time and - allow dynamic UE creation from remote API */ - -cell_groups: [{ - group_type: "nr", - multi_ue: false, - cells: [{ - rf_port: 0, - bandwidth: CELL_BANDWIDTH, -#if TDD == 1 - band: 78, - dl_nr_arfcn:621312, - ssb_nr_arfcn:621312, - - //band: 41, - //dl_nr_arfcn:517020, - //ssb_nr_arfcn:516990, -#else - band: 7, - dl_nr_arfcn: 536020, - ssb_nr_arfcn: 535930, - ssb_subcarrier_spacing: 15, -#endif - subcarrier_spacing: 30, - n_antenna_dl: N_ANTENNA_DL, - n_antenna_ul: 1, - rx_to_tx_latency:2, - }], - }], - - - - - /* Enable it to allow sim_events to be handled remotely */ - //rue_bind_addr: "127.0.10.11", - - ue_list: [ - { - /* UE capabilities */ - - /* USIM data */ - - - "imsi": "208970100001127", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - - - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 66051, - }, - ], - - default_pdu_session_snssai: { - sst: 1, - sd: 66051, - }, - - - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - - sim_events: [{ - event: "power_on", - start_time: 5, - }, { - "tag": "ping", - "prog":"oai_ext_app.sh", - start_time: 15, - end_time: 25, - "args":["ping 192.168.70.136"], - "event":"ext_app" - - }, - { - event: "power_off", - start_time: 30, - }] - } - ], -} diff --git a/ci-scripts/as_ue/oaicicd-ue-iperf-SATest.cfg b/ci-scripts/as_ue/oaicicd-ue-iperf-SATest.cfg deleted file mode 100644 index 841dafb746..0000000000 --- a/ci-scripts/as_ue/oaicicd-ue-iperf-SATest.cfg +++ /dev/null @@ -1,109 +0,0 @@ -/* UE simulator configuration */ - - - -/* UE simulator configuration file version 2021-06-17 - * LTE / 5G Non StandAlone - * Copyright (C) 2019-2021 Amarisoft - */ -{ -#define N_ANTENNA_DL 1 -#define TDD 1 -#define CELL_BANDWIDTH 20 - - - log_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,rrc.level=debug,rrc.max_size=1", - log_filename: "/tmp/ue0.log", - - /* Enable remote API and Web interface */ - com_addr: "0.0.0.0:9002", - - include "rf_driver/1chan.cfg", - - /* If true, allow the simulation of several UEs at the same time and - allow dynamic UE creation from remote API */ - -cell_groups: [{ - group_type: "nr", - multi_ue: false, - cells: [{ - rf_port: 0, - bandwidth: CELL_BANDWIDTH, -#if TDD == 1 - // band: 78, - // dl_nr_arfcn:621312, - // ssb_nr_arfcn:621312,*/ - - band: 41, - dl_nr_arfcn:517020, - ssb_nr_arfcn:516990, -#else - band: 7, - dl_nr_arfcn: 536020, - ssb_nr_arfcn: 535930, - ssb_subcarrier_spacing: 15, -#endif - subcarrier_spacing: 30, - n_antenna_dl: N_ANTENNA_DL, - n_antenna_ul: 1, - rx_to_tx_latency:2, - }], - }], - - - - - /* Enable it to allow sim_events to be handled remotely */ - //rue_bind_addr: "127.0.10.11", - - ue_list: [ - { - /* UE capabilities */ - - /* USIM data */ - - "imsi": "208970100001127", - "K": "fec86ba6eb707ed08905757b1bb44b8f", - "sim_algo":"milenage", - "op": "1006020f0a478bf6b699f15c062e42b3", - - - as_release: 15, - ue_category: "nr", - apn:"oai", - attach_pdn_type:"ipv4", - default_nssai: [ - { - sst: 1, - sd: 1, - }, - ], - - default_pdu_session_snssai: { - sst: 1, - sd: 1, - }, - - - /* Enable it to allow sim_events to be handled remotely */ - //rue_addr: "127.1.0.0", - - /* Enable it to create a TUN interface for each UE PDN */ - tun_setup_script: "ue-ifup", - - sim_events: [{ - event: "power_on", - start_time: 5, - }, { - event: "ext_app", - start_time: 15, - end_time: 25, - prog: "ext_app.sh", - args: ["iperf", " -c 172.21.10.5", " -u"," -b 1M"," -i 1"," -t 10"] - }, { - event: "power_off", - start_time: 30, - }] - } - ], -} diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml index c51be6652c..3040eb5ad3 100644 --- a/ci-scripts/ci_ueinfra.yaml +++ b/ci-scripts/ci_ueinfra.yaml @@ -49,75 +49,75 @@ adb_ue_2: amarisoft_ue: Host: amariue - InitScript: nohup /root/NV18-06-2022/ue/lteue /root/NV18-06-2022/ue/config/oaicicd-ue-ci-test.cfg & - TermScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"quit"}' + InitScript: /root/NV18-06-2022/lteue-linux-2023-03-17/lteue /root/oaicicd/ran_sa_aw2s_asue/aw2s-asue.cfg & + TermScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"quit"}' amarisoft_ue_1: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":1}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":1}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":1}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":1}' UENetworkScript: ip netns exec ue1 ip a show dev pdn0 CmdPrefix: ip netns exec ue1 MTU: 1500 amarisoft_ue_2: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":2}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":2}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":2}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":2}' UENetworkScript: ip netns exec ue2 ip a show dev pdn0 CmdPrefix: ip netns exec ue2 MTU: 1500 amarisoft_ue_3: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":3}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":3}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":3}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":3}' UENetworkScript: ip netns exec ue3 ip a show dev pdn0 CmdPrefix: ip netns exec ue3 MTU: 1500 amarisoft_ue_4: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":4}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":4}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":4}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":4}' UENetworkScript: ip netns exec ue4 ip a show dev pdn0 CmdPrefix: ip netns exec ue4 MTU: 1500 amarisoft_ue_5: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":5}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":5}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":5}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":5}' UENetworkScript: ip netns exec ue5 ip a show dev pdn0 CmdPrefix: ip netns exec ue5 MTU: 1500 amarisoft_ue_6: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":6}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":6}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":6}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":6}' UENetworkScript: ip netns exec ue6 ip a show dev pdn0 CmdPrefix: ip netns exec ue6 MTU: 1500 amarisoft_ue_7: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":7}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":7}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":7}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":7}' UENetworkScript: ip netns exec ue7 ip a show dev pdn0 CmdPrefix: ip netns exec ue7 MTU: 1500 amarisoft_ue_8: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":8}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":8}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":8}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":8}' UENetworkScript: ip netns exec ue8 ip a show dev pdn0 CmdPrefix: ip netns exec ue8 MTU: 1500 amarisoft_ue_9: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":9}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":9}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":9}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":9}' UENetworkScript: ip netns exec ue9 ip a show dev pdn0 CmdPrefix: ip netns exec ue9 MTU: 1500 amarisoft_ue_10: Host: amariue - AttachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":10}' - DetachScript: /root/NV18-06-2022/lteue-linux-2022-06-18/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":10}' + AttachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":10}' + DetachScript: /root/NV18-06-2022/lteue-linux-2023-03-17/doc/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":10}' UENetworkScript: ip netns exec ue10 ip a show dev pdn0 CmdPrefix: ip netns exec ue10 MTU: 1500 diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 487e203d36..648d132b9e 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -40,6 +40,29 @@ import cls_cmd IMAGE_REGISTRY_SERVICE_NAME = "image-registry.openshift-image-registry.svc" NAMESPACE = "oaicicd-ran" +OCUrl = "https://api.oai.cs.eurecom.fr:6443" +OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/" + + +def OC_login(cmd, ocUserName, ocPassword, ocProjectName): + if ocUserName == '' or ocPassword == '' or ocProjectName == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter: no OC Credentials') + if OCRegistry.startswith("http") and not self.OCRegistry.endswith("/"): + sys.exit(f'ocRegistry {OCRegistry} should not start with http:// or https:// and end on a slash /') + ret = cmd.run(f'oc login -u {ocUserName} -p {ocPassword} --server {OCUrl}') + if ret.returncode != 0: + logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m') + return False + ret = cmd.run(f'oc project {ocProjectName}') + if ret.returncode != 0: + logging.error(f'\u001B[1mUnable to access OC project {ocProjectName}\u001B[0m') + OC_logout(cmd) + return False + return True + +def OC_logout(cmd): + cmd.run(f'oc logout') class Cluster: def __init__(self): @@ -57,7 +80,7 @@ class Cluster: self.ranAllowMerge = False self.ranTargetBranch = "" self.cmd = None - + self.imageToPull = '' def _recreate_entitlements(self): # recreating entitlements, don't care if deletion fails @@ -170,11 +193,47 @@ class Cluster: def _undeploy_pod(self, filename): self.cmd.run(f'oc delete -f {filename}') + def PullClusterImage(self, HTML, RAN): + if self.imageToPull == '': + HELP.GenericHelp(CONST.Version) + HELP.EPCSrvHelp(self.imageToPull) + sys.exit('Insufficient eNB Parameters') + lIpAddr = self.eNBIPAddress + self.testCase_id = HTML.testCase_id + cmd = cls_cmd.getConnection(lIpAddr) + succeeded = OC_login(cmd, self.OCUserName, self.OCPassword, self.OCProjectName) + if not succeeded: + logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m') + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + return False + ret = cmd.run(f'oc whoami -t | docker login -u oaicicd --password-stdin {self.OCRegistry}') + if ret.returncode != 0: + logging.error(f'\u001B[1m Unable to access OC project {ocProjectName}\u001B[0m') + OC_logout(cmd) + cmd.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + return False + for image in self.imageToPull: + imagePrefix = f'{self.OCRegistry}{self.OCProjectName}' + imageTag = cls_containerize.ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) + ret = cmd.run(f'docker pull {imagePrefix}/{imageTag}') + if ret.returncode != 0: + logging.error(f'Could not pull {image} from local registry : {self.OCRegistry}') + OC_logout(cmd) + cmd.close() + HTML.CreateHtmlTestRow('msg', 'KO', CONST.ALL_PROCESSES_OK) + return False + cmd.run(f'docker tag {imagePrefix}/{imageTag} oai-ci/{imageTag}') + cmd.run(f'docker rmi {imagePrefix}/{imageTag}') + OC_logout(cmd) + cmd.close() + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + return True + def BuildClusterImage(self, HTML): if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': HELP.GenericHelp(CONST.Version) sys.exit(f'Insufficient Parameter: ranRepository {self.ranRepository} ranBranch {ranBranch} ranCommitID {self.ranCommitID}') - lIpAddr = self.eNBIPAddress lSourcePath = self.eNBSourceCodePath if lIpAddr == '' or lSourcePath == '': @@ -204,7 +263,6 @@ class Cluster: baseTag = 'develop' forceBaseImageBuild = False - imageTag = 'develop' if self.ranAllowMerge: # merging MR branch into develop -> temporary image imageTag = f'{self.ranBranch}-{self.ranCommitID[0:8]}' if self.ranTargetBranch == 'develop': @@ -214,6 +272,7 @@ class Cluster: forceBaseImageBuild = True baseTag = 'ci-temp' else: + imageTag = f'develop-{self.ranCommitID[0:8]}' forceBaseImageBuild = True # logging to OC Cluster and then switch to corresponding project @@ -273,11 +332,18 @@ class Cluster: ranbuild_job = self._start_build('ran-build') attemptedImages += ['ran-build'] - wait = ranbuild_job is not None and physim_job is not None and self._wait_build_end([ranbuild_job, physim_job], 1200) - if not wait: logging.error('error during build of ranbuild_job or physim_job') + self._recreate_is_tag('oai-clang', imageTag, 'openshift/oai-clang-is.yaml') + self._recreate_bc('oai-clang', imageTag, 'openshift/oai-clang-bc.yaml') + self._retag_image_statement('ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.clang.rhel8.2') + clang_job = self._start_build('oai-clang') + attemptedImages += ['oai-clang'] + + wait = ranbuild_job is not None and physim_job is not None and clang_job is not None and self._wait_build_end([ranbuild_job, physim_job, clang_job], 1200) + if not wait: logging.error('error during build of ranbuild_job or physim_job or clang_job') status = status and wait self.cmd.run(f'oc logs {ranbuild_job} &> cmake_targets/log/ran-build.log') self.cmd.run(f'oc logs {physim_job} &> cmake_targets/log/oai-physim.log') + self.cmd.run(f'oc logs {clang_job} &> cmake_targets/log/oai-clang.log') self.cmd.run(f'oc get pods.metrics.k8s.io &>> cmake_targets/log/build-metrics.log', '\$', 10) if status: diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 492a48805a..7cddae85db 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -31,8 +31,8 @@ #----------------------------------------------------------- # Import #----------------------------------------------------------- -import sys # arg -import re # reg +import sys # arg +import re # reg import logging import os import shutil @@ -47,6 +47,7 @@ from zipfile import ZipFile #----------------------------------------------------------- # OAI Testing modules #----------------------------------------------------------- +import cls_cluster as OC import cls_cmd import sshconnection as SSH import helpreadme as HELP @@ -90,6 +91,15 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge logging.debug(f'Merging with the target branch: {ranTargetBranch}') sshSession.command(f'git merge --ff origin/{ranTargetBranch} -m "Temporary merge for CI"', '\$', 30) +def ImageTagToUse(imageName, ranCommitID, ranBranch, ranAllowMerge): + shortCommit = ranCommitID[0:8] + if ranAllowMerge: + tagToUse = f'{ranBranch}-{shortCommit}' + else: + tagToUse = f'develop-{shortCommit}' + fullTag = f'{imageName}:{tagToUse}' + return fullTag + def CopyLogsToExecutor(cmd, sourcePath, log_name): cmd.cd(f'{sourcePath}/cmake_targets') cmd.run(f'rm -f {log_name}.zip') @@ -306,7 +316,6 @@ class Containerize(): self.registrySvrId = '' self.testSvrId = '' self.imageToPull = [] - #checkers from xml self.ran_checkers={} @@ -383,7 +392,7 @@ class Containerize(): CreateWorkspace(cmd, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) - # if asterix, copy the entitlement and subscription manager configurations + # if asterix, copy the entitlement and subscription manager configurations if self.host == 'Red Hat': cmd.run('mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca') cmd.run('cp /etc/rhsm/rhsm.conf ./rhsm-conf/') @@ -649,15 +658,6 @@ class Containerize(): HTML.CreateHtmlTestRow('commit ' + tag, 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) - def ImageTagToUse(self, imageName): - shortCommit = self.ranCommitID[0:8] - if self.ranAllowMerge: - tagToUse = f'{self.ranBranch}-{shortCommit}' - else: - tagToUse = f'develop-{shortCommit}' - fullTag = f'porcepix.sboai.cs.eurecom.fr/{imageName}:{tagToUse}' - return fullTag - def Push_Image_to_Local_Registry(self, HTML): if self.registrySvrId == '0': lIpAddr = self.eNBIPAddress @@ -680,8 +680,8 @@ class Containerize(): logging.debug('Pushing images from server: ' + lIpAddr) mySSH = SSH.SSHConnection() mySSH.open(lIpAddr, lUserName, lPassWord) - - mySSH.command('docker login -u oaicicd -p oaicicd porcepix.sboai.cs.eurecom.fr', '\$', 5) + imagePrefix = 'porcepix.sboai.cs.eurecom.fr' + mySSH.command(f'docker login -u oaicicd -p oaicicd {imagePrefix}', '\$', 5) if re.search('Login Succeeded', mySSH.getBefore()) is None: msg = 'Could not log into local registry' logging.error(msg) @@ -694,9 +694,9 @@ class Containerize(): orgTag = 'ci-temp' imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup'] for image in imageNames: - tagToUse = self.ImageTagToUse(image) - mySSH.command(f'docker image tag {image}:{orgTag} {tagToUse}', '\$', 5) - mySSH.command(f'docker push {tagToUse}', '\$', 120) + tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) + mySSH.command(f'docker image tag {image}:{orgTag} {imagePrefix}/{tagToUse}', '\$', 5) + mySSH.command(f'docker push {imagePrefix}/{tagToUse}', '\$', 120) if re.search(': digest:', mySSH.getBefore()) is None: logging.debug(mySSH.getBefore()) msg = f'Could not push {image} to local registry : {tagToUse}' @@ -704,9 +704,9 @@ class Containerize(): mySSH.close() HTML.CreateHtmlTestRow(msg, 'KO', CONST.ALL_PROCESSES_OK) return False - mySSH.command(f'docker rmi {tagToUse} {image}:{orgTag}', '\$', 30) + mySSH.command(f'docker rmi {imagePrefix}/{tagToUse} {image}:{orgTag}', '\$', 30) - mySSH.command('docker logout porcepix.sboai.cs.eurecom.fr', '\$', 5) + mySSH.command(f'docker logout {imagePrefix}', '\$', 5) if re.search('Removing login credentials', mySSH.getBefore()) is None: msg = 'Could not log off from local registry' logging.error(msg) @@ -739,25 +739,18 @@ class Containerize(): if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': HELP.GenericHelp(CONST.Version) sys.exit('Insufficient Parameter') - if lIpAddr != 'none': - logging.debug('Pulling images onto server: ' + lIpAddr) - myCmd = cls_cmd.RemoteCmd(lIpAddr) - else: - logging.debug('Pulling images locally') - myCmd = cls_cmd.LocalCmd() - - cmd = 'docker login -u oaicicd -p oaicicd porcepix.sboai.cs.eurecom.fr' - response = myCmd.run(cmd) + myCmd = cls_cmd.getConnection(lIpAddr) + imagePrefix = 'porcepix.sboai.cs.eurecom.fr' + response = myCmd.run(f'docker login -u oaicicd -p oaicicd {imagePrefix}') if response.returncode != 0: msg = 'Could not log into local registry' logging.error(msg) myCmd.close() HTML.CreateHtmlTestRow(msg, 'KO', CONST.ALL_PROCESSES_OK) return False - for image in self.imageToPull: - tagToUse = self.ImageTagToUse(image) - cmd = f'docker pull {tagToUse}' + tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) + cmd = f'docker pull {imagePrefix}/{tagToUse}' response = myCmd.run(cmd, timeout=120) if response.returncode != 0: logging.debug(response) @@ -766,16 +759,15 @@ class Containerize(): myCmd.close() HTML.CreateHtmlTestRow('msg', 'KO', CONST.ALL_PROCESSES_OK) return False - - cmd = 'docker logout porcepix.sboai.cs.eurecom.fr' - response = myCmd.run(cmd) + myCmd.run(f'docker tag {imagePrefix}/{tagToUse} oai-ci/{tagToUse}') + myCmd.run(f'docker rmi {imagePrefix}/{tagToUse}') + response = myCmd.run(f'docker logout {imagePrefix}') if response.returncode != 0: msg = 'Could not log off from local registry' logging.error(msg) myCmd.close() HTML.CreateHtmlTestRow(msg, 'KO', CONST.ALL_PROCESSES_OK) return False - myCmd.close() HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) return True @@ -810,7 +802,8 @@ class Containerize(): imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup'] for image in imageNames: - cmd = f'docker rmi {self.ImageTagToUse(image)}' + imageTag = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) + cmd = f'docker rmi oai-ci/{imageTag}' myCmd.run(cmd, reportNonZero=False) myCmd.close() @@ -845,10 +838,10 @@ class Containerize(): mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5) mySSH.command('cp docker-compose.y*ml ci-docker-compose.yml', '\$', 5) - imagesList = ['oai-enb', 'oai-gnb', 'oai-nr-cuup'] + imagesList = ['oai-enb', 'oai-gnb', 'oai-nr-cuup', 'oai-gnb-aw2s'] for image in imagesList: - imageToUse = self.ImageTagToUse(image) - mySSH.command(f'sed -i -e "s#image: {image}:latest#image: {imageToUse}#" ci-docker-compose.yml', '\$', 2) + imageTag = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) + mySSH.command(f'sed -i -e "s#image: {image}:latest#image: oai-ci/{imageTag}#" ci-docker-compose.yml', '\$', 2) localMmeIpAddr = EPC.MmeIPAddress mySSH.command('sed -i -e "s/CI_MME_IP_ADDR/' + localMmeIpAddr + '/" ci-docker-compose.yml', '\$', 2) @@ -966,6 +959,7 @@ class Containerize(): logging.debug('\u001B[1m Undeploying OAI Object from server: ' + lIpAddr + '\u001B[0m') mySSH = SSH.SSHConnection() mySSH.open(lIpAddr, lUserName, lPassWord) + mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5) svcName = self.services[self.eNB_instance] @@ -981,7 +975,7 @@ class Containerize(): for s in allServices: mySSH.command(f'docker-compose -f ci-docker-compose.yml ps --all -- {s}', '\$', 5, silent=False) running = mySSH.getBefore().split('\r\n')[2:-1] - #logging.debug(f'running services: {running}') + logging.debug(f'running services: {running}') if len(running) > 0: # something is running for that service services.append(s) logging.info(f'stopping services {services}') @@ -1050,13 +1044,12 @@ class Containerize(): myCmd.close() HTML.CreateHtmlTestRow('SVC not Found', 'KO', CONST.ALL_PROCESSES_OK) return - cmd = 'cp docker-compose.y*ml docker-compose-ci.yml' myCmd.run(cmd, silent=self.displayedNewTags) imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup'] for image in imageNames: - tagToUse = self.ImageTagToUse(image) - cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@{tagToUse}@" docker-compose-ci.yml' + tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) + cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@oai-ci/{tagToUse}@" docker-compose-ci.yml' myCmd.run(cmd, silent=self.displayedNewTags) self.displayedNewTags = True @@ -1193,13 +1186,12 @@ class Containerize(): ymlPath = self.yamlPath[0].split('/') logPath = '../cmake_targets/log/' + ymlPath[1] myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0]) - cmd = 'cp docker-compose.y*ml docker-compose-ci.yml' myCmd.run(cmd, silent=self.displayedNewTags) imageNames = ['oai-enb', 'oai-gnb', 'oai-lte-ue', 'oai-nr-ue', 'oai-lte-ru', 'oai-nr-cuup'] for image in imageNames: - tagToUse = self.ImageTagToUse(image) - cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@{tagToUse}@" docker-compose-ci.yml' + tagToUse = ImageTagToUse(image, self.ranCommitID, self.ranBranch, self.ranAllowMerge) + cmd = f'sed -i -e "s@oaisoftwarealliance/{image}:develop@oai-ci/{tagToUse}@" docker-compose-ci.yml' myCmd.run(cmd, silent=self.displayedNewTags) self.displayedNewTags = True diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 2bd8ba4263..551a8994f8 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -605,6 +605,8 @@ class OaiCiTest(): Target = EPC.MmeIPAddress elif re.match('OAICN5G', EPC.Type, re.IGNORECASE): Target = EPC.MmeIPAddress + elif re.match('OC-OAI-CN5G', EPC.Type, re.IGNORECASE): + Target = "172.21.6.100" else: Target = EPC.IPAddress #ping from module NIC rather than IP address to make sure round trip is over the air diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 0a45f945a2..2306db513f 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -114,7 +114,7 @@ class PhySim: logging.debug('Merging with the target branch: ' + self.ranTargetBranch) mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 30) else: - imageTag = "develop" + imageTag = f'develop-{self.ranCommitID[0:8]}' # logging to OC Cluster and then switch to corresponding project mySSH.command(f'oc login -u {ocUserName} -p {ocPassword} --server https://api.oai.cs.eurecom.fr:6443', '\$', 30) diff --git a/ci-scripts/conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf b/ci-scripts/conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf new file mode 100644 index 0000000000..9da10eefbd --- /dev/null +++ b/ci-scripts/conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf @@ -0,0 +1,281 @@ +Active_gNBs = ( "gNB-Eurecom-n78_20"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +#device :{ +# name = "aw2sori_transpro"; +#} + +gNBs = +( + { + ////////// Identification parameters: + gNB_CU_ID = 0xe00; + + gNB_name = "gNB-Eurecom-n78_20"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 0x1; + plmn_list = ({ mcc = 001; mnc = 01; mnc_length = 2; snssaiList = ({ sst =0x1; }) }); + + nr_cellid = 12345678L + + ////////// Physical parameters: + pdsch_AntennaPorts_XP = 2; + pusch_AntennaPorts = 2; + do_CSIRS = 1; + do_SRS = 0; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 11; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3410.4 MHz => 301 REs from PointA 25 PRBs + 1 RE + absoluteFrequencySSB = 627360; + dl_frequencyBand = 78; + # this is 3410.4 - (51*12*30e-3/2) = 3401.22 MHz + dl_absoluteFrequencyPointA = 626748; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 51; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=50 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 13750; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 11; # this means shift of 14, so Coreset is in PRBs 1..48, SSB starts at PRB 15 + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 51; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 13750; +# 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 = 15; + preambleReceivedTargetPower = -104; +#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 = 3; +#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, + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-96; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -96; +# 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 = 5; + nrofDownlinkSlots = 2; + 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; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "172.21.6.100"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_NG_AMF = "eno33np0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.124/20"; + GNB_INTERFACE_NAME_FOR_NGU = "eno33np0"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.124/20"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + ulsch_max_frame_inactivity = 10; + ul_max_mcs = 15; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 50; + pusch_dtx_threshold = 10; + } +); + +RUs = ( + { + local_if_name = "ens7f3"; + remote_address = "192.168.80.239"; + local_address = "192.168.80.24"; + local_portc = 50000; + remote_portc = 55444; + local_portd = 52001; + remote_portd = 52183; + local_rf = "no" + tr_preference = "udp_ecpri_if5" + nb_tx = 2 + nb_rx = 2 + att_tx = 16 + att_rx = 0; + num_tp_cores = 4; + rxfh_core_id = 9; + txfh_core_id = 10; + tp_cores = [11,12,13,14]; + nr_flag = 1; + eNB_instances = [0]; + bands = [78]; + sl_ahead = 5; + ##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]; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #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"; + f1ap_log_level ="debug"; + f1ap_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/epc.py b/ci-scripts/epc.py index 7483458ec3..f3f23f198c 100644 --- a/ci-scripts/epc.py +++ b/ci-scripts/epc.py @@ -31,8 +31,8 @@ #----------------------------------------------------------- # Import #----------------------------------------------------------- -import sys # arg -import re # reg +import sys # arg +import re # reg import logging import os import time @@ -46,10 +46,13 @@ from multiprocessing import Process, Lock, SimpleQueue import sshconnection as SSH import helpreadme as HELP import constants as CONST - +import cls_cluster as OC +import cls_cmd #----------------------------------------------------------- # Class Declaration #----------------------------------------------------------- + + class EPCManagement(): def __init__(self): @@ -68,7 +71,13 @@ class EPCManagement(): self.isMagmaUsed = False self.cfgDeploy = '--type start-mini --scenario 1 --capture /tmp/oai-cn5g-v1.5.pcap' #from xml, 'mini' is default normal for docker-network.py self.cfgUnDeploy = '--type stop-mini --scenario 1' #from xml, 'mini' is default normal for docker-network.py - + self.OCUrl = "https://api.oai.cs.eurecom.fr:6443" + self.OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/" + self.OCUserName = '' + self.OCPassword = '' + self.OCProjectName = '' + self.imageToPull = '' + self.eNBSourceCodePath = '' #----------------------------------------------------------- # EPC management functions @@ -235,8 +244,7 @@ class EPCManagement(): HELP.GenericHelp(CONST.Version) HELP.EPCSrvHelp(self.IPAddress, self.UserName, self.Password, self.SourceCodePath, self.Type) sys.exit('Insufficient EPC Parameters') - mySSH = SSH.SSHConnection() - mySSH.open(self.IPAddress, self.UserName, self.Password) + mySSH = cls_cmd.getConnection(self.IPAddress) html_cell = '' if re.match('ltebox', self.Type, re.IGNORECASE): logging.debug('Using the SABOX simulated HSS') @@ -286,6 +294,40 @@ class EPCManagement(): if res4 is not None: html_cell += '(' + res4.group('date') + ')' html_cell += '\n' + elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): + self.testCase_id = HTML.testCase_id + imageNames = ["oai-nrf", "oai-amf", "oai-smf", "oai-spgwu-tiny", "oai-ausf", "oai-udm", "oai-udr", "mysql","oai-traffic-server"] + logging.debug('Deploying OAI CN5G on Openshift Cluster') + lIpAddr = self.IPAddress + lSourcePath = self.SourceCodePath + succeeded = OC.OC_login(mySSH, self.OCUserName, self.OCPassword, self.OCProjectName) + if not succeeded: + logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m') + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + return False + for ii in imageNames: + mySSH.run(f'helm uninstall {ii}', reportNonZero=False) + mySSH.run(f'helm spray {lSourcePath}/ci-scripts/charts/oai-5g-basic/.') + ret = mySSH.run(f'oc get pods', silent=True) + if ret.stdout.count('Running') != 9: + logging.error('\u001B[1m Deploying 5GCN Failed using helm chart on OC Cluster\u001B[0m') + for ii in imageNames: + mySSH.run('helm uninstall '+ ii) + ret = mySSH.run(f'oc get pods') + if re.search('No resources found', ret.stdout): + logging.debug('All pods uninstalled') + OC.OC_logout(mySSH) + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL) + return False + ret = mySSH.run(f'oc get pods', silent=True) + for line in ret.stdout.split('\n')[1:]: + columns = line.strip().split() + name = columns[0] + status = columns[2] + html_cell += status + ' ' + name + html_cell += '\n' + OC.OC_logout(mySSH) else: logging.error('This option should not occur!') mySSH.close() @@ -311,6 +353,10 @@ class EPCManagement(): else: logging.error('no container with name oai-amf found, could not retrieve AMF IP address') mySSH.close() + elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): + mySSH = SSH.SSHConnection() + mySSH.open(self.IPAddress, self.UserName, self.Password) + response=mySSH.command3('oc pods ls -f name=oai-amf', 10) def CheckHSSProcess(self, status_queue): try: @@ -513,8 +559,9 @@ class EPCManagement(): HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) def Terminate5GCN(self, HTML): - mySSH = SSH.SSHConnection() - mySSH.open(self.IPAddress, self.UserName, self.Password) + imageNames = ["mysql", "oai-nrf", "oai-amf", "oai-smf", "oai-spgwu-tiny", "oai-ausf", "oai-udm", "oai-udr", "oai-traffic-server"] + containerInPods = ["", "-c nrf", "-c amf", "-c smf", "-c spgwu", "-c ausf", "-c udm", "-c udr", ""] + mySSH = cls_cmd.getConnection(self.IPAddress) message = '' if re.match('ltebox', self.Type, re.IGNORECASE): logging.debug('Terminating SA BOX') @@ -545,6 +592,37 @@ class EPCManagement(): else: message = 'No Tracking area update request' logging.debug(message) + elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): + logging.debug('Terminating OAI CN5G on Openshift Cluster') + lIpAddr = self.IPAddress + lSourcePath = self.SourceCodePath + mySSH.run(f'rm -Rf {lSourcePath}/logs') + mySSH.run(f'mkdir -p {lSourcePath}/logs') + logging.debug('OC OAI CN5G - Collecting Log files to workspace') + succeeded = OC.OC_login(mySSH, self.OCUserName, self.OCPassword, self.OCProjectName) + if not succeeded: + logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m') + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + return False + mySSH.run(f'oc describe pod &> {lSourcePath}/logs/describe-pods-post-test.log') + mySSH.run(f'oc get pods.metrics.k8s &> {lSourcePath}/logs/nf-resource-consumption.log') + for ii, ci in zip(imageNames, containerInPods): + podName = mySSH.run(f"oc get pods | grep {ii} | awk \'{{print $1}}\'").stdout.strip() + if not podName: + logging.debug(f'{ii} pod not found!') + HTML.CreateHtmlTestRow(self.Type, 'KO', CONST.INVALID_PARAMETER) + HTML.CreateHtmlTabFooter(False) + mySSH.run(f'oc logs -f {podName} {ci} &> {lSourcePath}/logs/{ii}.log &') + mySSH.run(f'helm uninstall {ii}') + podName = '' + mySSH.run(f'cd {lSourcePath}/logs && zip -r -qq test_logs_CN.zip *.log') + mySSH.copyin(f'{lSourcePath}/logs/test_logs_CN.zip','test_logs_CN.zip') + ret = mySSH.run(f'oc get pods', silent=True) + res = re.search('No resources found in oaicicd-ran namespace.', ret.stdout) + if res is not None: + logging.debug('OC OAI CN5G components uninstalled') + message = 'OC OAI CN5G components uninstalled' + OC.OC_logout(mySSH) else: logging.error('This should not happen!') mySSH.close() @@ -784,6 +862,8 @@ class EPCManagement(): mySSH.command('zip hss.log.zip hss_check_run.*', '\$', 60) elif re.match('OAICN5G', self.Type, re.IGNORECASE): logging.debug('LogCollect is bypassed for that variant') + elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): + logging.debug('LogCollect is bypassed for that variant') elif re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('zip hss.log.zip hss*.log', '\$', 60) mySSH.command('echo ' + self.Password + ' | sudo -S rm hss*.log', '\$', 5) @@ -798,10 +878,13 @@ class EPCManagement(): mySSH.close() def LogCollectMME(self): - mySSH = SSH.SSHConnection() - mySSH.open(self.IPAddress, self.UserName, self.Password) - mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) - mySSH.command('rm -f mme.log.zip', '\$', 5) + if self.Type != 'OC-OAI-CN5G': + mySSH = SSH.SSHConnection() + mySSH.open(self.IPAddress, self.UserName, self.Password) + mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5) + mySSH.command('rm -f mme.log.zip', '\$', 5) + else: + mySSH = cls_cmd.getConnection(self.IPAddress) if re.match('OAI-Rel14-Docker', self.Type, re.IGNORECASE): mySSH.command('docker inspect prod-oai-mme', '\$', 10) result = re.search('No such object', mySSH.getBefore()) @@ -819,6 +902,10 @@ class EPCManagement(): mySSH.command('cp -f /tmp/oai-cn5g-v1.5.pcap .','\$', 30) mySSH.command('zip mme.log.zip oai-amf.log oai-nrf.log oai-cn5g*.pcap','\$', 30) mySSH.command('mv mme.log.zip ' + self.SourceCodePath + '/scripts','\$', 30) + elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): + mySSH.run('cd ' + self.SourceCodePath + '/logs') + mySSH.run('zip mme.log.zip oai-amf.log oai-nrf.log oai-cn5g*.pcap') + mySSH.run('mv mme.log.zip ' + self.SourceCodePath + '/scripts') elif re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('zip mme.log.zip mme*.log', '\$', 60) mySSH.command('echo ' + self.Password + ' | sudo -S rm mme*.log', '\$', 5) @@ -852,6 +939,10 @@ class EPCManagement(): mySSH.command('cd ' + self.SourceCodePath + '/logs','\$', 5) mySSH.command('zip spgw.log.zip oai-smf.log oai-spgwu.log','\$', 30) mySSH.command('mv spgw.log.zip ' + self.SourceCodePath + '/scripts','\$', 30) + elif re.match('OC-OAI-CN5G', self.Type, re.IGNORECASE): + mySSH.command('cd ' + self.SourceCodePath + '/logs','\$', 5) + mySSH.command('zip spgw.log.zip oai-smf.log oai-spgwu.log','\$', 30) + mySSH.command('mv spgw.log.zip ' + self.SourceCodePath + '/scripts','\$', 30) elif re.match('OAI', self.Type, re.IGNORECASE) or re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE): mySSH.command('zip spgw.log.zip spgw*.log', '\$', 60) mySSH.command('echo ' + self.Password + ' | sudo -S rm spgw*.log', '\$', 5) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 1a7607d5d5..97bc6fbef1 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -38,12 +38,12 @@ import helpreadme as HELP import constants as CONST -import cls_oaicitest #main class for OAI CI test framework -import cls_physim #class PhySim for physical simulators build and test -import cls_containerize #class Containerize for all container-based operations on RAN/UE objects -import cls_static_code_analysis #class for static code analysis -import cls_physim1 #class PhySim for physical simulators deploy and run -import cls_cluster # class for building/deploying on cluster +import cls_oaicitest #main class for OAI CI test framework +import cls_physim #class PhySim for physical simulators build and test +import cls_containerize #class Containerize for all container-based operations on RAN/UE objects +import cls_static_code_analysis #class for static code analysis +import cls_physim1 #class PhySim for physical simulators deploy and run +import cls_cluster # class for building/deploying on cluster import sshconnection import epc @@ -430,7 +430,11 @@ def GetParametersFromXML(action): RAN.node = test.findtext('node') RAN.command = test.findtext('command') RAN.command_fail = test.findtext('command_fail') in ['True', 'true', 'Yes', 'yes'] - + elif action == 'Pull_Cluster_Image': + # CLUSTER.imageToPull.clear() + string_field = test.findtext('images_to_pull') + if (string_field is not None): + CLUSTER.imageToPull = string_field.split() else: logging.warning(f"unknown action {action} from option-parsing point-of-view") @@ -829,6 +833,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re HTML=ldpc.Run_NRulsimTest(HTML,CONST,id) if ldpc.exitStatus==1: RAN.prematureExit = True + elif action == 'Pull_Cluster_Image': + if not CLUSTER.PullClusterImage(HTML,RAN): + RAN.prematureExit = True elif action == 'Build_Cluster_Image': if not CLUSTER.BuildClusterImage(HTML): RAN.prematureExit = True diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 7388701a17..1f7b1afdbe 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -1,5 +1,6 @@ - Build_Proxy - Build_Cluster_Image + - Pull_Cluster_Image - Build_PhySim - Run_LDPCTest - Run_LDPCt1Test diff --git a/ci-scripts/xml_files/container_sa_aw2s_asue.xml b/ci-scripts/xml_files/container_sa_aw2s_asue.xml new file mode 100644 index 0000000000..7d1709d53f --- /dev/null +++ b/ci-scripts/xml_files/container_sa_aw2s_asue.xml @@ -0,0 +1,122 @@ + + + TEST-5G-AW2S + 20 MHz TDD SA + tasks + 1 + + 010000 + 001000 + 020000 + 002000 + 002002 + 000100 + 000200 + 003000 + 004000 + 000002 + 030000 + + + + + Pull_Cluster_Image + Pull Images from Cluster + oai-gnb-aw2s + + + + Deploy_Object + Deploy gNB (TDD/Band78/20MHz/aw2s) in a container + ci-scripts/yaml_files/sa_aw2s_gnb + 0 + 0 + + + + Initialize_UE + Initialize Amarisoft UE + amarisoft_ue + + + + Attach_UE + Attach UE + amarisoft_ue_1 + + + + Attach_UE + Attach UE + amarisoft_ue_2 + + + + Ping + Ping: 20pings in 20sec + amarisoft_ue_1 amarisoft_ue_2 + -c 20 + 1 + 15 + + + + Ping + Ping: 100pings in 20sec + amarisoft_ue_1 amarisoft_ue_2 + -c 100 -i 0.2 + 1 + 15 + + + + Detach_UE + Detach UE + amarisoft_ue_1 amarisoft_ue_2 + + + + Terminate_UE + Terminate UE + amarisoft_ue + + + + IdleSleep + Sleep + 5 + + + + Undeploy_Object + Undeploy gNB + ci-scripts/yaml_files/sa_aw2s_gnb + 0 + 0 + 20,100,100,100 + 20,100,100,100 + + + + diff --git a/ci-scripts/yaml_files/sa_aw2s_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_aw2s_gnb/docker-compose.yml new file mode 100644 index 0000000000..7468df5e62 --- /dev/null +++ b/ci-scripts/yaml_files/sa_aw2s_gnb/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3.8' +services: + oai-gnb: + image: oai-gnb-aw2s:latest + privileged: true + network_mode: "host" + container_name: oai-gnb-aw2s + environment: + TZ: Europe/Paris + USE_VOLUMED_CONF: 'yes' + USE_ADDITIONAL_OPTIONS: --sa + volumes: + - ../../conf_files/gnb.sa.band78.51prb.aw2s.ddsuu.conf:/opt/oai-gnb-aw2s/etc/mounted.conf + healthcheck: + test: /bin/bash -c "pgrep nr-softmodem" + interval: 10s + timeout: 5s + retries: 5 diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index 7840e89e28..934726a6c3 100755 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -289,11 +289,13 @@ (Test10: Format 2 9-bit 2/106 PRB), (Test11: Format 2 10-bit 2/106 PRB), (Test12: Format 2 11-bit 2/106 PRB), - (Test13: Format 2 12-bit 8/106 PRB), - (Test14: Format 2 19-bit 8/106 PRB), - (Test15: Format 2 32-bit 8/106 PRB), - (Test16: Format 2 32-bit 16/106 PRB), - (Test17: Format 2 64-bit 16/106 PRB) + (Test13: Format 2 12-bit 4/106 PRB), + (Test14: Format 2 19-bit 4/106 PRB), + (Test15: Format 2 12-bit 8/106 PRB), + (Test16: Format 2 19-bit 8/106 PRB), + (Test17: Format 2 32-bit 8/106 PRB), + (Test18: Format 2 32-bit 16/106 PRB), + (Test19: Format 2 64-bit 16/106 PRB) nr_pucchsim -R 106 -i 1 -P 0 -b 1 -s-2 -n1000 -R 106 -i 1 -P 0 -b 2 -s-2 -n1000 @@ -307,12 +309,14 @@ -R 106 -i 1 -P 2 -b 9 -s5 -n1000 -R 106 -i 1 -P 2 -b 10 -s6 -n1000 -R 106 -i 1 -P 2 -b 11 -s6 -n1000 + -R 106 -i 1 -P 2 -q4 -b 12 -s-3 -n1000 + -R 106 -i 1 -P 2 -q4 -b 19 -s-3 -n1000 -R 106 -i 1 -P 2 -q8 -b 12 -s-3 -n1000 -R 106 -i 1 -P 2 -q8 -b 19 -s-3 -n1000 -R 106 -i 1 -P 2 -q8 -b 32 -s-3 -n1000 -R 106 -i 1 -P 2 -q16 -b 32 -s-3 -n1000 -R 106 -i 1 -P 2 -q16 -b 64 -s-3 -n1000 - test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 test14 test15 test16 test17 + test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 PUCCH test OK segmentation fault|assertion|exiting|fatal 3 @@ -351,22 +355,24 @@ - nr_ulsim Test cases. (Test1: MCS 9, 106 PRBs), - (Test2: MCS 16, 50 PRBs), - (Test3: MCS 28, 50 PRBs), - (Test4: MCS 9, 217 PRBs), - (Test5: MCS 9, 273 PRBs), - (Test6: PUSCH Type A, 2 DMRS Symbols), - (Test7: PUSCH Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols), - (Test8: PUSCH Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols), - (Test9: PUSCH Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols), - (Test10: 25 PRBs, 15 kHz SCS), - (Test11: MCS 0, low SNR performance) - (Test12: MCS 28, 106 PRBs, Time shift 8) + nr_ulsim Test cases. (Test1: MCS 9 106 PRBs), + (Test2: MCS 16 50 PRBs), + (Test3: MCS 28 50 PRBs), + (Test4: MCS 27 50 PRBs 256QAM), + (Test5: MCS 9 217 PRBs), + (Test6: MCS 9 273 PRBs), + (Test7: PUSCH Type A, 2 DMRS Symbols), + (Test8: PUSCH Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols), + (Test9: PUSCH Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols), + (Test10: PUSCH Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols), + (Test11: 25 PRBs, 15 kHz SCS), + (Test12: MCS 0, low SNR performance) + (Test13: MCS 28, 106 PRBs, Time shift 8) nr_ulsim -n100 -m9 -r106 -s5 -n100 -m16 -s10 -n100 -m28 -s20 + -n100 -m27 -s25 -q1 -n100 -m9 -R217 -r217 -s5 -n100 -m9 -R273 -r273 -s5 -n100 -s5 -U 0,1,1,1 @@ -376,7 +382,7 @@ -n100 -u0 -m0 -R25 -r25 -i 1,0 -n100 -m0 -S -0.6 -i 1,0 -n100 -m 28 -R106 -r106 -t90 -s24 -S24 -d 8 - test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 + test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13 PUSCH test OK segmentation fault|assertion|exiting|fatal 3 diff --git a/common/platform_constants.h b/common/platform_constants.h index 8fc8d9c237..8e17c18343 100644 --- a/common/platform_constants.h +++ b/common/platform_constants.h @@ -81,7 +81,7 @@ #define RLC_TX_MAXSIZE 10000000 #define RLC_RX_MAXSIZE 10000000 #define SEND_MRW_ON 240 - +#define MAX_ANT 8 // CBA constant #define NUM_MAX_CBA_GROUP 4 diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 25586abe82..4c60d21e4e 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -49,8 +49,8 @@ int get_supported_band_index(int scs, int band, int n_rbs) int scs_index = scs; if (band > 256) scs_index++; - for (int i = 0; i < 11; i++) { - if(n_rbs == tables_5_3_2[scs][i]) + for (int i = 0; i < 12; i++) { + if(n_rbs == tables_5_3_2[scs_index][i]) return i; } return (-1); // not found @@ -130,34 +130,34 @@ const nr_bandentry_t nr_bandtable[] = { {261,27500040,28350000,27500040,28350000, 2,2070833, 120} }; -int get_supported_bw_khz(frequency_range_t frequency_range, int bw_index) +int get_supported_bw_mhz(frequency_range_t frequency_range, int bw_index) { if (frequency_range == FR1) { switch (bw_index) { case 0 : - return 5000; // 5MHz + return 5; // 5MHz case 1 : - return 10000; + return 10; case 2 : - return 15000; + return 15; case 3 : - return 20000; + return 20; case 4 : - return 25000; + return 25; case 5 : - return 30000; + return 30; case 6 : - return 40000; + return 40; case 7 : - return 50000; + return 50; case 8 : - return 60000; + return 60; case 9 : - return 80000; + return 80; case 10 : - return 90000; + return 90; case 11 : - return 100000; + return 100; default : AssertFatal(false, "Invalid band index for FR1 %d\n", bw_index); } @@ -165,13 +165,13 @@ int get_supported_bw_khz(frequency_range_t frequency_range, int bw_index) else { switch (bw_index) { case 0 : - return 50000; // 50MHz + return 50; // 50MHz case 1 : - return 100000; + return 100; case 2 : - return 200000; + return 200; case 3 : - return 400000; + return 400; default : AssertFatal(false, "Invalid band index for FR2 %d\n", bw_index); } @@ -184,7 +184,7 @@ bool compare_relative_ul_channel_bw(int nr_band, int scs, int nb_ul, frame_type_ // Relative channel bandwidth <= 4% for TDD bands and <= 3% for FDD bands int index = get_nr_table_idx(nr_band, scs); int bw_index = get_supported_band_index(scs, nr_band, nb_ul); - int band_size_khz = get_supported_bw_khz(nr_band > 256 ? FR2 : FR1, bw_index); + int band_size_khz = get_supported_bw_mhz(nr_band > 256 ? FR2 : FR1, bw_index) * 1000; float limit = frame_type == TDD ? 0.04 : 0.03; float rel_bw = (float) (2 * band_size_khz) / (float) (nr_bandtable[index].ul_max + nr_bandtable[index].ul_min); return rel_bw <= limit; @@ -382,118 +382,6 @@ int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index) return delta_duplex; } -uint16_t config_bandwidth(int mu, int nb_rb, int nr_band) -{ - - if (nr_band < 100) { //FR1 - switch(mu) { - case 0 : - if (nb_rb<=25) - return 5; - if (nb_rb<=52) - return 10; - if (nb_rb<=79) - return 15; - if (nb_rb<=106) - return 20; - if (nb_rb<=133) - return 25; - if (nb_rb<=160) - return 30; - if (nb_rb<=216) - return 40; - if (nb_rb<=270) - return 50; - AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band); - break; - case 1 : - if (nb_rb<=11) - return 5; - if (nb_rb<=24) - return 10; - if (nb_rb<=38) - return 15; - if (nb_rb<=51) - return 20; - if (nb_rb<=65) - return 25; - if (nb_rb<=78) - return 30; - if (nb_rb<=106) - return 40; - if (nb_rb<=133) - return 50; - if (nb_rb<=162) - return 60; - if (nb_rb<=189) - return 70; - if (nb_rb<=217) - return 80; - if (nb_rb<=245) - return 90; - if (nb_rb<=273) - return 100; - AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band); - break; - case 2 : - if (nb_rb<=11) - return 10; - if (nb_rb<=18) - return 15; - if (nb_rb<=24) - return 20; - if (nb_rb<=31) - return 25; - if (nb_rb<=38) - return 30; - if (nb_rb<=51) - return 40; - if (nb_rb<=65) - return 50; - if (nb_rb<=79) - return 60; - if (nb_rb<=93) - return 70; - if (nb_rb<=107) - return 80; - if (nb_rb<=121) - return 90; - if (nb_rb<=135) - return 100; - AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band); - break; - default: - AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band); - } - } - else { - switch(mu) { - case 2 : - if (nb_rb<=66) - return 50; - if (nb_rb<=132) - return 100; - if (nb_rb<=264) - return 200; - AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band); - break; - case 3 : - if (nb_rb<=32) - return 50; - if (nb_rb<=66) - return 100; - if (nb_rb<=132) - return 200; - if (nb_rb<=264) - return 400; - AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band); - break; - default: - AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band); - } - } -} - // Returns the corresponding row index of the NR table int get_nr_table_idx(int nr_bandP, uint8_t scs_index) { int scs_khz = 15 << scs_index; diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 9c3ba88be2..9f258ea448 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -76,7 +76,6 @@ int get_first_ul_slot(int nrofDownlinkSlots, int nrofDownlinkSymbols, int nrofUp int cce_to_reg_interleaving(const int R, int k, int n_shift, const int C, int L, const int N_regs); int get_SLIV(uint8_t S, uint8_t L); void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset); -uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); int get_nr_table_idx(int nr_bandP, uint8_t scs_index); int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index); frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index); @@ -94,6 +93,7 @@ int get_supported_band_index(int scs, int band, int n_rbs); long rrc_get_max_nr_csrs(const int max_rbs, long b_SRS); void get_K1_K2(int N1, int N2, int *K1, int *K2); bool compare_relative_ul_channel_bw(int nr_band, int scs, int nb_ul, frame_type_t frame_type); +int get_supported_bw_mhz(frequency_range_t frequency_range, int bw_index); void get_samplerate_and_bw(int mu, int n_rb, int8_t threequarter_fs, diff --git a/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c b/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c index 969521b3c5..ae04666c95 100644 --- a/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c +++ b/common/utils/telnetsrv/telnetsrv_5Gue_measurements.c @@ -96,10 +96,7 @@ void measurcmd_display_phyta(telnet_printfunc_t prnt) PHY_VARS_NR_UE *UE = PHY_vars_UE_g[0][0]; prnt("%s PHY TA stats\n", HDR); prnt("N_TA_offset %d\n", UE->N_TA_offset); - for (int i = 0; i < UE->n_connected_gNB; ++i) { - NR_UL_TIME_ALIGNMENT_t *ta = &UE->ul_time_alignment[i]; - prnt("gNB %d TA command %d TA total %d TAG ID %d\n", i, ta->ta_command, ta->ta_total, ta->tag_id); - } + prnt("TA command %d\n", UE->ta_command); prnt("timing_advance %d (samples)\n", UE->timing_advance); } /* diff --git a/common/utils/time_meas.h b/common/utils/time_meas.h index 1bca9c3466..3b5e194c2c 100644 --- a/common/utils/time_meas.h +++ b/common/utils/time_meas.h @@ -153,15 +153,17 @@ static inline void start_meas(time_stats_t *ts) { static inline void stop_meas(time_stats_t *ts) { if (opp_enabled) { long long out = rdtsc_oai(); - ts->diff += (out-ts->in); - /// process duration is the difference between two clock points - ts->p_time = (out-ts->in); - ts->diff_square += ((double)out-ts->in)*((double)out-ts->in); + if (ts->in) { + ts->diff += (out - ts->in); + /// process duration is the difference between two clock points + ts->p_time = (out - ts->in); + ts->diff_square += ((double)out - ts->in) * ((double)out - ts->in); - if ((out-ts->in) > ts->max) - ts->max = out-ts->in; + if ((out - ts->in) > ts->max) + ts->max = out - ts->in; - ts->meas_flag=0; + ts->meas_flag = 0; + } } } diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md index 726fe84a74..b3ca79c070 100644 --- a/doc/FEATURE_SET.md +++ b/doc/FEATURE_SET.md @@ -259,6 +259,7 @@ The following features are valid for the gNB and the 5G-NR UE. - PTRS support - Support for 1, 2 and 4 TX antennas - Support for up to 2 layers (currently limited to DMRS configuration type 2) + - Support for 256 QAM * NR-CSIRS Generation of sequence at PHY * NR-PUSCH (including Segmentation, LDPC encoding, rate matching, scrambling, modulation, RB mapping, etc). - PUSCH mapping type A and B @@ -267,6 +268,7 @@ The following features are valid for the gNB and the 5G-NR UE. - PTRS support - Support for up to 2 RX antenna - Support for up to 2 layers + - Support for 256 QAM * NR-PUCCH - Format 0 (2 bits, for ACK/NACK and SR) - Format 2 (up to 11 bits, mainly for CSI feedback) diff --git a/doc/README.md b/doc/README.md index 8612665a7c..4e881b7a4b 100644 --- a/doc/README.md +++ b/doc/README.md @@ -88,7 +88,7 @@ Some directories under `radio` contain READMEs: - [RFsimulator](../radio/rfsimulator/README.md) - [USRP](../radio/USRP/README.md) - [BladeRF](../radio/BLADERF/README) -- [IQPlayer](../radio/iqplayer/DOC/iqrecordplayer_usage.md) +- [IQPlayer](../radio/iqplayer/DOC/iqrecordplayer_usage.md), and [general documentation](./iqrecordplayer_usage.md) The other SDRs (AW2S, LimeSDR, ...) have no READMEs. diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md index 596097c3d3..aef3a7f63e 100644 --- a/doc/TESTBenches.md +++ b/doc/TESTBenches.md @@ -21,6 +21,7 @@ | starsky | 172.21.18.45 | CI-Starsky-Legacy-TDD-eNB | eNB (B40) | b200mini (30A3E3C) | | carabe | 172.21.18.47 | CI-Carabe-Legacy-FDD-OAI-LTE-UE | UE (B7UE) | B200mini (30AE8C9) | | nokiabox | 172.21.19.39 | _None_ | gNB (Nokia), 5GC | _Nokia RF integrated_ | +| avra | 172.21.16.124 | CI-Avra-Usage | gNB (n78) | AW2S Jaguar (192.168.80.239) | Note: The available resources, and their current usage, is indicated here: - [Lockable resources of jenkins-oai](https://jenkins-oai.eurecom.fr/lockable-resources/): @@ -56,8 +57,9 @@ Note: The available resources, and their current usage, is indicated here: **Purpose**: AW2S tests with Amarisoft -Picture: TBD +![5G AW2S Testbench](testbenches_doc_resources/5g-aw2s-bench.png) +[PDF version](testbenches_doc_resources/5g-aw2s-bench.pdf) | [LaTeX/TikZ version](testbenches_doc_resources/5g-aw2s-bench.tex) if you want to modify to reflect your setup ### 4G Testbench(es) @@ -67,7 +69,6 @@ Picture: TBD [PDF version](testbenches_doc_resources/4g-faraday-bench.pdf) | [LaTeX/TikZ version](testbenches_doc_resources/4g-faraday-bench.tex) if you want to modify to reflect your setup - ## Pipelines ### [RAN-Container-Parent](https://jenkins-oai.eurecom.fr/job/RAN-Container-Parent/) @@ -115,6 +116,9 @@ Webhook - basic SA test (20 MHz TDD), F1, reestablishment, ... - [RAN-Ubuntu20-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-Ubuntu18-Image-Builder/) - obelix: Ubuntu 20 image build using docker (Note: builds U20 images while pipeline is named U18!) +- [RAN-SA-AW2S-CN5G](https://jenkins-oai.eurecom.fr/job/RAN-SA-AW2S-CN5G/) + - 5G-NR SA test setup: Avra(RHEL9.1)/Manarola(U22PRO) + AW2S, Amarisoft UE x1, OAI CN5G + - uses OpenShift cluster for CN deployment and container images for gNB deployment ### RAN-CI-NSA-Trigger diff --git a/doc/iqrecordplayer_usage.md b/doc/iqrecordplayer_usage.md new file mode 100644 index 0000000000..603a74f4b5 --- /dev/null +++ b/doc/iqrecordplayer_usage.md @@ -0,0 +1,66 @@ +# I/Q record-replay +## using the iq record-replay + +This feature provides I/Q record-replay as initially presented in the 4th OAI workshop for LTE +(https://www.openairinterface.org/docs/workshop/4_OAI_Workshop_20171107/Talks/MONGAZON_Nokia-Bell-Labs-OAI-IQ.pdf) +The current implementation has been temporarily disrupted for LTE and only works for 5G SA +nr-uesoftmodem executable. + +The I/Q record-replay feature is briefly described hereafter, it allows you to: +* record slots received by the USRP board in a file while the system is operating. + For example you can record a full nrUE connection/traffic/disconnection sequence. + Today the OAI USRP device is the only one supporting the recording feature. +* replay slots from a previously recorded file to operate the system, + possibly in multiple loops if the recorded sequence is convenient from the logical point of view. + +The record-replay features are activated and configured using OAI configuration parameters + +### Record mode +options for record mode are: +* `subframes-record` Activate record mode +* `subframes-file` Path of the file used for slots recording (default is `/tmp/iqfile`) +* `subframes-max` Maximum count of slots to be recorded in a file (default is 120000) + +Note that the value of `--subframes-max` parameter needs to be tuned according to your RAM capabilities. +The default value is 120000, which allows for 120 seconds of record-replay but will require ~20GB of RAM and disk space. +If RAM does not allow for the parameter value, an error message will be displayed and the run will be aborted. +In record mode, to minimize performance impacts of operating software, slots are always saved into memory and +written to disk when the process terminates. +When you estimate the recorded sequence is achieved, you can terminate the nr-uesoftmodem by typing `CTRL-C`. +At that time, up to the value of `--subframes-max` slots will be written on disk. +The nr-uesoftmodem will indicate the exact count of slots written to disk, which may be less (but not higher) +than the value of `--subframes-max` parameter. + +>Recording session example: +```bash +./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --sa --nokrnmod 1 --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-record 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-max 30000 +............................................ +............................................ +............................................ +^C +[HW] Writing file header to /home/iqs/oai-nrUE-17042023.dat +[HW] Writing 4565 subframes to /home/iqs/oai-nrUE-17042023.dat +[HW] File /home/iqs/oai-nrUE-17042023.dat closed +[HW] releasing USRP + +### Replay mode +Replaying I/Q works only for nr-uesoftmodem at 40MHz bandwidth 3/4 sampling. +Mismatch between file content and run time parameters might lead to unpredictable results. +options for replay mode are: +* `subframes-replay` Activate replay mode +* `subframes-file` Path of the file used for slots replay (default is `/tmp/iqfile`) +* `subframes-loops` Number of iterations to replay the entire slots file (default is 5) +* `use-mmap` Boolean, set to 1 (true) by default, iq file is map to memory if true, otherwise iq's are read from file. + +>Replay mode session example: +```bash +./nr-uesoftmodem -O /home/oaitests/mediatek_sim.conf --sa --nokrnmod 1 --numerology 1 -r 106 -C 3649440000 --band 78 -E --ue-fo-compensation --device.recplay.subframes-replay 1 --device.recplay.subframes-file /home/iqs/oai-nrUE-17042023.dat --device.recplay.use-mmap 1 --device.recplay.subframes-loops 1 +.................................. +.................................. +[HW] Replay iqs from USRP B200 device, bandwidth 4.000000e+07 +[HW] Loaded 4565 subframes. +[HW] iqplayer device initialized, replay /home/iqs/oai-nrUE-17042023.dat for 1 iteration(s) +.................................. +.................................. + +[OAI Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/doc/testbenches_doc_resources/5g-aw2s-bench.pdf b/doc/testbenches_doc_resources/5g-aw2s-bench.pdf new file mode 100644 index 0000000000..9799887112 Binary files /dev/null and b/doc/testbenches_doc_resources/5g-aw2s-bench.pdf differ diff --git a/doc/testbenches_doc_resources/5g-aw2s-bench.png b/doc/testbenches_doc_resources/5g-aw2s-bench.png new file mode 100644 index 0000000000..49082c04fc Binary files /dev/null and b/doc/testbenches_doc_resources/5g-aw2s-bench.png differ diff --git a/doc/testbenches_doc_resources/5g-aw2s-bench.tex b/doc/testbenches_doc_resources/5g-aw2s-bench.tex new file mode 100644 index 0000000000..243d15babf --- /dev/null +++ b/doc/testbenches_doc_resources/5g-aw2s-bench.tex @@ -0,0 +1,32 @@ +\documentclass{standalone} + +\usepackage{tikz} +\usetikzlibrary{backgrounds, positioning, shapes.symbols} +\usepackage{helvet} +\renewcommand*{\rmdefault}{\sfdefault} + +\begin{document} +\begin{tikzpicture} + [ + font=\footnotesize, + faraday/.style={minimum size=3cm, draw, dashed}, + duplexer/.style={draw,fill=white}, + ] + + \node[label=above:avra] (avra) + {\includegraphics[width=1.2cm]{server}}; + \node[right=0.5cm of avra, label=above:AW2S] (aw2s) + {\includegraphics[width=1.2cm]{aw2s}} edge (avra); + \node[right=.2cm of aw2s, duplexer] (b78o) {n78} edge (aw2s); + \node[above right=-0.7cm and 0.35cm of b78o.east] (anto1) + {\includegraphics[width=0.3cm]{antenna}} edge (b78o); + \node[below right=-0.7cm and 0.35cm of b78o.east] (anto2) + {\includegraphics[width=0.3cm]{antenna}} edge (b78o); + + \node[right=4cm of aw2s, label=above:Amarisoft UE] (amariue) + {\includegraphics[width=0.7cm]{amariue}}; + \node[right=3cm of aw2s] (anto3) + {\includegraphics[width=0.3cm]{antenna}} edge (amariue); + +\end{tikzpicture} +\end{document} diff --git a/doc/testbenches_doc_resources/amariue.png b/doc/testbenches_doc_resources/amariue.png new file mode 100644 index 0000000000..72acb124c3 Binary files /dev/null and b/doc/testbenches_doc_resources/amariue.png differ diff --git a/doc/testbenches_doc_resources/aw2s.png b/doc/testbenches_doc_resources/aw2s.png new file mode 100644 index 0000000000..cc92e4c867 Binary files /dev/null and b/doc/testbenches_doc_resources/aw2s.png differ diff --git a/docker/Dockerfile.clang.rhel8.2 b/docker/Dockerfile.clang.rhel8.2 new file mode 100644 index 0000000000..11ead620ee --- /dev/null +++ b/docker/Dockerfile.clang.rhel8.2 @@ -0,0 +1,43 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# +# Dockerfile for the Open-Air-Interface BUILD service +# Valid for RHEL8 +# +#--------------------------------------------------------------------- + +FROM ran-base:latest AS oai-clang + +RUN rm -Rf /oai-ran +WORKDIR /oai-ran +COPY . . + +#only install LLVM (clang, ...) for this container, the others don't need it +RUN yum install -y llvm-toolset + +#run build_oai to build the target image +RUN /bin/sh oaienv && \ + cd cmake_targets && \ + mkdir -p log && \ + export CC=/usr/bin/clang && \ + export CXX=/usr/bin/clang++ && \ + ./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --verbose-ci --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror diff --git a/docker/Dockerfile.gNB.aw2s.rhel8.2 b/docker/Dockerfile.gNB.aw2s.rhel8.2 index e79bd6c09b..ec4a4b5c91 100644 --- a/docker/Dockerfile.gNB.aw2s.rhel8.2 +++ b/docker/Dockerfile.gNB.aw2s.rhel8.2 @@ -84,6 +84,7 @@ COPY --from=gnb-base \ /lib64/ RUN ln -s /usr/local/lib/libaw2sori_transpro.so /usr/local/lib/libthirdparty_transpro.so && \ + ln -s /usr/local/lib/liboai_eth_transpro.so /usr/local/lib/liboai_transpro.so && \ ldconfig WORKDIR /opt/oai-gnb-aw2s diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2 index ad0944f02b..df1e5af51c 100644 --- a/docker/Dockerfile.phySim.rhel8.2 +++ b/docker/Dockerfile.phySim.rhel8.2 @@ -31,16 +31,14 @@ RUN rm -Rf /oai-ran WORKDIR /oai-ran COPY . . -#only install address sanitizer and LLVM (clang, ...) for this container, the others don't need it -RUN yum install -y libasan llvm-toolset +#only install address and undefined behavior sanitizer for this container, the others don't need it +RUN yum install -y libasan libubsan #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - export CC=/usr/bin/clang && \ - export CXX=/usr/bin/clang++ && \ - ./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --verbose-ci --sanitize-address --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror + ./build_oai --phy_simulators --ninja --verbose-ci --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror #start from scratch for target executable FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim @@ -89,6 +87,7 @@ COPY --from=phy-sim-build \ /lib64/libexslt.so.0 \ /lib64/libxslt.so.1 \ /usr/lib64/libasan.so.5 \ + /usr/lib64/libubsan.so.1 \ /oai-ran/cmake_targets/ran_build/build/libdfts.so \ /oai-ran/cmake_targets/ran_build/build/libldpc.so \ /oai-ran/cmake_targets/ran_build/build/libldpc_orig.so \ diff --git a/executables/nr-ue.c b/executables/nr-ue.c index b4510b1f53..5860d7c64d 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -154,7 +154,6 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, int nb_connected_gNB = 1; ue->Mod_id = UE_id; - ue->mac_enabled = 1; ue->if_inst = nr_ue_if_module_init(0); ue->dci_thres = 0; ue->target_Nid_cell = -1; @@ -259,8 +258,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) reset_queue(&nr_ul_dci_req_queue); reset_queue(&nr_ul_tti_req_queue); - NR_UL_TIME_ALIGNMENT_t ul_time_alignment; - memset(&ul_time_alignment, 0, sizeof(ul_time_alignment)); int last_sfn_slot = -1; uint16_t sfn_slot = 0; @@ -305,7 +302,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) if (get_softmodem_params()->sa && mac->mib == NULL) { LOG_D(NR_MAC, "We haven't gotten MIB. Lets see if we received it\n"); - nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); + nr_ue_dl_indication(&mac->dl_info); process_queued_nr_nfapi_msgs(mac, sfn_slot); } if (mac->scc == NULL && mac->scc_SIB == NULL) { @@ -347,7 +344,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) mac->dl_info.slot = slot; mac->dl_info.dci_ind = NULL; mac->dl_info.rx_ind = NULL; - nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); + nr_ue_dl_indication(&mac->dl_info); } if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort(); @@ -628,7 +625,7 @@ nr_phy_data_t UE_dl_preprocessing(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) { nr_downlink_indication_t dl_indication; nr_fill_dl_indication(&dl_indication, NULL, NULL, proc, UE, &phy_data); - UE->if_inst->dl_indication(&dl_indication, NULL); + UE->if_inst->dl_indication(&dl_indication); } uint64_t a=rdtsc_oai(); diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h index 6d40752a9a..276f417fbb 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h @@ -50,7 +50,8 @@ #define FAPI_NR_DL_CONFIG_TYPE_P_DLSCH 0x05 #define FAPI_NR_DL_CONFIG_TYPE_CSI_RS 0x06 #define FAPI_NR_DL_CONFIG_TYPE_CSI_IM 0x07 -#define FAPI_NR_DL_CONFIG_TYPES 0x07 +#define FAPI_NR_CONFIG_TA_COMMAND 0x08 +#define FAPI_NR_DL_CONFIG_TYPES 0x08 #define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01 #define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02 diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 87fe5b82bc..95ae91b4d4 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -526,6 +526,11 @@ typedef struct { fapi_nr_dl_config_csiim_pdu_rel15_t csiim_config_rel15; } fapi_nr_dl_config_csiim_pdu; +typedef struct { + int ta_frame; + int ta_slot; + int ta_command; +} fapi_nr_ta_command_pdu; typedef struct { uint8_t pdu_type; @@ -534,6 +539,7 @@ typedef struct { fapi_nr_dl_config_dlsch_pdu dlsch_config_pdu; fapi_nr_dl_config_csirs_pdu csirs_config_pdu; fapi_nr_dl_config_csiim_pdu csiim_config_pdu; + fapi_nr_ta_command_pdu ta_command_pdu; }; } fapi_nr_dl_config_request_pdu_t; diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index 72762ba441..7c1534ca51 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) time_t currentTime; char fileName[512], currentTimeInfo[25]; char folderName[] = "."; - FILE *logFile; + FILE *logFile = NULL; /*folderName=getenv("HOME"); strcat(folderName,"/Desktop/polartestResults");*/ diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c index 604c316093..6b1fcebd80 100644 --- a/openair1/PHY/CODING/crc_byte.c +++ b/openair1/PHY/CODING/crc_byte.c @@ -44,16 +44,16 @@ /*ref 36-212 v8.6.0 , pp 8-9 */ /* the highest degree is set by default */ -unsigned int poly24a = 0x864cfb00; // 1000 0110 0100 1100 1111 1011 - // D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 -unsigned int poly24b = 0x80006300; // 1000 0000 0000 0000 0110 0011 - // D^24 + D^23 + D^6 + D^5 + D + 1 -unsigned int poly24c = 0xb2b11700; // 1011 0010 1011 0001 0001 0111 - // D^24+D^23+D^21+D^20+D^17+D^15+D^13+D^12+D^8+D^4+D^2+D+1 +uint32_t poly24a = 0x864cfb00; // 1000 0110 0100 1100 1111 1011 + // D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1 +uint32_t poly24b = 0x80006300; // 1000 0000 0000 0000 0110 0011 + // D^24 + D^23 + D^6 + D^5 + D + 1 +uint32_t poly24c = 0xb2b11700; // 1011 0010 1011 0001 0001 0111 + // D^24+D^23+D^21+D^20+D^17+D^15+D^13+D^12+D^8+D^4+D^2+D+1 -unsigned int poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1 -unsigned int poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1 -unsigned int poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1 +uint32_t poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1 +uint32_t poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1 +uint32_t poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1 uint32_t poly6 = 0x84000000; // 10000100000... -> D^6+D^5+1 uint32_t poly11 = 0xc4200000; //11000100001000... -> D^11+D^10+D^9+D^5+1 @@ -65,14 +65,12 @@ For initialization && verification purposes, The first bit is in the MSB of each byte *********************************************************/ -unsigned int crcbit (unsigned char * inputptr, - int octetlen, - unsigned int poly) +uint32_t crcbit(unsigned char* inputptr, int octetlen, uint32_t poly) { - unsigned int i, crc = 0, c; + uint32_t i, crc = 0, c; while (octetlen-- > 0) { - c = ((unsigned int)(*inputptr++)) << 24; + c = ((uint32_t)(*inputptr++)) << 24; for (i = 8; i != 0; i--) { if ((1U << 31) & (c ^ crc)) @@ -92,14 +90,14 @@ unsigned int crcbit (unsigned char * inputptr, crc table initialization *********************************************************/ -static unsigned int crc24aTable[256]; -static unsigned int crc24bTable[256]; -static unsigned int crc24cTable[256]; -static unsigned short crc16Table[256]; -static unsigned short crc12Table[256]; -static unsigned short crc11Table[256]; -static unsigned char crc8Table[256]; -static unsigned char crc6Table[256]; +static uint32_t crc24aTable[256]; +static uint32_t crc24bTable[256]; +static uint32_t crc24cTable[256]; +static uint32_t crc16Table[256]; +static uint32_t crc12Table[256]; +static uint32_t crc11Table[256]; +static uint32_t crc8Table[256]; +static uint32_t crc6Table[256]; #if USE_INTEL_CRC static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24a_pclmulqdq, 16) = { @@ -131,11 +129,11 @@ void crcTableInit (void) crc24aTable[c] = crcbit (&c, 1, poly24a); crc24bTable[c] = crcbit (&c, 1, poly24b); crc24cTable[c] = crcbit (&c, 1, poly24c); - crc16Table[c] = (unsigned short) (crcbit (&c, 1, poly16) >> 16); - crc12Table[c] = (unsigned short) (crcbit (&c, 1, poly12) >> 16); - crc11Table[c] = (unsigned short) (crcbit (&c, 1, poly11) >> 16); - crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24); - crc6Table[c] = (unsigned char) (crcbit (&c, 1, poly6) >> 24); + crc16Table[c] = crcbit(&c, 1, poly16) >> 16; + crc12Table[c] = crcbit(&c, 1, poly12) >> 16; + crc11Table[c] = crcbit(&c, 1, poly11) >> 16; + crc8Table[c] = crcbit(&c, 1, poly8) >> 24; + crc6Table[c] = crcbit(&c, 1, poly6) >> 24; } while (++c); #if USE_INTEL_CRC crc_xmm_be_le_swap128 = _mm_setr_epi32(0x0c0d0e0f, 0x08090a0b, @@ -151,19 +149,18 @@ assuming initial byte is 0 padded (in MSB) if necessary can use SIMD optimized Intel CRC for LTE/NR 24a/24b variants *********************************************************/ -unsigned int crc24a (unsigned char * inptr, - int bitlen) +uint32_t crc24a(unsigned char* inptr, int bitlen) { int octetlen = bitlen / 8; /* Change in octets */ if ( bitlen % 8 || !USE_INTEL_CRC ) { - unsigned int crc = 0; - int resbit= (bitlen % 8); + uint32_t crc = 0; + int resbit = (bitlen % 8); - while (octetlen-- > 0) { - // printf("crc24a: in %x => crc %x\n",crc,*inptr); - crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)]; - } + while (octetlen-- > 0) { + // printf("crc24a: in %x => crc %x\n",crc,*inptr); + crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)]; + } if (resbit > 0) crc = (crc << resbit) ^ crc24aTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; @@ -188,19 +185,18 @@ static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24b_pclmulqdq, 16) = { 0ULL /**< res */ }; #endif -unsigned int crc24b (unsigned char * inptr, - int bitlen) +uint32_t crc24b(unsigned char* inptr, int bitlen) { int octetlen = bitlen / 8; /* Change in octets */ if ( bitlen % 8 || !USE_INTEL_CRC ) { - unsigned int crc = 0; - int resbit = (bitlen % 8); + uint32_t crc = 0; + int resbit = (bitlen % 8); - while (octetlen-- > 0) { - // printf("crc24b: in %x => crc %x (%x)\n",crc,*inptr,crc24bTable[(*inptr) ^ (crc >> 24)]); - crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)]; - } + while (octetlen-- > 0) { + // printf("crc24b: in %x => crc %x (%x)\n",crc,*inptr,crc24bTable[(*inptr) ^ (crc >> 24)]); + crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)]; + } if (resbit > 0) crc = (crc << resbit) ^ crc24bTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; @@ -215,11 +211,10 @@ unsigned int crc24b (unsigned char * inptr, #endif } -unsigned int crc24c (unsigned char * inptr, - int bitlen) +uint32_t crc24c(unsigned char* inptr, int bitlen) { int octetlen, resbit; - unsigned int crc = 0; + uint32_t crc = 0; octetlen = bitlen / 8; /* Change in octets */ resbit = (bitlen % 8); @@ -234,11 +229,10 @@ unsigned int crc24c (unsigned char * inptr, return crc; } -unsigned int -crc16 (unsigned char * inptr, int bitlen) +uint32_t crc16(unsigned char* inptr, int bitlen) { int octetlen, resbit; - unsigned int crc = 0; + uint32_t crc = 0; octetlen = bitlen / 8; /* Change in octets */ resbit = (bitlen % 8); @@ -253,11 +247,10 @@ crc16 (unsigned char * inptr, int bitlen) return crc; } -unsigned int -crc12 (unsigned char * inptr, int bitlen) +uint32_t crc12(unsigned char* inptr, int bitlen) { int octetlen, resbit; - unsigned int crc = 0; + uint32_t crc = 0; octetlen = bitlen / 8; /* Change in octets */ resbit = (bitlen % 8); @@ -271,11 +264,10 @@ crc12 (unsigned char * inptr, int bitlen) return crc; } -unsigned int -crc11 (unsigned char * inptr, int bitlen) +uint32_t crc11(unsigned char* inptr, int bitlen) { int octetlen, resbit; - unsigned int crc = 0; + uint32_t crc = 0; octetlen = bitlen / 8; /* Change in octets */ resbit = (bitlen % 8); @@ -289,29 +281,27 @@ crc11 (unsigned char * inptr, int bitlen) return crc; } -unsigned int -crc8 (unsigned char * inptr, int bitlen) +uint32_t crc8(unsigned char* inptr, int bitlen) { int octetlen, resbit; - unsigned int crc = 0; + uint32_t crc = 0; octetlen = bitlen / 8; /* Change in octets */ resbit = (bitlen % 8); while (octetlen-- > 0) { - crc = ((unsigned int)crc8Table[(*inptr++) ^ (crc >> 24)]) << 24; + crc = ((uint32_t)crc8Table[(*inptr++) ^ (crc >> 24)]) << 24; } if (resbit > 0) - crc = (crc << resbit) ^ ((unsigned int)(crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]) << 24); + crc = (crc << resbit) ^ ((uint32_t)(crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]) << 24); return crc; } -unsigned int -crc6 (unsigned char * inptr, int bitlen) +uint32_t crc6(unsigned char* inptr, int bitlen) { int octetlen, resbit; - unsigned int crc = 0; + uint32_t crc = 0; octetlen = bitlen / 8; /* Change in octets */ resbit = (bitlen % 8); diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init.h index ea031dc2da..a000b0218d 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init.h +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init.h @@ -30,10 +30,25 @@ #ifndef __NR_LDPC_INIT__H__ #define __NR_LDPC_INIT__H__ - +#include #include "nrLDPC_lut.h" #include "nrLDPCdecoder_defs.h" +#define expandArr8(namE) \ + (const arr8_t) \ + { \ + (uint8_t*)namE, sizeof(namE) / sizeof(*namE), sizeof(*namE) / sizeof(**namE) \ + } +#define expandArr16(namE) \ + (const arr16_t) \ + { \ + (uint16_t*)namE, sizeof(namE) / sizeof(*namE), sizeof(*namE) / sizeof(**namE) \ + } +#define expandArr32(namE) \ + (const arr32_t) \ + { \ + (uint32_t*)namE, sizeof(namE) / sizeof(*namE), sizeof(*namE) / sizeof(**namE) \ + } /** \brief Initializes the decoder and sets correct LUTs \param p_decParams Pointer to decoder parameters @@ -46,118 +61,90 @@ static inline uint32_t nrLDPC_init(t_nrLDPC_dec_params* p_decParams, t_nrLDPC_lu uint8_t BG = p_decParams->BG; uint16_t Z = p_decParams->Z; uint8_t R = p_decParams->R; - + memset(p_lut, 0, sizeof(*p_lut)); if (BG == 2) { // LUT that only depend on BG p_lut->startAddrCnGroups = lut_startAddrCnGroups_BG2; - - p_lut->posBnInCnProcBuf[0] = (const uint8_t**) posBnInCnProcBuf_BG2_CNG3; - p_lut->posBnInCnProcBuf[1] = (const uint8_t**) posBnInCnProcBuf_BG2_CNG4; - p_lut->posBnInCnProcBuf[2] = (const uint8_t**) posBnInCnProcBuf_BG2_CNG5; - p_lut->posBnInCnProcBuf[3] = (const uint8_t**) posBnInCnProcBuf_BG2_CNG6; - p_lut->posBnInCnProcBuf[4] = (const uint8_t**) posBnInCnProcBuf_BG2_CNG8; - p_lut->posBnInCnProcBuf[5] = (const uint8_t**) posBnInCnProcBuf_BG2_CNG10; - p_lut->posBnInCnProcBuf[6] = NULL; - p_lut->posBnInCnProcBuf[7] = NULL; - p_lut->posBnInCnProcBuf[8] = NULL; + p_lut->posBnInCnProcBuf[0] = expandArr8(posBnInCnProcBuf_BG2_CNG3); + p_lut->posBnInCnProcBuf[1] = expandArr8(posBnInCnProcBuf_BG2_CNG4); + p_lut->posBnInCnProcBuf[2] = expandArr8(posBnInCnProcBuf_BG2_CNG5); + p_lut->posBnInCnProcBuf[3] = expandArr8(posBnInCnProcBuf_BG2_CNG6); + p_lut->posBnInCnProcBuf[4] = expandArr8(posBnInCnProcBuf_BG2_CNG8); + p_lut->posBnInCnProcBuf[5] = expandArr8(posBnInCnProcBuf_BG2_CNG10); // LUT that only depend on R if (R == 15) { - p_lut->startAddrBnProcBuf[0] = (const uint32_t**) startAddrBnProcBuf_BG2_R15_CNG3; - p_lut->startAddrBnProcBuf[1] = (const uint32_t**) startAddrBnProcBuf_BG2_R15_CNG4; - p_lut->startAddrBnProcBuf[2] = (const uint32_t**) startAddrBnProcBuf_BG2_R15_CNG5; - p_lut->startAddrBnProcBuf[3] = (const uint32_t**) startAddrBnProcBuf_BG2_R15_CNG6; - p_lut->startAddrBnProcBuf[4] = (const uint32_t**) startAddrBnProcBuf_BG2_R15_CNG8; - p_lut->startAddrBnProcBuf[5] = (const uint32_t**) startAddrBnProcBuf_BG2_R15_CNG10; - p_lut->startAddrBnProcBuf[6] = NULL; - p_lut->startAddrBnProcBuf[7] = NULL; - p_lut->startAddrBnProcBuf[8] = NULL; + p_lut->startAddrBnProcBuf[0] = expandArr32(startAddrBnProcBuf_BG2_R15_CNG3); + p_lut->startAddrBnProcBuf[1] = expandArr32(startAddrBnProcBuf_BG2_R15_CNG4); + p_lut->startAddrBnProcBuf[2] = expandArr32(startAddrBnProcBuf_BG2_R15_CNG5); + p_lut->startAddrBnProcBuf[3] = expandArr32(startAddrBnProcBuf_BG2_R15_CNG6); + p_lut->startAddrBnProcBuf[4] = expandArr32(startAddrBnProcBuf_BG2_R15_CNG8); + p_lut->startAddrBnProcBuf[5] = expandArr32(startAddrBnProcBuf_BG2_R15_CNG10); - p_lut->bnPosBnProcBuf[0] = (const uint8_t**) bnPosBnProcBuf_BG2_R15_CNG3; - p_lut->bnPosBnProcBuf[1] = (const uint8_t**) bnPosBnProcBuf_BG2_R15_CNG4; - p_lut->bnPosBnProcBuf[2] = (const uint8_t**) bnPosBnProcBuf_BG2_R15_CNG5; - p_lut->bnPosBnProcBuf[3] = (const uint8_t**) bnPosBnProcBuf_BG2_R15_CNG6; - p_lut->bnPosBnProcBuf[4] = (const uint8_t**) bnPosBnProcBuf_BG2_R15_CNG8; - p_lut->bnPosBnProcBuf[5] = (const uint8_t**) bnPosBnProcBuf_BG2_R15_CNG10; - p_lut->bnPosBnProcBuf[6] = NULL; - p_lut->bnPosBnProcBuf[7] = NULL; - p_lut->bnPosBnProcBuf[8] = NULL; + p_lut->bnPosBnProcBuf[0] = expandArr8(bnPosBnProcBuf_BG2_R15_CNG3); + p_lut->bnPosBnProcBuf[1] = expandArr8(bnPosBnProcBuf_BG2_R15_CNG4); + p_lut->bnPosBnProcBuf[2] = expandArr8(bnPosBnProcBuf_BG2_R15_CNG5); + p_lut->bnPosBnProcBuf[3] = expandArr8(bnPosBnProcBuf_BG2_R15_CNG6); + p_lut->bnPosBnProcBuf[4] = expandArr8(bnPosBnProcBuf_BG2_R15_CNG8); + p_lut->bnPosBnProcBuf[5] = expandArr8(bnPosBnProcBuf_BG2_R15_CNG10); - p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG2_R15; - p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG2_R15; + p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG2_R15; + p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG2_R15; - p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG2_R15; - p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG2_R15; - p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG2_R15; - p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R15; + p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG2_R15; + p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG2_R15; + p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG2_R15; + p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R15; - numLLR = NR_LDPC_NCOL_BG2_R15*Z; + numLLR = NR_LDPC_NCOL_BG2_R15 * Z; } else if (R == 13) { - p_lut->startAddrBnProcBuf[0] = NULL; - p_lut->startAddrBnProcBuf[1] = (const uint32_t**) startAddrBnProcBuf_BG2_R13_CNG4; - p_lut->startAddrBnProcBuf[2] = (const uint32_t**) startAddrBnProcBuf_BG2_R13_CNG5; - p_lut->startAddrBnProcBuf[3] = (const uint32_t**) startAddrBnProcBuf_BG2_R13_CNG6; - p_lut->startAddrBnProcBuf[4] = (const uint32_t**) startAddrBnProcBuf_BG2_R13_CNG8; - p_lut->startAddrBnProcBuf[5] = (const uint32_t**) startAddrBnProcBuf_BG2_R13_CNG10; - p_lut->startAddrBnProcBuf[6] = NULL; - p_lut->startAddrBnProcBuf[7] = NULL; - p_lut->startAddrBnProcBuf[8] = NULL; + p_lut->startAddrBnProcBuf[1] = expandArr32(startAddrBnProcBuf_BG2_R13_CNG4); + p_lut->startAddrBnProcBuf[2] = expandArr32(startAddrBnProcBuf_BG2_R13_CNG5); + p_lut->startAddrBnProcBuf[3] = expandArr32(startAddrBnProcBuf_BG2_R13_CNG6); + p_lut->startAddrBnProcBuf[4] = expandArr32(startAddrBnProcBuf_BG2_R13_CNG8); + p_lut->startAddrBnProcBuf[5] = expandArr32(startAddrBnProcBuf_BG2_R13_CNG10); - p_lut->bnPosBnProcBuf[0] = NULL; - p_lut->bnPosBnProcBuf[1] = (const uint8_t**) bnPosBnProcBuf_BG2_R13_CNG4; - p_lut->bnPosBnProcBuf[2] = (const uint8_t**) bnPosBnProcBuf_BG2_R13_CNG5; - p_lut->bnPosBnProcBuf[3] = (const uint8_t**) bnPosBnProcBuf_BG2_R13_CNG6; - p_lut->bnPosBnProcBuf[4] = (const uint8_t**) bnPosBnProcBuf_BG2_R13_CNG8; - p_lut->bnPosBnProcBuf[5] = (const uint8_t**) bnPosBnProcBuf_BG2_R13_CNG10; - p_lut->bnPosBnProcBuf[6] = NULL; - p_lut->bnPosBnProcBuf[7] = NULL; - p_lut->bnPosBnProcBuf[8] = NULL; + p_lut->bnPosBnProcBuf[1] = expandArr8(bnPosBnProcBuf_BG2_R13_CNG4); + p_lut->bnPosBnProcBuf[2] = expandArr8(bnPosBnProcBuf_BG2_R13_CNG5); + p_lut->bnPosBnProcBuf[3] = expandArr8(bnPosBnProcBuf_BG2_R13_CNG6); + p_lut->bnPosBnProcBuf[4] = expandArr8(bnPosBnProcBuf_BG2_R13_CNG8); + p_lut->bnPosBnProcBuf[5] = expandArr8(bnPosBnProcBuf_BG2_R13_CNG10); - p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG2_R13; - p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG2_R13; + p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG2_R13; + p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG2_R13; - p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG2_R13; - p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG2_R13; - p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG2_R13; - p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R13; + p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG2_R13; + p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG2_R13; + p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG2_R13; + p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R13; - numLLR = NR_LDPC_NCOL_BG2_R13*Z; + numLLR = NR_LDPC_NCOL_BG2_R13 * Z; } else if (R == 23) { - p_lut->startAddrBnProcBuf[0] = NULL; - p_lut->startAddrBnProcBuf[1] = (const uint32_t**) startAddrBnProcBuf_BG2_R23_CNG4; - p_lut->startAddrBnProcBuf[2] = NULL; - p_lut->startAddrBnProcBuf[3] = (const uint32_t**) startAddrBnProcBuf_BG2_R23_CNG6; - p_lut->startAddrBnProcBuf[4] = (const uint32_t**) startAddrBnProcBuf_BG2_R23_CNG8; - p_lut->startAddrBnProcBuf[5] = (const uint32_t**) startAddrBnProcBuf_BG2_R23_CNG10; - p_lut->startAddrBnProcBuf[6] = NULL; - p_lut->startAddrBnProcBuf[7] = NULL; - p_lut->startAddrBnProcBuf[8] = NULL; + p_lut->startAddrBnProcBuf[1] = expandArr32(startAddrBnProcBuf_BG2_R23_CNG4); + p_lut->startAddrBnProcBuf[3] = expandArr32(startAddrBnProcBuf_BG2_R23_CNG6); + p_lut->startAddrBnProcBuf[4] = expandArr32(startAddrBnProcBuf_BG2_R23_CNG8); + p_lut->startAddrBnProcBuf[5] = expandArr32(startAddrBnProcBuf_BG2_R23_CNG10); - p_lut->bnPosBnProcBuf[0] = NULL; - p_lut->bnPosBnProcBuf[1] = (const uint8_t**) bnPosBnProcBuf_BG2_R23_CNG4; - p_lut->bnPosBnProcBuf[2] = NULL; - p_lut->bnPosBnProcBuf[3] = (const uint8_t**) bnPosBnProcBuf_BG2_R23_CNG6; - p_lut->bnPosBnProcBuf[4] = (const uint8_t**) bnPosBnProcBuf_BG2_R23_CNG8; - p_lut->bnPosBnProcBuf[5] = (const uint8_t**) bnPosBnProcBuf_BG2_R23_CNG10; - p_lut->bnPosBnProcBuf[6] = NULL; - p_lut->bnPosBnProcBuf[7] = NULL; - p_lut->bnPosBnProcBuf[8] = NULL; + p_lut->bnPosBnProcBuf[1] = expandArr8(bnPosBnProcBuf_BG2_R23_CNG4); + p_lut->bnPosBnProcBuf[3] = expandArr8(bnPosBnProcBuf_BG2_R23_CNG6); + p_lut->bnPosBnProcBuf[4] = expandArr8(bnPosBnProcBuf_BG2_R23_CNG8); + p_lut->bnPosBnProcBuf[5] = expandArr8(bnPosBnProcBuf_BG2_R23_CNG10); - p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG2_R23; - p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG2_R23; + p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG2_R23; + p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG2_R23; - p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG2_R23; - p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG2_R23; - p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG2_R23; - p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R23; + p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG2_R23; + p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG2_R23; + p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG2_R23; + p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG2_R23; - numLLR = NR_LDPC_NCOL_BG2_R23*Z; + numLLR = NR_LDPC_NCOL_BG2_R23 * Z; } // LUT that depend on Z and R @@ -165,678 +152,515 @@ static inline uint32_t nrLDPC_init(t_nrLDPC_dec_params* p_decParams, t_nrLDPC_lu { case 2: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z2_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z2_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z2_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z2_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z2_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z2_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z2_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z2_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z2_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z2_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z2_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z2_CNG10); + break; } case 3: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z3_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z3_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z3_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z3_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z3_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z3_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z3_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z3_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z3_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z3_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z3_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z3_CNG10); + break; } case 4: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z4_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z4_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z4_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z4_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z4_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z4_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z4_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z4_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z4_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z4_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z4_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z4_CNG10); + break; } case 5: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z5_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z5_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z5_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z5_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z5_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z5_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z5_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z5_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z5_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z5_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z5_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z5_CNG10); + break; } case 6: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z6_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z6_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z6_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z6_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z6_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z6_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z6_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z6_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z6_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z6_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z6_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z6_CNG10); + break; } case 7: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z7_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z7_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z7_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z7_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z7_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z7_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z7_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z7_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z7_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z7_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z7_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z7_CNG10); + break; } case 8: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z8_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z8_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z8_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z8_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z8_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z8_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z8_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z8_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z8_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z8_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z8_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z8_CNG10); + break; } case 9: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z9_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z9_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z9_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z9_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z9_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z9_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z9_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z9_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z9_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z9_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z9_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z9_CNG10); + break; } case 10: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z10_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z10_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z10_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z10_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z10_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z10_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z10_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z10_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z10_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z10_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z10_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z10_CNG10); + break; } case 11: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z11_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z11_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z11_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z11_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z11_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z11_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z11_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z11_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z11_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z11_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z11_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z11_CNG10); + break; } case 12: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z12_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z12_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z12_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z12_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z12_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z12_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z12_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z12_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z12_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z12_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z12_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z12_CNG10); + break; } case 13: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z13_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z13_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z13_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z13_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z13_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z13_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z13_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z13_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z13_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z13_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z13_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z13_CNG10); + break; } case 14: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z14_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z14_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z14_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z14_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z14_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z14_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z14_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z14_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z14_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z14_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z14_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z14_CNG10); + break; } case 15: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z15_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z15_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z15_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z15_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z15_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z15_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z15_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z15_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z15_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z15_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z15_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z15_CNG10); + break; } case 16: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z16_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z16_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z16_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z16_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z16_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z16_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z16_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z16_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z16_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z16_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z16_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z16_CNG10); + break; } case 18: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z18_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z18_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z18_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z18_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z18_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z18_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z18_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z18_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z18_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z18_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z18_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z18_CNG10); + break; } case 20: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z20_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z20_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z20_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z20_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z20_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z20_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z20_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z20_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z20_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z20_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z20_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z20_CNG10); + break; } case 22: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z22_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z22_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z22_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z22_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z22_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z22_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z22_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z22_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z22_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z22_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z22_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z22_CNG10); + break; } case 24: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z24_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z24_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z24_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z24_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z24_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z24_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z24_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z24_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z24_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z24_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z24_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z24_CNG10); + break; } case 26: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z26_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z26_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z26_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z26_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z26_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z26_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z26_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z26_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z26_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z26_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z26_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z26_CNG10); + break; } case 28: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z28_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z28_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z28_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z28_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z28_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z28_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z28_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z28_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z28_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z28_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z28_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z28_CNG10); + break; } case 30: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z30_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z30_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z30_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z30_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z30_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z30_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z30_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z30_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z30_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z30_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z30_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z30_CNG10); + break; } case 32: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z32_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z32_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z32_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z32_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z32_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z32_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z32_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z32_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z32_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z32_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z32_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z32_CNG10); + break; } case 36: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z36_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z36_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z36_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z36_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z36_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z36_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z36_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z36_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z36_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z36_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z36_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z36_CNG10); + break; } case 40: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z40_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z40_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z40_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z40_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z40_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z40_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z40_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z40_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z40_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z40_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z40_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z40_CNG10); + break; } case 44: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z44_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z44_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z44_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z44_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z44_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z44_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z44_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z44_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z44_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z44_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z44_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z44_CNG10); + break; } case 48: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z48_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z48_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z48_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z48_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z48_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z48_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z48_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z48_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z48_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z48_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z48_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z48_CNG10); + break; } case 52: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z52_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z52_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z52_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z52_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z52_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z52_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z52_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z52_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z52_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z52_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z52_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z52_CNG10); + break; } case 56: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z56_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z56_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z56_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z56_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z56_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z56_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z56_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z56_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z56_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z56_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z56_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z56_CNG10); + break; } case 60: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z60_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z60_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z60_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z60_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z60_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z60_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z60_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z60_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z60_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z60_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z60_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z60_CNG10); + break; } case 64: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z64_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z64_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z64_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z64_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z64_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z64_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z64_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z64_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z64_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z64_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z64_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z64_CNG10); + break; } case 72: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z72_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z72_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z72_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z72_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z72_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z72_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z72_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z72_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z72_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z72_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z72_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z72_CNG10); + break; } case 80: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z80_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z80_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z80_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z80_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z80_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z80_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z80_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z80_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z80_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z80_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z80_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z80_CNG10); + break; } case 88: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z88_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z88_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z88_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z88_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z88_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z88_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z88_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z88_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z88_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z88_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z88_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z88_CNG10); + break; } case 96: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z96_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z96_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z96_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z96_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z96_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z96_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z96_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z96_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z96_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z96_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z96_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z96_CNG10); + break; } case 104: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z104_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z104_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z104_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z104_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z104_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z104_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z104_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z104_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z104_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z104_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z104_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z104_CNG10); + break; } case 112: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z112_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z112_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z112_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z112_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z112_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z112_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z112_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z112_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z112_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z112_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z112_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z112_CNG10); + break; } case 120: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z120_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z120_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z120_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z120_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z120_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z120_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z120_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z120_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z120_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z120_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z120_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z120_CNG10); + break; } case 128: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z128_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z128_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z128_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z128_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z128_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z128_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z128_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z128_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z128_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z128_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z128_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z128_CNG10); + break; } case 144: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z144_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z144_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z144_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z144_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z144_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z144_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z144_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z144_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z144_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z144_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z144_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z144_CNG10); + break; } case 160: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z160_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z160_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z160_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z160_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z160_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z160_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z160_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z160_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z160_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z160_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z160_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z160_CNG10); + break; } case 176: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z176_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z176_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z176_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z176_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z176_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z176_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z176_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z176_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z176_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z176_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z176_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z176_CNG10); + break; } case 192: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z192_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z192_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z192_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z192_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z192_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z192_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z192_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z192_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z192_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z192_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z192_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z192_CNG10); + break; } case 208: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z208_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z208_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z208_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z208_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z208_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z208_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z208_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z208_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z208_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z208_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z208_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z208_CNG10); + break; } case 224: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z224_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z224_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z224_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z224_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z224_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z224_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z224_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z224_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z224_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z224_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z224_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z224_CNG10); + break; } case 240: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z240_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z240_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z240_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z240_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z240_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z240_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z240_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z240_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z240_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z240_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z240_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z240_CNG10); + break; } case 256: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z256_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z256_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z256_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z256_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z256_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z256_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z256_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z256_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z256_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z256_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z256_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z256_CNG10); + break; } case 288: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z288_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z288_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z288_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z288_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z288_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z288_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z288_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z288_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z288_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z288_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z288_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z288_CNG10); + break; } case 320: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z320_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z320_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z320_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z320_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z320_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z320_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z320_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z320_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z320_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z320_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z320_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z320_CNG10); + break; } case 352: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z352_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z352_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z352_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z352_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z352_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z352_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z352_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z352_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z352_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z352_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z352_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z352_CNG10); + break; } case 384: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG2_Z384_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG2_Z384_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG2_Z384_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG2_Z384_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG2_Z384_CNG8; - p_lut->circShift[5] = (const uint16_t**) circShift_BG2_Z384_CNG10; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; - break; + p_lut->circShift[0] = expandArr16(circShift_BG2_Z384_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG2_Z384_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG2_Z384_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG2_Z384_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG2_Z384_CNG8); + p_lut->circShift[5] = expandArr16(circShift_BG2_Z384_CNG10); + break; } - default: - { - p_lut->circShift[0] = NULL; - p_lut->circShift[1] = NULL; - p_lut->circShift[2] = NULL; - p_lut->circShift[3] = NULL; - p_lut->circShift[4] = NULL; - p_lut->circShift[5] = NULL; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; + default: { } } } @@ -845,112 +669,89 @@ static inline uint32_t nrLDPC_init(t_nrLDPC_dec_params* p_decParams, t_nrLDPC_lu // LUT that only depend on BG p_lut->startAddrCnGroups = lut_startAddrCnGroups_BG1; - p_lut->posBnInCnProcBuf[0] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG3; - p_lut->posBnInCnProcBuf[1] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG4; - p_lut->posBnInCnProcBuf[2] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG5; - p_lut->posBnInCnProcBuf[3] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG6; - p_lut->posBnInCnProcBuf[4] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG7; - p_lut->posBnInCnProcBuf[5] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG8; - p_lut->posBnInCnProcBuf[6] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG9; - p_lut->posBnInCnProcBuf[7] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG10; - p_lut->posBnInCnProcBuf[8] = (const uint8_t**) posBnInCnProcBuf_BG1_CNG19; + p_lut->posBnInCnProcBuf[0] = expandArr8(posBnInCnProcBuf_BG1_CNG3); + p_lut->posBnInCnProcBuf[1] = expandArr8(posBnInCnProcBuf_BG1_CNG4); + p_lut->posBnInCnProcBuf[2] = expandArr8(posBnInCnProcBuf_BG1_CNG5); + p_lut->posBnInCnProcBuf[3] = expandArr8(posBnInCnProcBuf_BG1_CNG6); + p_lut->posBnInCnProcBuf[4] = expandArr8(posBnInCnProcBuf_BG1_CNG7); + p_lut->posBnInCnProcBuf[5] = expandArr8(posBnInCnProcBuf_BG1_CNG8); + p_lut->posBnInCnProcBuf[6] = expandArr8(posBnInCnProcBuf_BG1_CNG9); + p_lut->posBnInCnProcBuf[7] = expandArr8(posBnInCnProcBuf_BG1_CNG10); + p_lut->posBnInCnProcBuf[8] = expandArr8(posBnInCnProcBuf_BG1_CNG19); // LUT that only depend on R if (R == 13) { - p_lut->startAddrBnProcBuf[0] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG3; - p_lut->startAddrBnProcBuf[1] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG4; - p_lut->startAddrBnProcBuf[2] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG5; - p_lut->startAddrBnProcBuf[3] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG6; - p_lut->startAddrBnProcBuf[4] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG7; - p_lut->startAddrBnProcBuf[5] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG8; - p_lut->startAddrBnProcBuf[6] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG9; - p_lut->startAddrBnProcBuf[7] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG10; - p_lut->startAddrBnProcBuf[8] = (const uint32_t**) startAddrBnProcBuf_BG1_R13_CNG19; + p_lut->startAddrBnProcBuf[0] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG3); + p_lut->startAddrBnProcBuf[1] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG4); + p_lut->startAddrBnProcBuf[2] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG5); + p_lut->startAddrBnProcBuf[3] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG6); + p_lut->startAddrBnProcBuf[4] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG7); + p_lut->startAddrBnProcBuf[5] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG8); + p_lut->startAddrBnProcBuf[6] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG9); + p_lut->startAddrBnProcBuf[7] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG10); + p_lut->startAddrBnProcBuf[8] = expandArr32(startAddrBnProcBuf_BG1_R13_CNG19); - p_lut->bnPosBnProcBuf[0] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[1] = (const uint8_t**) bnPosBnProcBuf_BG1_R13_CNG4; - p_lut->bnPosBnProcBuf[2] = (const uint8_t**) bnPosBnProcBuf_BG1_R13_CNG5; - p_lut->bnPosBnProcBuf[3] = (const uint8_t**) bnPosBnProcBuf_BG1_R13_CNG6; - p_lut->bnPosBnProcBuf[4] = (const uint8_t**) bnPosBnProcBuf_BG1_R13_CNG7; - p_lut->bnPosBnProcBuf[5] = (const uint8_t**) bnPosBnProcBuf_BG1_R13_CNG8; - p_lut->bnPosBnProcBuf[6] = (const uint8_t**) bnPosBnProcBuf_BG1_R13_CNG9; - p_lut->bnPosBnProcBuf[7] = (const uint8_t**) bnPosBnProcBuf_BG1_R13_CNG10; - p_lut->bnPosBnProcBuf[8] = (const uint8_t**) bnPosBnProcBuf_BG1_R13_CNG19; + p_lut->bnPosBnProcBuf[1] = expandArr8(bnPosBnProcBuf_BG1_R13_CNG4); + p_lut->bnPosBnProcBuf[2] = expandArr8(bnPosBnProcBuf_BG1_R13_CNG5); + p_lut->bnPosBnProcBuf[3] = expandArr8(bnPosBnProcBuf_BG1_R13_CNG6); + p_lut->bnPosBnProcBuf[4] = expandArr8(bnPosBnProcBuf_BG1_R13_CNG7); + p_lut->bnPosBnProcBuf[5] = expandArr8(bnPosBnProcBuf_BG1_R13_CNG8); + p_lut->bnPosBnProcBuf[6] = expandArr8(bnPosBnProcBuf_BG1_R13_CNG9); + p_lut->bnPosBnProcBuf[7] = expandArr8(bnPosBnProcBuf_BG1_R13_CNG10); + p_lut->bnPosBnProcBuf[8] = expandArr8(bnPosBnProcBuf_BG1_R13_CNG19); - p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG1_R13; - p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG1_R13; + p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG1_R13; + p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG1_R13; - p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG1_R13; - p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG1_R13; - p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG1_R13; - p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R13; + p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG1_R13; + p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG1_R13; + p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG1_R13; + p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R13; - numLLR = NR_LDPC_NCOL_BG1_R13*Z; + numLLR = NR_LDPC_NCOL_BG1_R13 * Z; } else if (R == 23) { - p_lut->startAddrBnProcBuf[0] = (const uint32_t**) startAddrBnProcBuf_BG1_R23_CNG3; - p_lut->startAddrBnProcBuf[1] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[2] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[3] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[4] = (const uint32_t**) startAddrBnProcBuf_BG1_R23_CNG7; - p_lut->startAddrBnProcBuf[5] = (const uint32_t**) startAddrBnProcBuf_BG1_R23_CNG8; - p_lut->startAddrBnProcBuf[6] = (const uint32_t**) startAddrBnProcBuf_BG1_R23_CNG9; - p_lut->startAddrBnProcBuf[7] = (const uint32_t**) startAddrBnProcBuf_BG1_R23_CNG10; - p_lut->startAddrBnProcBuf[8] = (const uint32_t**) startAddrBnProcBuf_BG1_R23_CNG19; + p_lut->startAddrBnProcBuf[0] = expandArr32(startAddrBnProcBuf_BG1_R23_CNG3); + p_lut->startAddrBnProcBuf[4] = expandArr32(startAddrBnProcBuf_BG1_R23_CNG7); + p_lut->startAddrBnProcBuf[5] = expandArr32(startAddrBnProcBuf_BG1_R23_CNG8); + p_lut->startAddrBnProcBuf[6] = expandArr32(startAddrBnProcBuf_BG1_R23_CNG9); + p_lut->startAddrBnProcBuf[7] = expandArr32(startAddrBnProcBuf_BG1_R23_CNG10); + p_lut->startAddrBnProcBuf[8] = expandArr32(startAddrBnProcBuf_BG1_R23_CNG19); - p_lut->bnPosBnProcBuf[0] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[1] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[2] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[3] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[4] = (const uint8_t**) bnPosBnProcBuf_BG1_R23_CNG7; - p_lut->bnPosBnProcBuf[5] = (const uint8_t**) bnPosBnProcBuf_BG1_R23_CNG8; - p_lut->bnPosBnProcBuf[6] = (const uint8_t**) bnPosBnProcBuf_BG1_R23_CNG9; - p_lut->bnPosBnProcBuf[7] = (const uint8_t**) bnPosBnProcBuf_BG1_R23_CNG10; - p_lut->bnPosBnProcBuf[8] = (const uint8_t**) bnPosBnProcBuf_BG1_R23_CNG19; + p_lut->bnPosBnProcBuf[4] = expandArr8(bnPosBnProcBuf_BG1_R23_CNG7); + p_lut->bnPosBnProcBuf[5] = expandArr8(bnPosBnProcBuf_BG1_R23_CNG8); + p_lut->bnPosBnProcBuf[6] = expandArr8(bnPosBnProcBuf_BG1_R23_CNG9); + p_lut->bnPosBnProcBuf[7] = expandArr8(bnPosBnProcBuf_BG1_R23_CNG10); + p_lut->bnPosBnProcBuf[8] = expandArr8(bnPosBnProcBuf_BG1_R23_CNG19); - p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG1_R23; - p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG1_R23; + p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG1_R23; + p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG1_R23; - p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG1_R23; - p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG1_R23; - p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG1_R23; - p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R23; + p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG1_R23; + p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG1_R23; + p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG1_R23; + p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R23; - numLLR = NR_LDPC_NCOL_BG1_R23*Z; + numLLR = NR_LDPC_NCOL_BG1_R23 * Z; } else if (R == 89) { - p_lut->startAddrBnProcBuf[0] = (const uint32_t**) startAddrBnProcBuf_BG1_R89_CNG3; - p_lut->startAddrBnProcBuf[1] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[2] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[3] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[4] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[5] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[6] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[7] = (const uint32_t**) NULL; - p_lut->startAddrBnProcBuf[8] = (const uint32_t**) startAddrBnProcBuf_BG1_R89_CNG19; + p_lut->startAddrBnProcBuf[0] = expandArr32(startAddrBnProcBuf_BG1_R89_CNG3); + p_lut->startAddrBnProcBuf[8] = expandArr32(startAddrBnProcBuf_BG1_R89_CNG19); - p_lut->bnPosBnProcBuf[0] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[1] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[2] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[3] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[4] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[5] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[6] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[7] = (const uint8_t**) NULL; - p_lut->bnPosBnProcBuf[8] = (const uint8_t**) bnPosBnProcBuf_BG1_R89_CNG19; + p_lut->bnPosBnProcBuf[8] = expandArr8(bnPosBnProcBuf_BG1_R89_CNG19); - p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG1_R89; - p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG1_R89; + p_lut->llr2llrProcBufAddr = llr2llrProcBufAddr_BG1_R89; + p_lut->llr2llrProcBufBnPos = llr2llrProcBufBnPos_BG1_R89; - p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG1_R89; - p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG1_R89; - p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG1_R89; - p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R89; + p_lut->numCnInCnGroups = lut_numCnInCnGroups_BG1_R89; + p_lut->numBnInBnGroups = lut_numBnInBnGroups_BG1_R89; + p_lut->startAddrBnGroups = lut_startAddrBnGroups_BG1_R89; + p_lut->startAddrBnGroupsLlr = lut_startAddrBnGroupsLlr_BG1_R89; - numLLR = NR_LDPC_NCOL_BG1_R89*Z; + numLLR = NR_LDPC_NCOL_BG1_R89 * Z; } // LUT that depend on Z and R @@ -958,678 +759,668 @@ static inline uint32_t nrLDPC_init(t_nrLDPC_dec_params* p_decParams, t_nrLDPC_lu { case 2: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z2_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z2_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z2_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z2_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z2_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z2_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z2_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z2_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z2_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z2_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z2_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z2_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z2_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z2_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z2_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z2_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z2_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z2_CNG19); + break; } case 3: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z3_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z3_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z3_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z3_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z3_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z3_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z3_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z3_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z3_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z3_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z3_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z3_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z3_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z3_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z3_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z3_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z3_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z3_CNG19); + break; } case 4: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z4_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z4_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z4_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z4_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z4_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z4_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z4_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z4_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z4_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z4_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z4_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z4_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z4_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z4_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z4_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z4_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z4_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z4_CNG19); + break; } case 5: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z5_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z5_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z5_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z5_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z5_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z5_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z5_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z5_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z5_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z5_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z5_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z5_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z5_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z5_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z5_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z5_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z5_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z5_CNG19); + break; } case 6: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z6_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z6_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z6_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z6_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z6_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z6_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z6_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z6_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z6_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z6_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z6_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z6_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z6_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z6_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z6_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z6_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z6_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z6_CNG19); + break; } case 7: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z7_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z7_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z7_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z7_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z7_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z7_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z7_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z7_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z7_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z7_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z7_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z7_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z7_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z7_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z7_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z7_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z7_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z7_CNG19); + break; } case 8: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z8_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z8_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z8_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z8_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z8_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z8_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z8_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z8_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z8_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z8_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z8_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z8_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z8_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z8_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z8_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z8_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z8_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z8_CNG19); + break; } case 9: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z9_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z9_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z9_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z9_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z9_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z9_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z9_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z9_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z9_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z9_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z9_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z9_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z9_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z9_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z9_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z9_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z9_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z9_CNG19); + break; } case 10: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z10_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z10_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z10_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z10_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z10_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z10_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z10_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z10_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z10_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z10_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z10_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z10_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z10_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z10_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z10_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z10_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z10_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z10_CNG19); + break; } case 11: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z11_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z11_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z11_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z11_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z11_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z11_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z11_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z11_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z11_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z11_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z11_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z11_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z11_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z11_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z11_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z11_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z11_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z11_CNG19); + break; } case 12: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z12_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z12_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z12_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z12_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z12_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z12_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z12_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z12_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z12_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z12_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z12_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z12_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z12_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z12_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z12_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z12_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z12_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z12_CNG19); + break; } case 13: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z13_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z13_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z13_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z13_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z13_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z13_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z13_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z13_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z13_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z13_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z13_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z13_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z13_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z13_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z13_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z13_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z13_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z13_CNG19); + break; } case 14: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z14_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z14_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z14_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z14_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z14_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z14_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z14_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z14_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z14_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z14_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z14_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z14_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z14_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z14_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z14_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z14_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z14_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z14_CNG19); + break; } case 15: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z15_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z15_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z15_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z15_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z15_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z15_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z15_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z15_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z15_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z15_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z15_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z15_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z15_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z15_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z15_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z15_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z15_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z15_CNG19); + break; } case 16: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z16_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z16_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z16_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z16_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z16_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z16_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z16_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z16_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z16_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z16_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z16_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z16_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z16_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z16_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z16_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z16_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z16_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z16_CNG19); + break; } case 18: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z18_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z18_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z18_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z18_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z18_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z18_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z18_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z18_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z18_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z18_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z18_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z18_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z18_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z18_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z18_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z18_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z18_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z18_CNG19); + break; } case 20: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z20_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z20_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z20_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z20_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z20_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z20_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z20_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z20_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z20_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z20_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z20_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z20_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z20_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z20_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z20_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z20_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z20_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z20_CNG19); + break; } case 22: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z22_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z22_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z22_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z22_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z22_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z22_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z22_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z22_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z22_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z22_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z22_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z22_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z22_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z22_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z22_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z22_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z22_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z22_CNG19); + break; } case 24: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z24_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z24_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z24_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z24_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z24_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z24_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z24_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z24_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z24_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z24_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z24_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z24_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z24_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z24_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z24_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z24_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z24_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z24_CNG19); + break; } case 26: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z26_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z26_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z26_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z26_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z26_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z26_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z26_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z26_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z26_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z26_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z26_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z26_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z26_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z26_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z26_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z26_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z26_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z26_CNG19); + break; } case 28: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z28_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z28_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z28_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z28_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z28_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z28_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z28_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z28_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z28_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z28_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z28_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z28_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z28_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z28_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z28_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z28_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z28_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z28_CNG19); + break; } case 30: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z30_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z30_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z30_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z30_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z30_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z30_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z30_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z30_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z30_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z30_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z30_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z30_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z30_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z30_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z30_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z30_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z30_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z30_CNG19); + break; } case 32: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z32_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z32_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z32_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z32_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z32_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z32_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z32_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z32_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z32_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z32_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z32_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z32_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z32_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z32_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z32_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z32_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z32_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z32_CNG19); + break; } case 36: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z36_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z36_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z36_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z36_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z36_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z36_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z36_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z36_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z36_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z36_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z36_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z36_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z36_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z36_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z36_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z36_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z36_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z36_CNG19); + break; } case 40: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z40_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z40_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z40_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z40_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z40_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z40_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z40_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z40_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z40_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z40_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z40_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z40_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z40_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z40_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z40_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z40_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z40_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z40_CNG19); + break; } case 44: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z44_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z44_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z44_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z44_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z44_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z44_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z44_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z44_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z44_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z44_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z44_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z44_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z44_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z44_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z44_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z44_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z44_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z44_CNG19); + break; } case 48: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z48_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z48_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z48_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z48_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z48_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z48_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z48_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z48_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z48_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z48_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z48_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z48_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z48_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z48_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z48_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z48_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z48_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z48_CNG19); + break; } case 52: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z52_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z52_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z52_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z52_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z52_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z52_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z52_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z52_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z52_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z52_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z52_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z52_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z52_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z52_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z52_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z52_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z52_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z52_CNG19); + break; } case 56: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z56_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z56_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z56_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z56_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z56_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z56_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z56_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z56_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z56_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z56_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z56_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z56_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z56_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z56_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z56_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z56_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z56_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z56_CNG19); + break; } case 60: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z60_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z60_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z60_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z60_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z60_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z60_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z60_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z60_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z60_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z60_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z60_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z60_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z60_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z60_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z60_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z60_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z60_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z60_CNG19); + break; } case 64: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z64_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z64_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z64_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z64_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z64_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z64_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z64_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z64_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z64_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z64_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z64_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z64_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z64_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z64_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z64_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z64_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z64_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z64_CNG19); + break; } case 72: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z72_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z72_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z72_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z72_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z72_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z72_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z72_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z72_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z72_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z72_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z72_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z72_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z72_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z72_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z72_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z72_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z72_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z72_CNG19); + break; } case 80: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z80_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z80_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z80_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z80_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z80_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z80_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z80_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z80_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z80_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z80_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z80_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z80_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z80_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z80_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z80_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z80_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z80_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z80_CNG19); + break; } case 88: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z88_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z88_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z88_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z88_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z88_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z88_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z88_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z88_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z88_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z88_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z88_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z88_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z88_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z88_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z88_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z88_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z88_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z88_CNG19); + break; } case 96: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z96_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z96_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z96_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z96_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z96_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z96_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z96_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z96_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z96_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z96_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z96_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z96_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z96_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z96_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z96_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z96_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z96_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z96_CNG19); + break; } case 104: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z104_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z104_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z104_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z104_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z104_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z104_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z104_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z104_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z104_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z104_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z104_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z104_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z104_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z104_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z104_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z104_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z104_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z104_CNG19); + break; } case 112: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z112_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z112_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z112_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z112_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z112_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z112_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z112_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z112_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z112_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z112_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z112_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z112_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z112_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z112_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z112_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z112_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z112_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z112_CNG19); + break; } case 120: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z120_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z120_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z120_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z120_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z120_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z120_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z120_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z120_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z120_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z120_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z120_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z120_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z120_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z120_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z120_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z120_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z120_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z120_CNG19); + break; } case 128: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z128_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z128_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z128_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z128_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z128_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z128_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z128_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z128_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z128_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z128_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z128_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z128_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z128_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z128_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z128_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z128_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z128_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z128_CNG19); + break; } case 144: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z144_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z144_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z144_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z144_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z144_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z144_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z144_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z144_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z144_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z144_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z144_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z144_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z144_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z144_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z144_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z144_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z144_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z144_CNG19); + break; } case 160: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z160_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z160_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z160_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z160_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z160_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z160_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z160_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z160_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z160_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z160_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z160_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z160_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z160_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z160_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z160_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z160_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z160_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z160_CNG19); + break; } case 176: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z176_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z176_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z176_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z176_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z176_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z176_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z176_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z176_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z176_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z176_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z176_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z176_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z176_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z176_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z176_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z176_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z176_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z176_CNG19); + break; } case 192: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z192_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z192_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z192_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z192_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z192_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z192_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z192_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z192_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z192_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z192_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z192_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z192_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z192_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z192_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z192_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z192_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z192_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z192_CNG19); + break; } case 208: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z208_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z208_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z208_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z208_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z208_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z208_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z208_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z208_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z208_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z208_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z208_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z208_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z208_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z208_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z208_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z208_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z208_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z208_CNG19); + break; } case 224: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z224_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z224_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z224_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z224_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z224_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z224_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z224_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z224_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z224_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z224_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z224_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z224_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z224_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z224_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z224_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z224_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z224_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z224_CNG19); + break; } case 240: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z240_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z240_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z240_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z240_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z240_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z240_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z240_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z240_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z240_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z240_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z240_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z240_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z240_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z240_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z240_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z240_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z240_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z240_CNG19); + break; } case 256: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z256_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z256_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z256_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z256_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z256_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z256_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z256_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z256_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z256_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z256_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z256_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z256_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z256_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z256_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z256_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z256_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z256_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z256_CNG19); + break; } case 288: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z288_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z288_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z288_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z288_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z288_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z288_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z288_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z288_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z288_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z288_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z288_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z288_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z288_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z288_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z288_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z288_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z288_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z288_CNG19); + break; } case 320: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z320_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z320_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z320_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z320_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z320_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z320_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z320_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z320_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z320_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z320_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z320_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z320_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z320_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z320_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z320_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z320_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z320_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z320_CNG19); + break; } case 352: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z352_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z352_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z352_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z352_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z352_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z352_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z352_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z352_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z352_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z352_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z352_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z352_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z352_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z352_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z352_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z352_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z352_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z352_CNG19); + break; } case 384: { - p_lut->circShift[0] = (const uint16_t**) circShift_BG1_Z384_CNG3; - p_lut->circShift[1] = (const uint16_t**) circShift_BG1_Z384_CNG4; - p_lut->circShift[2] = (const uint16_t**) circShift_BG1_Z384_CNG5; - p_lut->circShift[3] = (const uint16_t**) circShift_BG1_Z384_CNG6; - p_lut->circShift[4] = (const uint16_t**) circShift_BG1_Z384_CNG7; - p_lut->circShift[5] = (const uint16_t**) circShift_BG1_Z384_CNG8; - p_lut->circShift[6] = (const uint16_t**) circShift_BG1_Z384_CNG9; - p_lut->circShift[7] = (const uint16_t**) circShift_BG1_Z384_CNG10; - p_lut->circShift[8] = (const uint16_t**) circShift_BG1_Z384_CNG19; - break; + p_lut->circShift[0] = expandArr16(circShift_BG1_Z384_CNG3); + p_lut->circShift[1] = expandArr16(circShift_BG1_Z384_CNG4); + p_lut->circShift[2] = expandArr16(circShift_BG1_Z384_CNG5); + p_lut->circShift[3] = expandArr16(circShift_BG1_Z384_CNG6); + p_lut->circShift[4] = expandArr16(circShift_BG1_Z384_CNG7); + p_lut->circShift[5] = expandArr16(circShift_BG1_Z384_CNG8); + p_lut->circShift[6] = expandArr16(circShift_BG1_Z384_CNG9); + p_lut->circShift[7] = expandArr16(circShift_BG1_Z384_CNG10); + p_lut->circShift[8] = expandArr16(circShift_BG1_Z384_CNG19); + break; } - default: - { - p_lut->circShift[0] = NULL; - p_lut->circShift[1] = NULL; - p_lut->circShift[2] = NULL; - p_lut->circShift[3] = NULL; - p_lut->circShift[4] = NULL; - p_lut->circShift[5] = NULL; - p_lut->circShift[6] = NULL; - p_lut->circShift[7] = NULL; - p_lut->circShift[8] = NULL; + default: { } } } diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_mPass.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_mPass.h index ecbcac638d..de3bf58831 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_mPass.h +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_mPass.h @@ -27,6 +27,7 @@ #define __NR_LDPC_MPASS__H__ #include +#include "common/utils/utils.h" #include "nrLDPCdecoder_defs.h" //#include /** @@ -42,6 +43,7 @@ \param cshift Circular shift */ +#define arrPos(a, b) a.d + b* a.dim2 static inline void *nrLDPC_inv_circ_memcpy(int8_t *str1, const int8_t *str2, uint16_t Z, uint16_t cshift) { uint16_t rem = Z - cshift; @@ -95,30 +97,25 @@ static inline void *nrLDPC_circ_memcpy(int8_t *str1, const int8_t *str2, uint16_ */ static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, int8_t* llrProcBuf, uint16_t Z, uint8_t BG) { - uint32_t i; - const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0]; - uint32_t startColParity = (BG ==1 ) ? (NR_LDPC_START_COL_PARITY_BG1) : (NR_LDPC_START_COL_PARITY_BG2); + const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0]; + uint32_t startColParity = (BG == 1) ? (NR_LDPC_START_COL_PARITY_BG1) : (NR_LDPC_START_COL_PARITY_BG2); - uint32_t colG1 = startColParity*Z; + uint32_t colG1 = startColParity * Z; - const uint16_t* lut_llr2llrProcBufAddr = p_lut->llr2llrProcBufAddr; - const uint8_t* lut_llr2llrProcBufBnPos = p_lut->llr2llrProcBufBnPos; + const uint16_t* lut_llr2llrProcBufAddr = p_lut->llr2llrProcBufAddr; + const uint8_t* lut_llr2llrProcBufBnPos = p_lut->llr2llrProcBufBnPos; - uint32_t idxBn; + // Copy LLRs connected to 1 CN + if (numBn2CnG1 > 0) { + memcpy(&llrProcBuf[0], &llr[colG1], numBn2CnG1 * Z); + } - // Copy LLRs connected to 1 CN - if (numBn2CnG1 > 0) - { - memcpy(&llrProcBuf[0], &llr[colG1], numBn2CnG1*Z); - } - - // First 2 columns might be set to zero directly if it's true they always belong to the groups with highest number of connected CNs... - for (i=0; icircShift[0]; - const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG1_R13[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[1]]) p_lut->circShift[1]; - const uint16_t (*lut_circShift_CNG5) [lut_numCnInCnGroups_BG1_R13[2]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[2]]) p_lut->circShift[2]; - const uint16_t (*lut_circShift_CNG6) [lut_numCnInCnGroups_BG1_R13[3]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[3]]) p_lut->circShift[3]; - const uint16_t (*lut_circShift_CNG7) [lut_numCnInCnGroups_BG1_R13[4]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[4]]) p_lut->circShift[4]; - const uint16_t (*lut_circShift_CNG8) [lut_numCnInCnGroups_BG1_R13[5]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[5]]) p_lut->circShift[5]; - const uint16_t (*lut_circShift_CNG9) [lut_numCnInCnGroups_BG1_R13[6]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[6]]) p_lut->circShift[6]; - const uint16_t (*lut_circShift_CNG10)[lut_numCnInCnGroups_BG1_R13[7]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[7]]) p_lut->circShift[7]; - const uint16_t (*lut_circShift_CNG19)[lut_numCnInCnGroups_BG1_R13[8]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[8]]) p_lut->circShift[8]; + const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; + const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; - const uint8_t (*lut_posBnInCnProcBuf_CNG3) [lut_numCnInCnGroups_BG1_R13[0]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[0]]) p_lut->posBnInCnProcBuf[0]; - const uint8_t (*lut_posBnInCnProcBuf_CNG4) [lut_numCnInCnGroups_BG1_R13[1]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[1]]) p_lut->posBnInCnProcBuf[1]; - const uint8_t (*lut_posBnInCnProcBuf_CNG5) [lut_numCnInCnGroups_BG1_R13[2]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[2]]) p_lut->posBnInCnProcBuf[2]; - const uint8_t (*lut_posBnInCnProcBuf_CNG6) [lut_numCnInCnGroups_BG1_R13[3]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[3]]) p_lut->posBnInCnProcBuf[3]; - const uint8_t (*lut_posBnInCnProcBuf_CNG7) [lut_numCnInCnGroups_BG1_R13[4]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[4]]) p_lut->posBnInCnProcBuf[4]; - const uint8_t (*lut_posBnInCnProcBuf_CNG8) [lut_numCnInCnGroups_BG1_R13[5]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[5]]) p_lut->posBnInCnProcBuf[5]; - const uint8_t (*lut_posBnInCnProcBuf_CNG9) [lut_numCnInCnGroups_BG1_R13[6]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[6]]) p_lut->posBnInCnProcBuf[6]; - const uint8_t (*lut_posBnInCnProcBuf_CNG10)[lut_numCnInCnGroups_BG1_R13[7]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[7]]) p_lut->posBnInCnProcBuf[7]; - const uint8_t (*lut_posBnInCnProcBuf_CNG19)[lut_numCnInCnGroups_BG1_R13[8]] = (const uint8_t(*)[lut_numCnInCnGroups_BG1_R13[8]]) p_lut->posBnInCnProcBuf[8]; + uint32_t bitOffsetInGroup; - const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; - const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; + // ===================================================================== + // CN group with 3 BNs - uint32_t i; - uint32_t j; + bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[0] * NR_LDPC_ZMAX; - uint32_t idxBn = 0; - int8_t* p_cnProcBuf; - uint32_t bitOffsetInGroup; + for (int j = 0; j < 3; j++) { + const uint16_t* lut_circShift_CNG3 = p_lut->circShift[0].d; + int8_t* p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[0] + j * bitOffsetInGroup]; + const uint8_t* lut_posBnInCnProcBuf_CNG3 = p_lut->posBnInCnProcBuf[0].d; - // ===================================================================== - // CN group with 3 BNs + const int idxBn = lut_posBnInCnProcBuf_CNG3[j] * Z; - bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX; + nrLDPC_circ_memcpy(p_cnProcBuf, &llr[idxBn], Z, lut_circShift_CNG3[j]); + } + // ===================================================================== + // CN group with BNs + int BNs[] = {3, 4, 5, 6, 7, 8, 9, 10, 19}; + for (int bn = 1; bn < sizeofArray(BNs); bn++) { + bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[bn] * NR_LDPC_ZMAX; + for (int j = 0; j < BNs[bn]; j++) { + int8_t* p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[bn] + j * bitOffsetInGroup]; + const uint16_t* lut_circShift = arrPos(p_lut->circShift[bn], j); + const uint8_t* lut_posBnInCnProcBuf = arrPos(p_lut->posBnInCnProcBuf[bn], j); + for (int i = 0; i < lut_numCnInCnGroups[bn]; i++) { + const int idxBn = lut_posBnInCnProcBuf[i] * Z; - for (j=0; j<3; j++) - { - p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[0] + j*bitOffsetInGroup]; + nrLDPC_circ_memcpy(p_cnProcBuf, &llr[idxBn], Z, lut_circShift[i]); - idxBn = lut_posBnInCnProcBuf_CNG3[j][0]*Z; - - nrLDPC_circ_memcpy(p_cnProcBuf, &llr[idxBn], Z, lut_circShift_CNG3[j][0]); + p_cnProcBuf += Z; + } } - - // ===================================================================== - // CN group with 4 BNs - - bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX; - - for (j=0; j<4; j++) - { - p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[1] + j*bitOffsetInGroup]; - - for (i=0; icircShift[0]; - const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG2_R15[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[1]]) p_lut->circShift[1]; - const uint16_t (*lut_circShift_CNG5) [lut_numCnInCnGroups_BG2_R15[2]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[2]]) p_lut->circShift[2]; - const uint16_t (*lut_circShift_CNG6) [lut_numCnInCnGroups_BG2_R15[3]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[3]]) p_lut->circShift[3]; - const uint16_t (*lut_circShift_CNG8) [lut_numCnInCnGroups_BG2_R15[4]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[4]]) p_lut->circShift[4]; - const uint16_t (*lut_circShift_CNG10) [lut_numCnInCnGroups_BG2_R15[5]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[5]]) p_lut->circShift[5]; + const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; + const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; - const uint8_t (*lut_posBnInCnProcBuf_CNG3) [lut_numCnInCnGroups_BG2_R15[0]] = (const uint8_t(*)[lut_numCnInCnGroups_BG2_R15[0]]) p_lut->posBnInCnProcBuf[0]; - const uint8_t (*lut_posBnInCnProcBuf_CNG4) [lut_numCnInCnGroups_BG2_R15[1]] = (const uint8_t(*)[lut_numCnInCnGroups_BG2_R15[1]]) p_lut->posBnInCnProcBuf[1]; - const uint8_t (*lut_posBnInCnProcBuf_CNG5) [lut_numCnInCnGroups_BG2_R15[2]] = (const uint8_t(*)[lut_numCnInCnGroups_BG2_R15[2]]) p_lut->posBnInCnProcBuf[2]; - const uint8_t (*lut_posBnInCnProcBuf_CNG6) [lut_numCnInCnGroups_BG2_R15[3]] = (const uint8_t(*)[lut_numCnInCnGroups_BG2_R15[3]]) p_lut->posBnInCnProcBuf[3]; - const uint8_t (*lut_posBnInCnProcBuf_CNG8) [lut_numCnInCnGroups_BG2_R15[4]] = (const uint8_t(*)[lut_numCnInCnGroups_BG2_R15[4]]) p_lut->posBnInCnProcBuf[4]; - const uint8_t (*lut_posBnInCnProcBuf_CNG10) [lut_numCnInCnGroups_BG2_R15[5]] = (const uint8_t(*)[lut_numCnInCnGroups_BG2_R15[5]]) p_lut->posBnInCnProcBuf[5]; + uint32_t bitOffsetInGroup; - const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; - const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; + // ===================================================================== + // CN group with BNs + int BNs[] = {3, 4, 5, 6, 8, 10}; + for (int bn = 0; bn < sizeofArray(BNs); bn++) { + bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[bn] * NR_LDPC_ZMAX; - uint32_t i; - uint32_t j; + for (int j = 0; j < BNs[bn]; j++) { + int8_t* p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[bn] + j * bitOffsetInGroup]; + const uint16_t* lut_circShift = arrPos(p_lut->circShift[bn], j); + const uint8_t* lut_posBnInCnProcBuf = arrPos(p_lut->posBnInCnProcBuf[bn], j); - uint32_t idxBn = 0; - int8_t* p_cnProcBuf; - uint32_t bitOffsetInGroup; - - // ===================================================================== - // CN group with 3 BNs - - bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[0]*NR_LDPC_ZMAX; - - for (j=0; j<3; j++) - { - p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[0] + j*bitOffsetInGroup]; - - for (i=0; inumCnInCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; - const uint16_t (*lut_circShift_CNG3) [lut_numCnInCnGroups_BG2_R15[0]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[0]]) p_lut->circShift[0]; - const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG2_R15[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[1]]) p_lut->circShift[1]; - const uint16_t (*lut_circShift_CNG5) [lut_numCnInCnGroups_BG2_R15[2]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[2]]) p_lut->circShift[2]; - const uint16_t (*lut_circShift_CNG6) [lut_numCnInCnGroups_BG2_R15[3]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[3]]) p_lut->circShift[3]; - const uint16_t (*lut_circShift_CNG8) [lut_numCnInCnGroups_BG2_R15[4]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[4]]) p_lut->circShift[4]; - const uint16_t (*lut_circShift_CNG10) [lut_numCnInCnGroups_BG2_R15[5]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[5]]) p_lut->circShift[5]; - - const uint32_t (*lut_startAddrBnProcBuf_CNG3) [lut_numCnInCnGroups[0]] = (const uint32_t(*)[lut_numCnInCnGroups[0]]) p_lut->startAddrBnProcBuf[0]; - const uint32_t (*lut_startAddrBnProcBuf_CNG4) [lut_numCnInCnGroups[1]] = (const uint32_t(*)[lut_numCnInCnGroups[1]]) p_lut->startAddrBnProcBuf[1]; - const uint32_t (*lut_startAddrBnProcBuf_CNG5) [lut_numCnInCnGroups[2]] = (const uint32_t(*)[lut_numCnInCnGroups[2]]) p_lut->startAddrBnProcBuf[2]; - const uint32_t (*lut_startAddrBnProcBuf_CNG6) [lut_numCnInCnGroups[3]] = (const uint32_t(*)[lut_numCnInCnGroups[3]]) p_lut->startAddrBnProcBuf[3]; - const uint32_t (*lut_startAddrBnProcBuf_CNG8) [lut_numCnInCnGroups[4]] = (const uint32_t(*)[lut_numCnInCnGroups[4]]) p_lut->startAddrBnProcBuf[4]; - const uint32_t (*lut_startAddrBnProcBuf_CNG10) [lut_numCnInCnGroups[5]] = (const uint32_t(*)[lut_numCnInCnGroups[5]]) p_lut->startAddrBnProcBuf[5]; - - const uint8_t (*lut_bnPosBnProcBuf_CNG3) [lut_numCnInCnGroups[0]] = (const uint8_t(*)[lut_numCnInCnGroups[0]]) p_lut->bnPosBnProcBuf[0]; - const uint8_t (*lut_bnPosBnProcBuf_CNG4) [lut_numCnInCnGroups[1]] = (const uint8_t(*)[lut_numCnInCnGroups[1]]) p_lut->bnPosBnProcBuf[1]; - const uint8_t (*lut_bnPosBnProcBuf_CNG5) [lut_numCnInCnGroups[2]] = (const uint8_t(*)[lut_numCnInCnGroups[2]]) p_lut->bnPosBnProcBuf[2]; - const uint8_t (*lut_bnPosBnProcBuf_CNG6) [lut_numCnInCnGroups[3]] = (const uint8_t(*)[lut_numCnInCnGroups[3]]) p_lut->bnPosBnProcBuf[3]; - const uint8_t (*lut_bnPosBnProcBuf_CNG8) [lut_numCnInCnGroups[4]] = (const uint8_t(*)[lut_numCnInCnGroups[4]]) p_lut->bnPosBnProcBuf[4]; - const uint8_t (*lut_bnPosBnProcBuf_CNG10) [lut_numCnInCnGroups[5]] = (const uint8_t(*)[lut_numCnInCnGroups[5]]) p_lut->bnPosBnProcBuf[5]; - - int8_t* p_cnProcBufRes; uint32_t bitOffsetInGroup; - uint32_t i; - uint32_t j; - uint32_t idxBn = 0; // ===================================================================== // CN group with 3 BNs + int BNs[] = {3, 4, 5, 6, 8, 10}; + for (int bn = 0; bn < sizeofArray(BNs); bn++) { + bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[bn] * NR_LDPC_ZMAX; - bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[0]*NR_LDPC_ZMAX; + for (int j = 0; j < BNs[bn]; j++) { + int8_t* p_cnProcBufRes = &cnProcBufRes[lut_startAddrCnGroups[bn] + j * bitOffsetInGroup]; + const uint16_t* lut_circShift = arrPos(p_lut->circShift[bn], j); + const uint32_t* lut_startAddrBnProcBuf = arrPos(p_lut->startAddrBnProcBuf[bn], j); + const uint8_t* lut_bnPosBnProcBuf = arrPos(p_lut->bnPosBnProcBuf[bn], j); - for (j=0; j<3; j++) - { - p_cnProcBufRes = &cnProcBufRes[lut_startAddrCnGroups[0] + j*bitOffsetInGroup]; - for (i=0; inumCnInCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; - - const uint16_t (*lut_circShift_CNG3) [lut_numCnInCnGroups_BG1_R13[0]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[0]]) p_lut->circShift[0]; - const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG1_R13[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[1]]) p_lut->circShift[1]; - const uint16_t (*lut_circShift_CNG5) [lut_numCnInCnGroups_BG1_R13[2]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[2]]) p_lut->circShift[2]; - const uint16_t (*lut_circShift_CNG6) [lut_numCnInCnGroups_BG1_R13[3]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[3]]) p_lut->circShift[3]; - const uint16_t (*lut_circShift_CNG7) [lut_numCnInCnGroups_BG1_R13[4]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[4]]) p_lut->circShift[4]; - const uint16_t (*lut_circShift_CNG8) [lut_numCnInCnGroups_BG1_R13[5]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[5]]) p_lut->circShift[5]; - const uint16_t (*lut_circShift_CNG9) [lut_numCnInCnGroups_BG1_R13[6]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[6]]) p_lut->circShift[6]; - const uint16_t (*lut_circShift_CNG10)[lut_numCnInCnGroups_BG1_R13[7]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[7]]) p_lut->circShift[7]; - const uint16_t (*lut_circShift_CNG19)[lut_numCnInCnGroups_BG1_R13[8]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[8]]) p_lut->circShift[8]; - - const uint32_t (*lut_startAddrBnProcBuf_CNG3) [lut_numCnInCnGroups[0]] = (const uint32_t(*)[lut_numCnInCnGroups[0]]) p_lut->startAddrBnProcBuf[0]; - const uint32_t (*lut_startAddrBnProcBuf_CNG4) [lut_numCnInCnGroups[1]] = (const uint32_t(*)[lut_numCnInCnGroups[1]]) p_lut->startAddrBnProcBuf[1]; - const uint32_t (*lut_startAddrBnProcBuf_CNG5) [lut_numCnInCnGroups[2]] = (const uint32_t(*)[lut_numCnInCnGroups[2]]) p_lut->startAddrBnProcBuf[2]; - const uint32_t (*lut_startAddrBnProcBuf_CNG6) [lut_numCnInCnGroups[3]] = (const uint32_t(*)[lut_numCnInCnGroups[3]]) p_lut->startAddrBnProcBuf[3]; - const uint32_t (*lut_startAddrBnProcBuf_CNG7) [lut_numCnInCnGroups[4]] = (const uint32_t(*)[lut_numCnInCnGroups[4]]) p_lut->startAddrBnProcBuf[4]; - const uint32_t (*lut_startAddrBnProcBuf_CNG8) [lut_numCnInCnGroups[5]] = (const uint32_t(*)[lut_numCnInCnGroups[5]]) p_lut->startAddrBnProcBuf[5]; - const uint32_t (*lut_startAddrBnProcBuf_CNG9) [lut_numCnInCnGroups[6]] = (const uint32_t(*)[lut_numCnInCnGroups[6]]) p_lut->startAddrBnProcBuf[6]; - const uint32_t (*lut_startAddrBnProcBuf_CNG10)[lut_numCnInCnGroups[7]] = (const uint32_t(*)[lut_numCnInCnGroups[7]]) p_lut->startAddrBnProcBuf[7]; - const uint32_t (*lut_startAddrBnProcBuf_CNG19)[lut_numCnInCnGroups[8]] = (const uint32_t(*)[lut_numCnInCnGroups[8]]) p_lut->startAddrBnProcBuf[8]; - - const uint8_t (*lut_bnPosBnProcBuf_CNG4) [lut_numCnInCnGroups[1]] = (const uint8_t(*)[lut_numCnInCnGroups[1]]) p_lut->bnPosBnProcBuf[1]; - const uint8_t (*lut_bnPosBnProcBuf_CNG5) [lut_numCnInCnGroups[2]] = (const uint8_t(*)[lut_numCnInCnGroups[2]]) p_lut->bnPosBnProcBuf[2]; - const uint8_t (*lut_bnPosBnProcBuf_CNG6) [lut_numCnInCnGroups[3]] = (const uint8_t(*)[lut_numCnInCnGroups[3]]) p_lut->bnPosBnProcBuf[3]; - const uint8_t (*lut_bnPosBnProcBuf_CNG7) [lut_numCnInCnGroups[4]] = (const uint8_t(*)[lut_numCnInCnGroups[4]]) p_lut->bnPosBnProcBuf[4]; - const uint8_t (*lut_bnPosBnProcBuf_CNG8) [lut_numCnInCnGroups[5]] = (const uint8_t(*)[lut_numCnInCnGroups[5]]) p_lut->bnPosBnProcBuf[5]; - const uint8_t (*lut_bnPosBnProcBuf_CNG9) [lut_numCnInCnGroups[6]] = (const uint8_t(*)[lut_numCnInCnGroups[6]]) p_lut->bnPosBnProcBuf[6]; - const uint8_t (*lut_bnPosBnProcBuf_CNG10)[lut_numCnInCnGroups[7]] = (const uint8_t(*)[lut_numCnInCnGroups[7]]) p_lut->bnPosBnProcBuf[7]; - const uint8_t (*lut_bnPosBnProcBuf_CNG19)[lut_numCnInCnGroups[8]] = (const uint8_t(*)[lut_numCnInCnGroups[8]]) p_lut->bnPosBnProcBuf[8]; - - int8_t* p_cnProcBufRes; uint32_t bitOffsetInGroup; - uint32_t i; - uint32_t j; - uint32_t idxBn = 0; // ===================================================================== // CN group with 3 BNs bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX; - for (j=0; j<3; j++) - { - p_cnProcBufRes = &cnProcBufRes[lut_startAddrCnGroups[0] + j*bitOffsetInGroup]; - nrLDPC_inv_circ_memcpy(&bnProcBuf[lut_startAddrBnProcBuf_CNG3[j][0]],p_cnProcBufRes,Z,lut_circShift_CNG3[j][0]); + for (int j = 0; j < 3; j++) { + const uint16_t* lut_circShift_CNG3 = arrPos(p_lut->circShift[0], j); + const uint32_t* lut_startAddrBnProcBuf_CNG3 = arrPos(p_lut->startAddrBnProcBuf[0], j); + int8_t* p_cnProcBufRes = &cnProcBufRes[lut_startAddrCnGroups[0] + j * bitOffsetInGroup]; + nrLDPC_inv_circ_memcpy(&bnProcBuf[lut_startAddrBnProcBuf_CNG3[0]], p_cnProcBufRes, Z, lut_circShift_CNG3[0]); } // ===================================================================== // CN group with 4 BNs + // CN group with 3 BNs + int BNs[] = {3, 4, 5, 6, 7, 8, 9, 10, 19}; + for (int bn = 1; bn < sizeofArray(BNs); bn++) { + bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[bn] * NR_LDPC_ZMAX; - bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX; + for (int j = 0; j < BNs[bn]; j++) { + int8_t* p_cnProcBufRes = &cnProcBufRes[lut_startAddrCnGroups[bn] + j * bitOffsetInGroup]; + const uint16_t* lut_circShift_CNG = arrPos(p_lut->circShift[bn], j); + const uint32_t* lut_startAddrBnProcBuf_CNG = arrPos(p_lut->startAddrBnProcBuf[bn], j); + const uint8_t* lut_bnPosBnProcBuf_CNG = arrPos(p_lut->bnPosBnProcBuf[bn], j); - for (j=0; j<4; j++) - { - p_cnProcBufRes = &cnProcBufRes[lut_startAddrCnGroups[1] + j*bitOffsetInGroup]; - - for (i=0; inumCnInCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; - const uint16_t (*lut_circShift_CNG3) [lut_numCnInCnGroups_BG2_R15[0]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[0]]) p_lut->circShift[0]; - const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG2_R15[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[1]]) p_lut->circShift[1]; - const uint16_t (*lut_circShift_CNG5) [lut_numCnInCnGroups_BG2_R15[2]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[2]]) p_lut->circShift[2]; - const uint16_t (*lut_circShift_CNG6) [lut_numCnInCnGroups_BG2_R15[3]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[3]]) p_lut->circShift[3]; - const uint16_t (*lut_circShift_CNG8) [lut_numCnInCnGroups_BG2_R15[4]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[4]]) p_lut->circShift[4]; - const uint16_t (*lut_circShift_CNG10) [lut_numCnInCnGroups_BG2_R15[5]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[5]]) p_lut->circShift[5]; - - const uint32_t (*lut_startAddrBnProcBuf_CNG3) [lut_numCnInCnGroups[0]] = (const uint32_t(*)[lut_numCnInCnGroups[0]]) p_lut->startAddrBnProcBuf[0]; - const uint32_t (*lut_startAddrBnProcBuf_CNG4) [lut_numCnInCnGroups[1]] = (const uint32_t(*)[lut_numCnInCnGroups[1]]) p_lut->startAddrBnProcBuf[1]; - const uint32_t (*lut_startAddrBnProcBuf_CNG5) [lut_numCnInCnGroups[2]] = (const uint32_t(*)[lut_numCnInCnGroups[2]]) p_lut->startAddrBnProcBuf[2]; - const uint32_t (*lut_startAddrBnProcBuf_CNG6) [lut_numCnInCnGroups[3]] = (const uint32_t(*)[lut_numCnInCnGroups[3]]) p_lut->startAddrBnProcBuf[3]; - const uint32_t (*lut_startAddrBnProcBuf_CNG8) [lut_numCnInCnGroups[4]] = (const uint32_t(*)[lut_numCnInCnGroups[4]]) p_lut->startAddrBnProcBuf[4]; - const uint32_t (*lut_startAddrBnProcBuf_CNG10) [lut_numCnInCnGroups[5]] = (const uint32_t(*)[lut_numCnInCnGroups[5]]) p_lut->startAddrBnProcBuf[5]; - - const uint8_t (*lut_bnPosBnProcBuf_CNG3) [lut_numCnInCnGroups[0]] = (const uint8_t(*)[lut_numCnInCnGroups[0]]) p_lut->bnPosBnProcBuf[0]; - const uint8_t (*lut_bnPosBnProcBuf_CNG4) [lut_numCnInCnGroups[1]] = (const uint8_t(*)[lut_numCnInCnGroups[1]]) p_lut->bnPosBnProcBuf[1]; - const uint8_t (*lut_bnPosBnProcBuf_CNG5) [lut_numCnInCnGroups[2]] = (const uint8_t(*)[lut_numCnInCnGroups[2]]) p_lut->bnPosBnProcBuf[2]; - const uint8_t (*lut_bnPosBnProcBuf_CNG6) [lut_numCnInCnGroups[3]] = (const uint8_t(*)[lut_numCnInCnGroups[3]]) p_lut->bnPosBnProcBuf[3]; - const uint8_t (*lut_bnPosBnProcBuf_CNG8) [lut_numCnInCnGroups[4]] = (const uint8_t(*)[lut_numCnInCnGroups[4]]) p_lut->bnPosBnProcBuf[4]; - const uint8_t (*lut_bnPosBnProcBuf_CNG10) [lut_numCnInCnGroups[5]] = (const uint8_t(*)[lut_numCnInCnGroups[5]]) p_lut->bnPosBnProcBuf[5]; - - int8_t* p_cnProcBuf; uint32_t bitOffsetInGroup; - uint32_t i; - uint32_t j; - uint32_t idxBn = 0; // For CN groups 3 to 6 no need to send the last BN back since it's single edge // and BN processing does not change the value already in the CN proc buf // ===================================================================== // CN group with 3 BNs + int BNs[] = {2, 3, 4, 5, 8, 10}; + for (int bn = 0; bn < sizeofArray(BNs); bn++) { + bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[bn] * NR_LDPC_ZMAX; - bitOffsetInGroup = lut_numCnInCnGroups_BG2_R15[0]*NR_LDPC_ZMAX; + for (int j = 0; j < BNs[bn]; j++) { + int8_t* p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[bn] + j * bitOffsetInGroup]; + const uint16_t* lut_circShift_CNG = arrPos(p_lut->circShift[bn], j); + const uint32_t* lut_startAddrBnProcBuf_CNG = arrPos(p_lut->startAddrBnProcBuf[bn], j); + const uint8_t* lut_bnPosBnProcBuf_CNG = arrPos(p_lut->bnPosBnProcBuf[bn], j); - for (j=0; j<2; j++) - { - p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[0] + j*bitOffsetInGroup]; - for (i=0; inumCnInCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; - - const uint16_t (*lut_circShift_CNG3) [lut_numCnInCnGroups_BG1_R13[0]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[0]]) p_lut->circShift[0]; - const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG1_R13[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[1]]) p_lut->circShift[1]; - const uint16_t (*lut_circShift_CNG5) [lut_numCnInCnGroups_BG1_R13[2]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[2]]) p_lut->circShift[2]; - const uint16_t (*lut_circShift_CNG6) [lut_numCnInCnGroups_BG1_R13[3]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[3]]) p_lut->circShift[3]; - const uint16_t (*lut_circShift_CNG7) [lut_numCnInCnGroups_BG1_R13[4]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[4]]) p_lut->circShift[4]; - const uint16_t (*lut_circShift_CNG8) [lut_numCnInCnGroups_BG1_R13[5]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[5]]) p_lut->circShift[5]; - const uint16_t (*lut_circShift_CNG9) [lut_numCnInCnGroups_BG1_R13[6]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[6]]) p_lut->circShift[6]; - const uint16_t (*lut_circShift_CNG10)[lut_numCnInCnGroups_BG1_R13[7]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[7]]) p_lut->circShift[7]; - const uint16_t (*lut_circShift_CNG19)[lut_numCnInCnGroups_BG1_R13[8]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[8]]) p_lut->circShift[8]; - - const uint32_t (*lut_startAddrBnProcBuf_CNG3) [lut_numCnInCnGroups[0]] = (const uint32_t(*)[lut_numCnInCnGroups[0]]) p_lut->startAddrBnProcBuf[0]; - const uint32_t (*lut_startAddrBnProcBuf_CNG4) [lut_numCnInCnGroups[1]] = (const uint32_t(*)[lut_numCnInCnGroups[1]]) p_lut->startAddrBnProcBuf[1]; - const uint32_t (*lut_startAddrBnProcBuf_CNG5) [lut_numCnInCnGroups[2]] = (const uint32_t(*)[lut_numCnInCnGroups[2]]) p_lut->startAddrBnProcBuf[2]; - const uint32_t (*lut_startAddrBnProcBuf_CNG6) [lut_numCnInCnGroups[3]] = (const uint32_t(*)[lut_numCnInCnGroups[3]]) p_lut->startAddrBnProcBuf[3]; - const uint32_t (*lut_startAddrBnProcBuf_CNG7) [lut_numCnInCnGroups[4]] = (const uint32_t(*)[lut_numCnInCnGroups[4]]) p_lut->startAddrBnProcBuf[4]; - const uint32_t (*lut_startAddrBnProcBuf_CNG8) [lut_numCnInCnGroups[5]] = (const uint32_t(*)[lut_numCnInCnGroups[5]]) p_lut->startAddrBnProcBuf[5]; - const uint32_t (*lut_startAddrBnProcBuf_CNG9) [lut_numCnInCnGroups[6]] = (const uint32_t(*)[lut_numCnInCnGroups[6]]) p_lut->startAddrBnProcBuf[6]; - const uint32_t (*lut_startAddrBnProcBuf_CNG10)[lut_numCnInCnGroups[7]] = (const uint32_t(*)[lut_numCnInCnGroups[7]]) p_lut->startAddrBnProcBuf[7]; - const uint32_t (*lut_startAddrBnProcBuf_CNG19)[lut_numCnInCnGroups[8]] = (const uint32_t(*)[lut_numCnInCnGroups[8]]) p_lut->startAddrBnProcBuf[8]; - - const uint8_t (*lut_bnPosBnProcBuf_CNG4) [lut_numCnInCnGroups[1]] = (const uint8_t(*)[lut_numCnInCnGroups[1]]) p_lut->bnPosBnProcBuf[1]; - const uint8_t (*lut_bnPosBnProcBuf_CNG5) [lut_numCnInCnGroups[2]] = (const uint8_t(*)[lut_numCnInCnGroups[2]]) p_lut->bnPosBnProcBuf[2]; - const uint8_t (*lut_bnPosBnProcBuf_CNG6) [lut_numCnInCnGroups[3]] = (const uint8_t(*)[lut_numCnInCnGroups[3]]) p_lut->bnPosBnProcBuf[3]; - const uint8_t (*lut_bnPosBnProcBuf_CNG7) [lut_numCnInCnGroups[4]] = (const uint8_t(*)[lut_numCnInCnGroups[4]]) p_lut->bnPosBnProcBuf[4]; - const uint8_t (*lut_bnPosBnProcBuf_CNG8) [lut_numCnInCnGroups[5]] = (const uint8_t(*)[lut_numCnInCnGroups[5]]) p_lut->bnPosBnProcBuf[5]; - const uint8_t (*lut_bnPosBnProcBuf_CNG9) [lut_numCnInCnGroups[6]] = (const uint8_t(*)[lut_numCnInCnGroups[6]]) p_lut->bnPosBnProcBuf[6]; - const uint8_t (*lut_bnPosBnProcBuf_CNG10)[lut_numCnInCnGroups[7]] = (const uint8_t(*)[lut_numCnInCnGroups[7]]) p_lut->bnPosBnProcBuf[7]; - const uint8_t (*lut_bnPosBnProcBuf_CNG19)[lut_numCnInCnGroups[8]] = (const uint8_t(*)[lut_numCnInCnGroups[8]]) p_lut->bnPosBnProcBuf[8]; - - int8_t* p_cnProcBuf; uint32_t bitOffsetInGroup; - uint32_t i; - uint32_t j; - uint32_t idxBn = 0; // For CN groups 3 to 19 no need to send the last BN back since it's single edge // and BN processing does not change the value already in the CN proc buf @@ -1001,147 +355,32 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBu bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX; - for (j=0;j<2; j++) - { - p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[0] + j*bitOffsetInGroup]; - nrLDPC_circ_memcpy(p_cnProcBuf, &bnProcBufRes[lut_startAddrBnProcBuf_CNG3[j][0]], Z, lut_circShift_CNG3[j][0]); + for (int j = 0; j < 2; j++) { + const uint16_t* lut_circShift_CNG3 = arrPos(p_lut->circShift[0], j); + const uint32_t* lut_startAddrBnProcBuf_CNG3 = arrPos(p_lut->startAddrBnProcBuf[0], j); + int8_t* p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[0] + j * bitOffsetInGroup]; + nrLDPC_circ_memcpy(p_cnProcBuf, &bnProcBufRes[lut_startAddrBnProcBuf_CNG3[0]], Z, lut_circShift_CNG3[0]); } // ===================================================================== // CN group with 4 BNs + int BNs[] = {2, 3, 4, 5, 6, 7, 8, 9, 19}; + for (int bn = 1; bn < sizeofArray(BNs); bn++) { + bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[bn] * NR_LDPC_ZMAX; - bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX; - - for (j=0; j<3; j++) - { - p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[1] + j*bitOffsetInGroup]; + for (int j = 0; j < BNs[bn]; j++) { + int8_t* p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[bn] + j * bitOffsetInGroup]; + const uint16_t* lut_circShift_CNG = arrPos(p_lut->circShift[bn], j); + const uint32_t* lut_startAddrBnProcBuf_CNG = arrPos(p_lut->startAddrBnProcBuf[bn], j); + const uint8_t* lut_bnPosBnProcBuf_CNG = arrPos(p_lut->bnPosBnProcBuf[bn], j); - for (i=0; inumBnInBnGroups[0]; - uint32_t startColParity = (BG ==1 ) ? (NR_LDPC_START_COL_PARITY_BG1) : (NR_LDPC_START_COL_PARITY_BG2); + const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0]; + uint32_t startColParity = (BG == 1) ? (NR_LDPC_START_COL_PARITY_BG1) : (NR_LDPC_START_COL_PARITY_BG2); - uint32_t colG1 = startColParity*Z; + uint32_t colG1 = startColParity * Z; - const uint16_t* lut_llr2llrProcBufAddr = p_lut->llr2llrProcBufAddr; - const uint8_t* lut_llr2llrProcBufBnPos = p_lut->llr2llrProcBufBnPos; + const uint16_t* lut_llr2llrProcBufAddr = p_lut->llr2llrProcBufAddr; + const uint8_t* lut_llr2llrProcBufBnPos = p_lut->llr2llrProcBufBnPos; - int8_t* p_llrOut = &llrOut[0]; - uint32_t idxBn; + int8_t* p_llrOut = &llrOut[0]; - // Copy LLRs connected to 1 CN - if (numBn2CnG1 > 0) - { - memcpy(&llrOut[colG1], llrRes, numBn2CnG1*Z); - } - - for (i=0; i 0) { + memcpy(&llrOut[colG1], llrRes, numBn2CnG1 * Z); + } + for (int i = 0; i < startColParity; i++) { + const int idxBn = lut_llr2llrProcBufAddr[i] + lut_llr2llrProcBufBnPos[i] * Z; + memcpy(p_llrOut, &llrRes[idxBn], Z); + p_llrOut += Z; + } } #endif diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h index 226af8017e..513bcb1732 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h @@ -34,6 +34,21 @@ #include "time_meas.h" #endif #include "nrLDPCdecoder_defs.h" +typedef struct { + uint8_t* d; + int dim1; + int dim2; +} arr8_t; +typedef struct { + uint16_t* d; + int dim1; + int dim2; +} arr16_t; +typedef struct { + uint32_t* d; + int dim1; + int dim2; +} arr32_t; // ============================================================================== // TYPES @@ -46,12 +61,12 @@ typedef struct nrLDPC_lut { const uint8_t* numBnInBnGroups; /**< Number of CNs in every BN group */ const uint32_t* startAddrBnGroups; /**< Start addresses for BN groups in BN processing buffer */ const uint16_t* startAddrBnGroupsLlr; /**< Start addresses for BN groups in LLR processing buffer */ - const uint16_t** circShift[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for circular shift values for all CN groups and Zs */ - const uint32_t** startAddrBnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT of start addresses of CN groups in BN proc buffer */ - const uint8_t** bnPosBnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT of BN positions in BG for CN groups */ + arr16_t circShift[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for circular shift values for all CN groups and Zs */ + arr32_t startAddrBnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT of start addresses of CN groups in BN proc buffer */ + arr8_t bnPosBnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT of BN positions in BG for CN groups */ const uint16_t* llr2llrProcBufAddr; /**< LUT for transferring input LLRs to LLR processing buffer */ const uint8_t* llr2llrProcBufBnPos; /**< LUT BN position in BG */ - const uint8_t** posBnInCnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for llr2cnProcBuf */ + arr8_t posBnInCnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for llr2cnProcBuf */ } t_nrLDPC_lut; /** diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c index 4cba3fe078..ad77a61a02 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c @@ -342,7 +342,8 @@ void build_polar_tables(t_nrPolar_params *polarParams) { } } - AssertFatal(polarParams->N==512 || polarParams->N==256 || polarParams->N==128,"N = %d, not done yet\n",polarParams->N); + AssertFatal(polarParams->N == 512 || polarParams->N == 256 || polarParams->N == 128 || polarParams->N == 64, "N = %d, not done yet\n", polarParams->N); + // build G bit vectors for information bit positions and convert the bit as bytes tables in nr_polar_kronecker_power_matrices.c to 64 bit packed vectors. // keep only rows of G which correspond to information/crc bits polarParams->G_N_tab = (uint64_t **)calloc((polarParams->K + polarParams->n_pc),sizeof(int64_t *)); @@ -410,19 +411,34 @@ void build_polar_tables(t_nrPolar_params *polarParams) { firstingroup_in,firstingroup_in+ccnt, firstingroup_out,firstingroup_out+ccnt); #endif - AssertFatal(mingroupsize==4 || mingroupsize==8 || mingroupsize==16,"mingroupsize %d, needs to be handled\n",mingroupsize); - polarParams->groupsize=mingroupsize; - int shift=3; - if (mingroupsize == 16) shift=4; - else if (mingroupsize == 4) shift=2; + polarParams->groupsize = mingroupsize; + + int shift = 0; + switch (mingroupsize) { + case 2: + shift = 1; + break; + case 4: + shift = 2; + break; + case 8: + shift = 3; + break; + case 16: + shift = 4; + break; + default: + AssertFatal(1 == 0, "mingroupsize = %i is not supported\n", mingroupsize); + break; + } + + polarParams->rm_tab = (int *)malloc(sizeof(int) * (polarParams->encoderLength >> shift)); - polarParams->rm_tab=(int *)malloc(sizeof(int)*polarParams->encoderLength/mingroupsize); // rerun again to create groups - int tcnt=0; - - for (int outpos=0; outposencoderLength; outpos+=mingroupsize,tcnt++) - polarParams->rm_tab[tcnt] = polarParams->rate_matching_pattern[outpos]>>shift; + int tcnt = 0; + for (int outpos = 0; outpos < polarParams->encoderLength; outpos += mingroupsize, tcnt++) + polarParams->rm_tab[tcnt] = polarParams->rate_matching_pattern[outpos] >> shift; } void polar_encoder_fast(uint64_t *A, @@ -699,6 +715,11 @@ void polar_encoder_fast(uint64_t *A, #endif } } + } else if (polarParams->N == 64) { + for (int i = 0; i < ((len > 63) ? 64 : len); i++) { + Cprime_i = -((Cprime[0] >> i) & 1); + D[0] ^= (Cprime_i & polarParams->G_N_tab[off + i][0]); + } } memset((void*)out,0,polarParams->encoderLength>>3); polar_rate_matching(polarParams,(void *)D, out); diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c index 38a1ae86ae..4a88417a13 100644 --- a/openair1/PHY/CODING/nr_polar_init.c +++ b/openair1/PHY/CODING/nr_polar_init.c @@ -85,10 +85,8 @@ static void nr_polar_delete(void) { pthread_mutex_unlock(&PolarListMutex); } -t_nrPolar_params * nr_polar_params(int8_t messageType, - uint16_t messageLength, - uint8_t aggregation_level, - int decoder_flag) { +t_nrPolar_params *nr_polar_params(int8_t messageType, uint16_t messageLength, uint8_t aggregation_level, int decoder_flag) +{ // The lock is weak, because we never delete in the list, only at exit time // therefore, returning t_nrPolar_params * from the list is safe for future usage pthread_mutex_lock(&PolarListMutex); @@ -123,8 +121,8 @@ t_nrPolar_params * nr_polar_params(int8_t messageType, newPolarInitNode->idx = PolarKey; newPolarInitNode->nextPtr = NULL; //printf("newPolarInitNode->idx %d, (%d,%d,%d:%d)\n",newPolarInitNode->idx,messageType,messageLength,aggregation_prime,aggregation_level); - - if (messageType == 0) { //PBCH + + if (messageType == NR_POLAR_PBCH_MESSAGE_TYPE) { newPolarInitNode->n_max = NR_POLAR_PBCH_N_MAX; newPolarInitNode->i_il = NR_POLAR_PBCH_I_IL; newPolarInitNode->i_seg = NR_POLAR_PBCH_I_SEG; @@ -135,9 +133,10 @@ t_nrPolar_params * nr_polar_params(int8_t messageType, newPolarInitNode->payloadBits = NR_POLAR_PBCH_PAYLOAD_BITS; newPolarInitNode->encoderLength = NR_POLAR_PBCH_E; newPolarInitNode->crcCorrectionBits = NR_POLAR_PBCH_CRC_ERROR_CORRECTION_BITS; - newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits);//G_P + newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits); // G_P //printf("Initializing polar parameters for PBCH (K %d, E %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength); - } else if (messageType == 1) { //DCI + + } else if (messageType == NR_POLAR_DCI_MESSAGE_TYPE) { newPolarInitNode->n_max = NR_POLAR_DCI_N_MAX; newPolarInitNode->i_il = NR_POLAR_DCI_I_IL; newPolarInitNode->i_seg = NR_POLAR_DCI_I_SEG; @@ -146,40 +145,55 @@ t_nrPolar_params * nr_polar_params(int8_t messageType, newPolarInitNode->i_bil = NR_POLAR_DCI_I_BIL; newPolarInitNode->crcParityBits = NR_POLAR_DCI_CRC_PARITY_BITS; newPolarInitNode->payloadBits = messageLength; - newPolarInitNode->encoderLength = aggregation_level*108; + newPolarInitNode->encoderLength = aggregation_level * 108; newPolarInitNode->crcCorrectionBits = NR_POLAR_DCI_CRC_ERROR_CORRECTION_BITS; - newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P + newPolarInitNode->crc_generator_matrix = crc24c_generator_matrix(newPolarInitNode->payloadBits + newPolarInitNode->crcParityBits); // G_P //printf("Initializing polar parameters for DCI (K %d, E %d, L %d)\n",newPolarInitNode->payloadBits,newPolarInitNode->encoderLength,aggregation_level); - } else if (messageType == 2) { //UCI PUCCH2 - AssertFatal(aggregation_level>2,"Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n",aggregation_level); - AssertFatal(messageLength>11,"Message length %d is too short for polar encoding of UCI\n",messageLength); - newPolarInitNode->n_max = NR_POLAR_PUCCH_N_MAX; - newPolarInitNode->i_il = NR_POLAR_PUCCH_I_IL; + + } else if (messageType == NR_POLAR_UCI_PUCCH_MESSAGE_TYPE) { + AssertFatal(aggregation_level > 2, "Aggregation level (%d) for PUCCH 2 encoding is NPRB and should be > 2\n", aggregation_level); + AssertFatal(messageLength > 11, "Message length %d is too short for polar encoding of UCI\n", messageLength); + + // TS 38.212 - Section 6.3.1.2.1 UCI encoded by Polar code + int L = 0; + if (messageLength >= 12 && messageLength <= 19) { + L = 6; + } else if (messageLength >= 20) { + L = 11; + } else { + AssertFatal(1 == 0, "L = %i is an invalid value\n", L); + } newPolarInitNode->encoderLength = aggregation_level * 16; - newPolarInitNode->i_seg = 0; - - if ((messageLength >= 360 && newPolarInitNode->encoderLength >= 1088)|| - (messageLength >= 1013)) newPolarInitNode->i_seg = 1; - - newPolarInitNode->crcParityBits = 11; - newPolarInitNode->n_pc = 0; - newPolarInitNode->n_pc_wm = 0; - - if (messageLength < 20) { - newPolarInitNode->crcParityBits = 6; - newPolarInitNode->n_pc = 3; - if ((newPolarInitNode->encoderLength - messageLength - 6 + 3) < 193) newPolarInitNode->n_pc_wm = 1; + if ((messageLength >= 360 && newPolarInitNode->encoderLength >= 1088) || (messageLength >= 1013)) { + newPolarInitNode->i_seg = 1; + AssertFatal(1 == 0, "Segmentation is not supported yet (i_seg = %i)\n", newPolarInitNode->i_seg); } - + // TS 38.212 - Section 6.3.1.3.1 UCI encoded by Polar code + newPolarInitNode->n_max = NR_POLAR_PUCCH_N_MAX; + newPolarInitNode->i_il = NR_POLAR_PUCCH_I_IL; + newPolarInitNode->crcParityBits = L; + int Kr = messageLength + L; + if (Kr >= 18 && Kr <= 25) { + newPolarInitNode->n_pc = 3; + if ((newPolarInitNode->encoderLength - Kr + 3) > 192) { + newPolarInitNode->n_pc_wm = 1; + } else { + newPolarInitNode->n_pc_wm = 0; + } + } else if (Kr > 30) { + newPolarInitNode->n_pc = 0; + newPolarInitNode->n_pc_wm = 0; + } else { + AssertFatal(1 == 0, "Kr = %i is an invalid value\n", Kr); + } newPolarInitNode->i_bil = NR_POLAR_PUCCH_I_BIL; - newPolarInitNode->payloadBits = messageLength; newPolarInitNode->crcCorrectionBits = NR_POLAR_PUCCH_CRC_ERROR_CORRECTION_BITS; - //newPolarInitNode->crc_generator_matrix=crc24c_generator_matrix(newPolarInitNode->payloadBits+newPolarInitNode->crcParityBits);//G_P //LOG_D(PHY,"New polar node, encoderLength %d, aggregation_level %d\n",newPolarInitNode->encoderLength,aggregation_level); + } else { AssertFatal(1 == 0, "[nr_polar_init] Incorrect Message Type(%d)", messageType); } diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 36561b110c..3d5268b363 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -706,23 +706,24 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) pusch->rxdataF_comp = (int32_t **)malloc16(n_buf * sizeof(int32_t *)); pusch->ul_ch_mag0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *)); pusch->ul_ch_magb0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *)); + pusch->ul_ch_magc0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *)); pusch->ul_ch_mag = (int32_t **)malloc16(n_buf * sizeof(int32_t *)); pusch->ul_ch_magb = (int32_t **)malloc16(n_buf * sizeof(int32_t *)); + pusch->ul_ch_magc = (int32_t **)malloc16(n_buf * sizeof(int32_t *)); pusch->rho = (int32_t ***)malloc16(Prx * sizeof(int32_t **)); pusch->llr_layers = (int16_t **)malloc16(max_ul_mimo_layers * sizeof(int32_t *)); - - for (i=0; irxdataF_ext[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); pusch->rho[i] = (int32_t **)malloc16_clear(NR_MAX_NB_LAYERS * NR_MAX_NB_LAYERS * sizeof(int32_t *)); - for (int j=0; j< max_ul_mimo_layers; j++) { - for (int k=0; krho[i][j * max_ul_mimo_layers + k] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); } } } - for (i=0; iul_ch_estimates[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->ofdm_symbol_size * fp->symbols_per_slot); pusch->ul_ch_estimates_ext[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); pusch->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->ofdm_symbol_size); @@ -730,8 +731,10 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) pusch->rxdataF_comp[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); pusch->ul_ch_mag0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); pusch->ul_ch_magb0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); + pusch->ul_ch_magc0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); pusch->ul_ch_mag[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); pusch->ul_ch_magb[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); + pusch->ul_ch_magc[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot); } for (i=0; i< max_ul_mimo_layers; i++) { @@ -753,7 +756,9 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) const int Prx = gNB->gNB_config.carrier_config.num_rx_ant.value; const int max_ul_mimo_layers = 4; // taken from phy_init_nr_gNB() const int n_buf = Prx * max_ul_mimo_layers; - + PHY_MEASUREMENTS_gNB *meas=&gNB->measurements; + free_and_zero(meas->n0_subband_power); + free_and_zero(meas->n0_subband_power_dB); int max_dl_mimo_layers =(fp->nb_antennas_txnb_antennas_tx : NR_MAX_NB_LAYERS; if (fp->nb_antennas_tx>1) { for (int nl = 0; nl < max_dl_mimo_layers; nl++) { @@ -867,8 +872,10 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(pusch_vars->rxdataF_comp[i]); free_and_zero(pusch_vars->ul_ch_mag0[i]); free_and_zero(pusch_vars->ul_ch_magb0[i]); + free_and_zero(pusch_vars->ul_ch_magc0[i]); free_and_zero(pusch_vars->ul_ch_mag[i]); free_and_zero(pusch_vars->ul_ch_magb[i]); + free_and_zero(pusch_vars->ul_ch_magc[i]); } free_and_zero(pusch_vars->llr_layers); free_and_zero(pusch_vars->rxdataF_ext); @@ -880,8 +887,10 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(pusch_vars->rxdataF_comp); free_and_zero(pusch_vars->ul_ch_mag0); free_and_zero(pusch_vars->ul_ch_magb0); + free_and_zero(pusch_vars->ul_ch_magc0); free_and_zero(pusch_vars->ul_ch_mag); free_and_zero(pusch_vars->ul_ch_magb); + free_and_zero(pusch_vars->ul_ch_magc); free_and_zero(pusch_vars->rho); free_and_zero(pusch_vars->llr); @@ -954,7 +963,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, } fp->threequarter_fs = 0; - gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band); + int bw_index = get_supported_band_index(mu, fp->nr_band, N_RB_DL); + gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(fp->nr_band > 256 ? FR2 : FR1, bw_index); nr_init_frame_parms(gNB_config, fp); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 65d3f86f7a..6c65f6a803 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -234,9 +234,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) ue->bitrate[gNB_id] = 0; ue->total_received_bits[gNB_id] = 0; - ue->ul_time_alignment[gNB_id].apply_ta = 0; - ue->ul_time_alignment[gNB_id].ta_frame = -1; - ue->ul_time_alignment[gNB_id].ta_slot = -1; } // init NR modulation lookup tables nr_generate_modulation_table(); @@ -691,6 +688,8 @@ void init_N_TA_offset(PHY_VARS_NR_UE *ue){ } ue->N_TA_offset = (int)(N_TA_offset * factor); + ue->ta_frame = -1; + ue->ta_slot = -1; LOG_I(PHY,"UE %d Setting N_TA_offset to %d samples (factor %f, UL Freq %lu, N_RB %d, mu %d)\n", ue->Mod_id, ue->N_TA_offset, factor, fp->ul_CarrierFreq, fp->N_RB_DL, fp->numerology_index); } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index 6735e251ba..68d7b87984 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -1024,7 +1024,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue, #elif defined(__arm__) || defined(__aarch64__) int16x8_t *dl_ch0_128, *dl_ch1_128; #endif - int *dl_ch0,*dl_ch1; + int *dl_ch0=NULL,*dl_ch1=NULL; LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; int nb_subbands,subband_size,last_subband_size; diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c index 0addfdf14c..19686eec6f 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c @@ -352,16 +352,16 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t if (ra_header==0) { for (i=16; i>0; i--) { - if ((rb_alloc&(1<>5] |= (7<<((3*(16-i))%32)); + if ((rb_alloc & (1 << i)) != 0) + rb_alloc2[(3 * (16 - i)) >> 5] |= (7U << ((3 * (16 - i)) % 32)); } // bit mask across if ((rb_alloc2[0]>>31)==1) - rb_alloc2[1] |= 1; + rb_alloc2[1] |= 1; if ((rb_alloc&1) != 0) - rb_alloc2[1] |= (3<<16); + rb_alloc2[1] |= (3 << 16); } else { LOG_W(PHY,"resource type 1 not supported for N_RB_DL=50\n"); @@ -371,10 +371,10 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t case 100: if (ra_header==0) { for (i=0; i<25; i++) { - if ((rb_alloc&(1<<(24-i))) != 0) - rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32)); + if ((rb_alloc & (1 << (24 - i))) != 0) + rb_alloc2[(4 * i) >> 5] |= (0xfU << ((4 * i) % 32)); - // printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<tdd_config); - ret=255; + LOG_E(PHY, "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n", subframe, frame_parms->tdd_config); + ret = 255; } else ret = (subframe/7); break; @@ -996,8 +996,7 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t } } - AssertFatal(ret!=255, - "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frame, subframe); + AssertFatal(ret != 255, "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frame, subframe); return ret; } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 4b1cf2cbee..35408c28d5 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -840,16 +840,16 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB, (((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4)| (((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6); - txF0[0]=qam_table16_0[qam16_table_offset]; - txF1[0]=qam_table16_1[qam16_table_offset]; + memcpy(txF0, &qam_table16_0[qam16_table_offset], sizeof(*txF0)); + memcpy(txF1, &qam_table16_1[qam16_table_offset], sizeof(*txF1)); x0p+=8; qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))| (((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) | (((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) | (((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6); - txF0[1]=qam_table16_0[qam16_table_offset]; - txF1[1]=qam_table16_1[qam16_table_offset]; + memcpy(txF0 + 1, &qam_table16_0[qam16_table_offset], sizeof(*txF0)); + memcpy(txF1 + 1, &qam_table16_1[qam16_table_offset], sizeof(*txF1)); x0p+=8; qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))| @@ -857,8 +857,8 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB, (((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) | (((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6); - txF0[2]=qam_table16_0[qam16_table_offset]; - txF1[2]=qam_table16_1[qam16_table_offset]; + memcpy(txF0 + 2, &qam_table16_0[qam16_table_offset], sizeof(*txF0)); + memcpy(txF1 + 2, &qam_table16_1[qam16_table_offset], sizeof(*txF1)); if(skip_half==0) { if (skip_dc>0) { @@ -872,23 +872,23 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB, (((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) | (((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6); - txF0[3]=qam_table16_0[qam16_table_offset]; - txF1[3]=qam_table16_1[qam16_table_offset]; + memcpy(txF0 + 3, &qam_table16_0[qam16_table_offset], sizeof(*txF0)); + memcpy(txF1 + 3, &qam_table16_1[qam16_table_offset], sizeof(*txF1)); x0p+=8; qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))| (((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) | (((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) | (((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6); - txF0[4]=qam_table16_0[qam16_table_offset]; - txF1[4]=qam_table16_1[qam16_table_offset]; + memcpy(txF0 + 4, &qam_table16_0[qam16_table_offset], sizeof(*txF0)); + memcpy(txF1 + 4, &qam_table16_1[qam16_table_offset], sizeof(*txF1)); x0p+=8; qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))| (((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) | (((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) | (((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6); - txF0[5]=qam_table16_0[qam16_table_offset]; - txF1[5]=qam_table16_1[qam16_table_offset]; + memcpy(txF0 + 5, &qam_table16_0[qam16_table_offset], sizeof(*txF0)); + memcpy(txF1 + 5, &qam_table16_1[qam16_table_offset], sizeof(*txF1)); } if(skip_half!=0) { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 9e646bd793..54633fbc18 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -4706,7 +4706,8 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF, } if (rb_alloc_ind==1) { - *pmi_ext = (pmi>>((rb>>2)<<1))&3; + uint32_t tmp = (rb >> 2) << 1; + *pmi_ext = tmp >= 16 ? 0 : (pmi >> tmp) & 3; memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); /* diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index bf2466d2f2..a26a1d0574 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -146,7 +146,19 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements; int rb, nb_symb[275]={0}; - memset(measurements->n0_subband_power, 0, sizeof(measurements->n0_subband_power)); + allocCast2D(n0_subband_power, + unsigned int, + gNB->measurements.n0_subband_power, + frame_parms->nb_antennas_rx, + frame_parms->N_RB_UL, + false); + clearArray(gNB->measurements.n0_subband_power, unsigned int); + allocCast2D(n0_subband_power_dB, + unsigned int, + gNB->measurements.n0_subband_power_dB, + frame_parms->nb_antennas_rx, + frame_parms->N_RB_UL, + false); for (int s=first_symb;s<(first_symb+num_symb);s++) { int offset0 = ((slot&3)*frame_parms->symbols_per_slot + s) * frame_parms->ofdm_symbol_size; @@ -166,7 +178,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb } else { signal_energy = signal_energy_nodc(ul_ch, 12); } - measurements->n0_subband_power[aarx][rb] += signal_energy; + n0_subband_power[aarx][rb] += signal_energy; LOG_D(PHY,"slot %d symbol %d RB %d aarx %d n0_subband_power %d\n", slot, s, rb, aarx, signal_energy); } //antenna } @@ -182,10 +194,10 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb int32_t n0_subband_tot_perPRB=0; if (nb_symb[rb] > 0) { for (int aarx=0;aarxnb_antennas_rx;aarx++) { - measurements->n0_subband_power[aarx][rb]/=nb_symb[rb]; - measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]); - n0_subband_tot_perPRB+=measurements->n0_subband_power[aarx][rb]; - n0_subband_tot_perANT[aarx]+=measurements->n0_subband_power[aarx][rb]; + n0_subband_power[aarx][rb] /= nb_symb[rb]; + n0_subband_power_dB[aarx][rb] = dB_fixed(n0_subband_power[aarx][rb]); + n0_subband_tot_perPRB += n0_subband_power[aarx][rb]; + n0_subband_tot_perANT[aarx] += n0_subband_power[aarx][rb]; } n0_subband_tot_perPRB/=frame_parms->nb_antennas_rx; measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_subband_tot_perPRB); @@ -218,30 +230,31 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, unsigned short rx_power_avg_dB; unsigned short rx_power_tot_dB; - double rx_gain = openair0_cfg[0].rx_gain[0]; - double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; + double rx_gain = openair0_cfg[0].rx_gain[0]; + double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; PHY_MEASUREMENTS_gNB *meas = &gNB->measurements; - NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; - int ch_offset = fp->ofdm_symbol_size * symbol; + NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; + int ch_offset = fp->ofdm_symbol_size * symbol; int N_RB_UL = ulsch->harq_process->ulsch_pdu.rb_size; ulsch_measurements_gNB *ulsch_measurements = &ulsch->ulsch_measurements; int rx_power[fp->nb_antennas_rx]; + allocCast2D(rx_spatial_power, int, ulsch_measurements->rx_spatial_power, nrOfLayers, fp->nb_antennas_rx, true); + allocCast2D(rx_spatial_power_dB, unsigned short, ulsch_measurements->rx_spatial_power_dB, nrOfLayers, fp->nb_antennas_rx, true); for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){ rx_power[aarx] = 0; for (int aatx = 0; aatx < nrOfLayers; aatx++){ - ulsch_measurements->rx_spatial_power[aatx][aarx] = + rx_spatial_power[aatx][aarx] = (signal_energy_nodc(&pusch_vars->ul_ch_estimates[aatx * fp->nb_antennas_rx + aarx][ch_offset], N_RB_UL * NR_NB_SC_PER_RB)); - if (ulsch_measurements->rx_spatial_power[aatx][aarx] < 0) { - ulsch_measurements->rx_spatial_power[aatx][aarx] = 0; + if (rx_spatial_power[aatx][aarx] < 0) { + rx_spatial_power[aatx][aarx] = 0; } - ulsch_measurements->rx_spatial_power_dB[aatx][aarx] = - (unsigned short)dB_fixed(ulsch_measurements->rx_spatial_power[aatx][aarx]); - rx_power[aarx] += ulsch_measurements->rx_spatial_power[aatx][aarx]; + rx_spatial_power_dB[aatx][aarx] = (unsigned short)dB_fixed(rx_spatial_power[aatx][aarx]); + rx_power[aarx] += rx_spatial_power[aatx][aarx]; } LOG_D(PHY, "[RNTI %04x] RX power in antenna %d = %d\n", ulsch->rnti, aarx, rx_power[aarx]); diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.h b/openair1/PHY/NR_REFSIG/dmrs_nr.h index 4611e363e5..8b9da28abc 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.h +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.h @@ -72,7 +72,11 @@ void nr_chest_time_domain_avg(NR_DL_FRAME_PARMS *frame_parms, uint16_t dmrs_bitmap, uint16_t num_rbs); -static inline uint8_t is_dmrs_symbol(uint8_t l, uint16_t dmrsSymbMask ) { return ((dmrsSymbMask >> l) & 0x1); } +static inline uint8_t is_dmrs_symbol(uint8_t l, uint16_t dmrsSymbMask) +{ + DevAssert(l < 32); + return ((dmrsSymbMask >> l) & 0x1); +} #undef EXTERN #endif /* DMRS_NR_H */ diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c index 5df4a25656..d941543821 100644 --- a/openair1/PHY/NR_REFSIG/ptrs_nr.c +++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c @@ -373,7 +373,7 @@ int8_t nr_ptrs_process_slot(uint16_t dmrsSymbPos, } /* check for left side first */ /* right side a DMRS symbol then we need to left extrapolate */ - if(is_dmrs_symbol(rightRef,dmrsSymbPos)) { + if (rightRef != -1 && is_dmrs_symbol(rightRef, dmrsSymbPos)) { /* calculate slope from next valid estimates*/ tmp = get_next_estimate_in_slot(ptrsSymbPos,dmrsSymbPos,rightRef+1,symbInSlot); /* Special case when DMRS is not followed by PTRS symbol then reuse old slope */ @@ -382,22 +382,19 @@ int8_t nr_ptrs_process_slot(uint16_t dmrsSymbPos, } ptrs_estimate_from_slope(estPerSymb,slope_p,leftRef, rightRef); symb = rightRef -1; - } - else if(is_ptrs_symbol(rightRef,ptrsSymbPos)) { + } else if (rightRef != -1 && is_ptrs_symbol(rightRef, ptrsSymbPos)) { /* calculate slope from next valid estimates */ get_slope_from_estimates(leftRef,rightRef,estPerSymb, slope_p); ptrs_estimate_from_slope(estPerSymb,slope_p,leftRef, rightRef); symb = rightRef -1; - } - else if((rightRef ==-1) && (symb ofdm_symbol_size+start_sc)<<1)]; + __m128i *txF = (__m128i *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc) << 1)]; - __m64 *txl = (__m64*)&tx_layers[nl][m<<1]; - __m64 amp64=_mm_set1_pi16(amp); - for (int i=0; i<(upper_limit>>1); i++) { - - txF[i] = _mm_mulhrs_pi16(amp64,txl[i]); + __m128i *txl = (__m128i *)&tx_layers[nl][m << 1]; + __m128i amp64 = _mm_set1_epi16(amp); + int i; + for (i = 0; i < (upper_limit >> 2); i++) { + const __m128i txL = _mm_loadu_si128(txl + i); + _mm_storeu_si128(txF + i, _mm_mulhrs_epi16(amp64, txL)); #ifdef DEBUG_DLSCH_MAPPING if ((i&1) > 0) - printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, start_sc+(i>>1), txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1)], - txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1) + 1]); + printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", + m, + l, + start_sc + (i >> 1), + txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc + (i >> 1)) << 1)], + txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc + (i >> 1)) << 1) + 1]); #endif /* handle this, mute RE */ /*else { txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; txdataF_precoding[anl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; - }*/ - } //RE loop, first part + }*/ + } + if (i * 4 != upper_limit) { + c16_t *txFc = (c16_t *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc) << 1)]; + c16_t *txlc = (c16_t *)&tx_layers[nl][m << 1]; + for (i = (upper_limit >> 2) << 2; i < upper_limit; i++) { + txFc[i].r = ((txlc[i].r * amp) >> 14) + 1; + txFc[i].i = ((txlc[i].i * amp) >> 14) + 1; + } + } m+=upper_limit; if (remaining_re > 0) { - txF = (__m64*)&txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size)<<1)]; - txl = (__m64*)&tx_layers[nl][m<<1]; - for (int i=0; i<(remaining_re>>1); i++) { - txF[i] = _mm_mulhrs_pi16(amp64,txl[i]); + txF = (__m128i *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size) << 1)]; + txl = (__m128i *)&tx_layers[nl][m << 1]; + int i; + for (i = 0; i < (remaining_re >> 2); i++) { + const __m128i txL = _mm_loadu_si128(txl + i); + _mm_storeu_si128(txF + i, _mm_mulhrs_epi16(amp64, txL)); #ifdef DEBUG_DLSCH_MAPPING - if ((i&1) > 0) - printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, i>>1, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) ], - txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) + 1]); + if ((i & 1) > 0) + printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", + m, + l, + i >> 1, + txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + (i >> 1)) << 1)], + txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + (i >> 1)) << 1) + 1]); #endif - /* handle this, mute RE */ - /*else { - txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; - txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; - }*/ - } //RE loop, second part + /* handle this, mute RE */ + /*else { + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0; + txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0; + }*/ + } // RE loop, second part + if (i * 4 != remaining_re) { + c16_t *txFc = (c16_t *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size) << 1)]; + c16_t *txlc = (c16_t *)&tx_layers[nl][m << 1]; + for (i = (remaining_re >> 2) << 2; i < remaining_re; i++) { + txFc[i].r = ((txlc[i].r * amp) >> 14) + 1; + txFc[i].i = ((txlc[i].i * amp) >> 14) + 1; + } + } } // m+=remaining_re; } // N_RB_DL even diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index cb7cd35516..0509ce7acf 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -176,8 +176,9 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext, /** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation) @param rxdataF_ext Frequency-domain received signal in RBs to be demodulated @param ul_ch_estimates_ext Frequency-domain channel estimates in RBs to be demodulated - @param ul_ch_mag First Channel magnitudes (16QAM/64QAM) - @param ul_ch_magb Second weighted Channel magnitudes (64QAM) + @param ul_ch_mag First Channel magnitudes (16QAM/64QAM/256QAM) + @param ul_ch_magb Second weighted Channel magnitudes (64QAM/256QAM) + @param ul_ch_magc Third weighted Channel magnitudes (256QAM) @param rxdataF_comp Compensated received waveform @param frame_parms Pointer to frame descriptor @param symbol Symbol on which to operate @@ -189,6 +190,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, int **ul_ch_estimates_ext, int **ul_ch_mag, int **ul_ch_magb, + int **ul_ch_magc, int **rxdataF_comp, int ***rho, NR_DL_FRAME_PARMS *frame_parms, @@ -250,6 +252,23 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp, uint32_t nb_re, uint8_t symbol); +/** \brief This function generates log-likelihood ratios (decoder input) for single-stream 256 QAM received waveforms. + @param rxdataF_comp Compensated channel output + @param ul_ch_mag uplink channel magnitude multiplied by the 1st amplitude threshold in QAM 256 + @param ul_ch_magb uplink channel magnitude multiplied by the 2bd amplitude threshold in QAM 256 + @param ul_ch_magc uplink channel magnitude multiplied by the 3rd amplitude threshold in QAM 256 + @param ulsch_llr llr output + @param nb_re number of REs for this allocation + @param symbol OFDM symbol index in sub-frame +*/ +void nr_ulsch_256qam_llr(int32_t *rxdataF_comp, + int32_t **ul_ch_mag, + int32_t **ul_ch_magb, + int32_t **ul_ch_magc, + int16_t *ulsch_llr, + uint32_t nb_rb, + uint32_t nb_re, + uint8_t symbol); /** \brief This function computes the log-likelihood ratios for 4, 16, and 64 QAM @param rxdataF_comp Compensated channel output @@ -263,6 +282,7 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp, void nr_ulsch_compute_llr(int32_t *rxdataF_comp, int32_t *ul_ch_mag, int32_t *ul_ch_magb, + int32_t *ul_ch_magc, int16_t *ulsch_llr, uint32_t nb_rb, uint32_t nb_re, diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c index e7863d3820..352967c7f5 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c @@ -88,8 +88,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_pusch_pdu_t harq->round++; memcpy(&ulsch->harq_process->ulsch_pdu, ulsch_pdu, sizeof(ulsch->harq_process->ulsch_pdu)); - - LOG_D(PHY, "Initializing nFAPI for ULSCH, harq_pid %d\n", harq_pid); + LOG_D(PHY, "Initializing nFAPI for ULSCH, harq_pid %d, layers %d\n", harq_pid, ulsch_pdu->nrOfLayers); } void reset_active_ulsch(PHY_VARS_gNB *gNB, int frame) diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 410ffc89d5..bcd73c58a9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -93,7 +93,7 @@ NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL) } uint32_t ulsch_bytes = a_segments * 1056; // allocated bytes per segment - NR_gNB_ULSCH_t ulsch; + NR_gNB_ULSCH_t ulsch = {0}; ulsch.max_ldpc_iterations = max_ldpc_iterations; ulsch.harq_pid = -1; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index bb213c595b..8cf4226922 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -568,6 +568,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, int **ul_ch_estimates_ext, int **ul_ch_mag, int **ul_ch_magb, + int **ul_ch_magc, int **rxdataF_comp, int ***rho, NR_DL_FRAME_PARMS *frame_parms, @@ -625,8 +626,8 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, unsigned short rb; unsigned char aatx,aarx; - __m128i *ul_ch128,*ul_ch128_2,*ul_ch_mag128,*ul_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128; - __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128={0},QAM_amp128b={0}; + __m128i *ul_ch128,*ul_ch128_2,*ul_ch_mag128,*ul_ch_mag128b,*ul_ch_mag128c,*rxdataF128,*rxdataF_comp128,*rho128; + __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128={0},QAM_amp128b={0},QAM_amp128c={0}; QAM_amp128b = _mm_setzero_si128(); uint32_t nb_rb_0 = length/12 + ((length%12)?1:0); @@ -634,10 +635,17 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, if (mod_order == 4) { QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) QAM_amp128b = _mm_setzero_si128(); + QAM_amp128c = _mm_setzero_si128(); } else if (mod_order == 6) { QAM_amp128 = _mm_set1_epi16(QAM64_n1); // QAM_amp128b = _mm_set1_epi16(QAM64_n2); + QAM_amp128c = _mm_setzero_si128(); + } + else if (mod_order == 8) { + QAM_amp128 = _mm_set1_epi16(QAM256_n1); // + QAM_amp128b = _mm_set1_epi16(QAM256_n2); + QAM_amp128c = _mm_set1_epi16(QAM256_n3); } // printf("comp: rxdataF_comp %p, symbol %d\n",rxdataF_comp[0],symbol); @@ -646,6 +654,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*12))]; ul_ch_mag128 = (__m128i *)&ul_ch_mag[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*12))]; ul_ch_mag128b = (__m128i *)&ul_ch_magb[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*12))]; + ul_ch_mag128c = (__m128i *)&ul_ch_magc[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*12))]; rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*(off+(nb_rb*12))]; rxdataF_comp128 = (__m128i *)&rxdataF_comp[aatx*frame_parms->nb_antennas_rx+aarx][symbol*(off+(nb_rb*12))]; @@ -668,37 +677,32 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, ul_ch_mag128[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0); ul_ch_mag128b[0] = ul_ch_mag128[0]; - ul_ch_mag128[0] = _mm_mulhi_epi16(ul_ch_mag128[0],QAM_amp128); - ul_ch_mag128[0] = _mm_slli_epi16(ul_ch_mag128[0],1); - - ul_ch_mag128b[0] = _mm_mulhi_epi16(ul_ch_mag128b[0],QAM_amp128b); - ul_ch_mag128b[0] = _mm_slli_epi16(ul_ch_mag128b[0],1); + ul_ch_mag128c[0] = ul_ch_mag128[0]; + ul_ch_mag128[0] = _mm_mulhrs_epi16(ul_ch_mag128[0],QAM_amp128); + ul_ch_mag128b[0] = _mm_mulhrs_epi16(ul_ch_mag128b[0],QAM_amp128b); + ul_ch_mag128c[0] = _mm_mulhrs_epi16(ul_ch_mag128c[0],QAM_amp128c); // print_ints("ch: = ",(int32_t*)&mmtmpD0); // print_shorts("QAM_amp:",(int16_t*)&QAM_amp128); // print_shorts("mag:",(int16_t*)&ul_ch_mag128[0]); - ul_ch_mag128[1] = _mm_unpackhi_epi16(mmtmpD0,mmtmpD0); + ul_ch_mag128[1] = _mm_unpackhi_epi16(mmtmpD0,mmtmpD0); ul_ch_mag128b[1] = ul_ch_mag128[1]; - ul_ch_mag128[1] = _mm_mulhi_epi16(ul_ch_mag128[1],QAM_amp128); - ul_ch_mag128[1] = _mm_slli_epi16(ul_ch_mag128[1],1); - - ul_ch_mag128b[1] = _mm_mulhi_epi16(ul_ch_mag128b[1],QAM_amp128b); - ul_ch_mag128b[1] = _mm_slli_epi16(ul_ch_mag128b[1],1); + ul_ch_mag128c[1] = ul_ch_mag128[1]; + ul_ch_mag128[1] = _mm_mulhrs_epi16(ul_ch_mag128[1],QAM_amp128); + ul_ch_mag128b[1] = _mm_mulhrs_epi16(ul_ch_mag128b[1],QAM_amp128b); + ul_ch_mag128c[1] = _mm_mulhrs_epi16(ul_ch_mag128c[1],QAM_amp128c); mmtmpD0 = _mm_madd_epi16(ul_ch128[2],ul_ch128[2]); mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); mmtmpD1 = _mm_packs_epi32(mmtmpD0,mmtmpD0); - ul_ch_mag128[2] = _mm_unpacklo_epi16(mmtmpD1,mmtmpD1); + ul_ch_mag128[2] = _mm_unpacklo_epi16(mmtmpD1,mmtmpD1); ul_ch_mag128b[2] = ul_ch_mag128[2]; + ul_ch_mag128c[2] = ul_ch_mag128[2]; - ul_ch_mag128[2] = _mm_mulhi_epi16(ul_ch_mag128[2],QAM_amp128); - ul_ch_mag128[2] = _mm_slli_epi16(ul_ch_mag128[2],1); - - - ul_ch_mag128b[2] = _mm_mulhi_epi16(ul_ch_mag128b[2],QAM_amp128b); - ul_ch_mag128b[2] = _mm_slli_epi16(ul_ch_mag128b[2],1); - + ul_ch_mag128[2] = _mm_mulhrs_epi16(ul_ch_mag128[2],QAM_amp128); + ul_ch_mag128b[2] = _mm_mulhrs_epi16(ul_ch_mag128b[2],QAM_amp128b); + ul_ch_mag128c[2] = _mm_mulhrs_epi16(ul_ch_mag128c[2],QAM_amp128c); } // Multiply received data by conjugated channel @@ -709,6 +713,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, ul_ch128 += 3; ul_ch_mag128 += 3; ul_ch_mag128b += 3; + ul_ch_mag128c += 3; rxdataF128 += 3; rxdataF_comp128 += 3; } @@ -1075,6 +1080,7 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp, int32_t **ul_ch_mag, int32_t **ul_ch_magb, + int32_t **ul_ch_magc, int32_t ***rho, uint8_t nrOfLayers, uint8_t symbol, @@ -1082,7 +1088,7 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, int length) { int n_rx = frame_parms->nb_antennas_rx; #if defined(__x86_64__) || defined(__i386__) - __m128i *rxdataF_comp128[2],*ul_ch_mag128[2],*ul_ch_mag128b[2]; + __m128i *rxdataF_comp128[2],*ul_ch_mag128[2],*ul_ch_mag128b[2],*ul_ch_mag128c[2]; #elif defined(__arm__) || defined(__aarch64__) int16x8_t *rxdataF_comp128_0,*ul_ch_mag128_0,*ul_ch_mag128_0b; int16x8_t *rxdataF_comp128_1,*ul_ch_mag128_1,*ul_ch_mag128_1b; @@ -1100,17 +1106,20 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms, rxdataF_comp128[0] = (__m128i *)&rxdataF_comp[aatx*frame_parms->nb_antennas_rx][(symbol*(nb_re + off))]; ul_ch_mag128[0] = (__m128i *)&ul_ch_mag[aatx*frame_parms->nb_antennas_rx][(symbol*(nb_re + off))]; ul_ch_mag128b[0] = (__m128i *)&ul_ch_magb[aatx*frame_parms->nb_antennas_rx][(symbol*(nb_re + off))]; + ul_ch_mag128c[0] = (__m128i *)&ul_ch_magc[aatx*frame_parms->nb_antennas_rx][(symbol*(nb_re + off))]; for (int aa=1;aa < n_rx;aa++) { rxdataF_comp128[1] = (__m128i *)&rxdataF_comp[aatx*frame_parms->nb_antennas_rx+aa][(symbol*(nb_re + off))]; ul_ch_mag128[1] = (__m128i *)&ul_ch_mag[aatx*frame_parms->nb_antennas_rx+aa][(symbol*(nb_re + off))]; ul_ch_mag128b[1] = (__m128i *)&ul_ch_magb[aatx*frame_parms->nb_antennas_rx+aa][(symbol*(nb_re + off))]; + ul_ch_mag128c[1] = (__m128i *)&ul_ch_magc[aatx*frame_parms->nb_antennas_rx+aa][(symbol*(nb_re + off))]; // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation) for (i=0; i2) { + if (mod_order > 2) { if (mod_order == 4) { - QAM_amp128 = _mm_set1_epi16(QAM16_n1); //2/sqrt(10) + QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) QAM_amp128b = _mm_setzero_si128(); + QAM_amp128c = _mm_setzero_si128(); } else if (mod_order == 6) { - QAM_amp128 = _mm_set1_epi16(QAM64_n1); //4/sqrt{42} - QAM_amp128b = _mm_set1_epi16(QAM64_n2); //2/sqrt{42} + QAM_amp128 = _mm_set1_epi16(QAM64_n1); // 4/sqrt{42} + QAM_amp128b = _mm_set1_epi16(QAM64_n2); // 2/sqrt{42} + QAM_amp128c = _mm_setzero_si128(); + } else if (mod_order == 8) { + QAM_amp128 = _mm_set1_epi16(QAM256_n1); + QAM_amp128b = _mm_set1_epi16(QAM256_n2); + QAM_amp128c = _mm_set1_epi16(QAM256_n3); } ul_ch_mag128_0 = (__m128i *)&ul_ch_mag[0][symbol * (off + nb_rb * 12)]; ul_ch_mag128b_0 = (__m128i *)&ul_ch_magb[0][symbol * (off + nb_rb * 12)]; + ul_ch_mag128c_0 = (__m128i *)&ul_ch_magc[0][symbol * (off + nb_rb * 12)]; ul_ch_mag128_1 = (__m128i *)&ul_ch_mag[frame_parms->nb_antennas_rx][symbol * (off + nb_rb * 12)]; ul_ch_mag128b_1 = (__m128i *)&ul_ch_magb[frame_parms->nb_antennas_rx][symbol * (off + nb_rb * 12)]; + ul_ch_mag128c_1 = (__m128i *)&ul_ch_magc[frame_parms->nb_antennas_rx][symbol * (off + nb_rb * 12)]; } for (int rb = 0; rb < 3 * nb_rb_0; rb++) { @@ -1790,18 +1808,24 @@ uint8_t nr_ulsch_mmse_2layers(NR_DL_FRAME_PARMS *frame_parms, // Layer 0 ul_ch_mag128_0[0] = mmtmpD2; ul_ch_mag128b_0[0] = mmtmpD2; + ul_ch_mag128c_0[0] = mmtmpD2; ul_ch_mag128_0[0] = _mm_mulhi_epi16(ul_ch_mag128_0[0], QAM_amp128); ul_ch_mag128_0[0] = _mm_slli_epi16(ul_ch_mag128_0[0], 1); ul_ch_mag128b_0[0] = _mm_mulhi_epi16(ul_ch_mag128b_0[0], QAM_amp128b); ul_ch_mag128b_0[0] = _mm_slli_epi16(ul_ch_mag128b_0[0], 1); + ul_ch_mag128c_0[0] = _mm_mulhi_epi16(ul_ch_mag128c_0[0], QAM_amp128c); + ul_ch_mag128c_0[0] = _mm_slli_epi16(ul_ch_mag128c_0[0], 1); // Layer 1 ul_ch_mag128_1[0] = mmtmpD2; ul_ch_mag128b_1[0] = mmtmpD2; + ul_ch_mag128c_1[0] = mmtmpD2; ul_ch_mag128_1[0] = _mm_mulhi_epi16(ul_ch_mag128_1[0], QAM_amp128); ul_ch_mag128_1[0] = _mm_slli_epi16(ul_ch_mag128_1[0], 1); ul_ch_mag128b_1[0] = _mm_mulhi_epi16(ul_ch_mag128b_1[0], QAM_amp128b); ul_ch_mag128b_1[0] = _mm_slli_epi16(ul_ch_mag128b_1[0], 1); + ul_ch_mag128c_1[0] = _mm_mulhi_epi16(ul_ch_mag128c_1[0], QAM_amp128c); + ul_ch_mag128c_1[0] = _mm_slli_epi16(ul_ch_mag128c_1[0], 1); } // multiply by channel Inv @@ -1834,6 +1858,8 @@ uint8_t nr_ulsch_mmse_2layers(NR_DL_FRAME_PARMS *frame_parms, ul_ch_mag128_1 += 1; ul_ch_mag128b_0 += 1; ul_ch_mag128b_1 += 1; + ul_ch_mag128c_0 += 1; + ul_ch_mag128c_1 += 1; rxdataF_comp128_0 += 1; rxdataF_comp128_1 += 1; after_mf_a_128 += 1; @@ -1905,7 +1931,12 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, } nr_gnb_measurements(gNB, ulsch, pusch_vars, symbol, rel15_ul->nrOfLayers); - + allocCast2D(n0_subband_power, + unsigned int, + gNB->measurements.n0_subband_power, + frame_parms->nb_antennas_rx, + frame_parms->N_RB_UL, + false); for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { if (symbol == rel15_ul->start_symbol_index) { pusch_vars->ulsch_power[aarx] = 0; @@ -1918,7 +1949,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, } for (int rb = 0; rb < rel15_ul->rb_size; rb++) { pusch_vars->ulsch_noise_power[aarx] += - gNB->measurements.n0_subband_power[aarx][rel15_ul->bwp_start + rel15_ul->rb_start + rb] / rel15_ul->rb_size; + n0_subband_power[aarx][rel15_ul->bwp_start + rel15_ul->rb_start + rb] / rel15_ul->rb_size; } LOG_D(PHY, "aa %d, bwp_start%d, rb_start %d, rb_size %d: ulsch_power %d, ulsch_noise_power %d\n", @@ -2030,11 +2061,12 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, //--------------------- Channel Compensation --------------- //---------------------------------------------------------- start_meas(&gNB->ulsch_channel_compensation_stats); - LOG_D(PHY, "Doing channel compensations log2_maxh %d, avgs %d (%d,%d)\n", pusch_vars->log2_maxh, avgs, avg[0], avg[1]); + LOG_D(PHY, "Doing channel compensations log2_maxh %d, avgs %d (%d,%d)\n" ,pusch_vars->log2_maxh, avgs,avg[0], avg[1]); nr_ulsch_channel_compensation(pusch_vars->rxdataF_ext, pusch_vars->ul_ch_estimates_ext, pusch_vars->ul_ch_mag0, pusch_vars->ul_ch_magb0, + pusch_vars->ul_ch_magc0, pusch_vars->rxdataF_comp, (rel15_ul->nrOfLayers > 1) ? pusch_vars->rho : NULL, frame_parms, @@ -2052,6 +2084,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, pusch_vars->rxdataF_comp, pusch_vars->ul_ch_mag0, pusch_vars->ul_ch_magb0, + pusch_vars->ul_ch_magc0, (rel15_ul->nrOfLayers > 1) ? pusch_vars->rho : NULL, rel15_ul->nrOfLayers, symbol, @@ -2064,6 +2097,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, pusch_vars->rxdataF_comp, pusch_vars->ul_ch_mag0, pusch_vars->ul_ch_magb0, + pusch_vars->ul_ch_magc0, pusch_vars->ul_ch_estimates_ext, rel15_ul->rb_size, frame_parms->nb_antennas_rx, @@ -2110,15 +2144,15 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, /*-----------------------------------------------------------------------------------------------------*/ start_meas(&gNB->ulsch_llr_stats); for (aatx=0; aatx < rel15_ul->nrOfLayers; aatx++) { - nr_ulsch_compute_llr( - &pusch_vars->rxdataF_comp[aatx * frame_parms->nb_antennas_rx][symbol * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)], - pusch_vars->ul_ch_mag0[aatx * frame_parms->nb_antennas_rx], - pusch_vars->ul_ch_magb0[aatx * frame_parms->nb_antennas_rx], - &pusch_vars->llr_layers[aatx][rxdataF_ext_offset * rel15_ul->qam_mod_order], - rel15_ul->rb_size, - pusch_vars->ul_valid_re_per_slot[symbol], - symbol, - rel15_ul->qam_mod_order); + nr_ulsch_compute_llr(&pusch_vars->rxdataF_comp[aatx*frame_parms->nb_antennas_rx][symbol * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)], + pusch_vars->ul_ch_mag0[aatx*frame_parms->nb_antennas_rx], + pusch_vars->ul_ch_magb0[aatx*frame_parms->nb_antennas_rx], + pusch_vars->ul_ch_magc0[aatx*frame_parms->nb_antennas_rx], + &pusch_vars->llr_layers[aatx][rxdataF_ext_offset * rel15_ul->qam_mod_order], + rel15_ul->rb_size, + pusch_vars->ul_valid_re_per_slot[symbol], + symbol, + rel15_ul->qam_mod_order); } stop_meas(&gNB->ulsch_llr_stats); rxdataF_ext_offset += pusch_vars->ul_valid_re_per_slot[symbol]; diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c index 42fc1820ac..4d4c81a986 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c @@ -352,10 +352,118 @@ void nr_ulsch_64qam_llr(int32_t *rxdataF_comp, #endif } +void nr_ulsch_256qam_llr(int32_t *rxdataF_comp, + int32_t *ul_ch_mag, + int32_t *ul_ch_magb, + int32_t *ul_ch_magc, + int16_t *ulsch_llr, + uint32_t nb_rb, + uint32_t nb_re, + uint8_t symbol) +{ + int off = ((nb_rb&1) == 1)? 4:0; + simde__m256i *rxF = (simde__m256i*)rxdataF_comp; + simde__m256i *ch_mag,*ch_magb,*ch_magc; + register simde__m256i xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6; + simde__m256i *llr256=(simde__m256i*)ulsch_llr; + + ch_mag = (simde__m256i*)&ul_ch_mag[(symbol*(off+(nb_rb*12)))]; + ch_magb = (simde__m256i*)&ul_ch_magb[(symbol*(off+(nb_rb*12)))]; + ch_magc = (simde__m256i*)&ul_ch_magc[(symbol*(off+(nb_rb*12)))]; + int len_mod8 = nb_re&7; + int nb_re256 = nb_re>>3; // length in 256-bit words (8 REs) + + for (int i=0; i |y_R|, registers of odd index in xmm0-> |y_I| + xmm0 = simde_mm256_subs_epi16(ch_mag[i],xmm0); // registers of even index in xmm0-> |y_R|-|h|^2, registers of odd index in xmm0-> |y_I|-|h|^2 + // xmmtmpD2 contains 16 LLRs + xmm1 = simde_mm256_abs_epi16(xmm0); + xmm1 = simde_mm256_subs_epi16(ch_magb[i],xmm1); // contains 16 LLRs + xmm2 = simde_mm256_abs_epi16(xmm1); + xmm2 = simde_mm256_subs_epi16(ch_magc[i],xmm2); // contains 16 LLRs + // rxF[i] A0 A1 A2 A3 A4 A5 A6 A7 bits 7,6 + // xmm0 B0 B1 B2 B3 B4 B5 B6 B7 bits 5,4 + // xmm1 C0 C1 C2 C3 C4 C5 C6 C7 bits 3,2 + // xmm2 D0 D1 D2 D3 D4 D5 D6 D7 bits 1,0 + xmm3 = simde_mm256_unpacklo_epi32(rxF[i],xmm0); // A0 B0 A1 B1 A4 B4 A5 B5 + xmm4 = simde_mm256_unpackhi_epi32(rxF[i],xmm0); // A2 B2 A3 B3 A6 B6 A7 B7 + xmm5 = simde_mm256_unpacklo_epi32(xmm1,xmm2); // C0 D0 C1 D1 C4 D4 C5 D5 + xmm6 = simde_mm256_unpackhi_epi32(xmm1,xmm2); // C2 D2 C3 D3 C6 D6 C7 D7 + + xmm0 = simde_mm256_unpacklo_epi64(xmm3,xmm5); // A0 B0 C0 D0 A4 B4 C4 D4 + xmm1 = simde_mm256_unpackhi_epi64(xmm3,xmm5); // A1 B1 C1 D1 A5 B5 C5 D5 + xmm2 = simde_mm256_unpacklo_epi64(xmm4,xmm6); // A2 B2 C2 D2 A6 B6 C6 D6 + xmm3 = simde_mm256_unpackhi_epi64(xmm4,xmm6); // A3 B3 C3 D3 A7 B7 C7 D7 + llr256[0] = simde_mm256_permute2x128_si256(xmm0, xmm1, 0x20); // A0 B0 C0 D0 A1 B1 C1 D1 + llr256[1] = simde_mm256_permute2x128_si256(xmm2, xmm3, 0x20); // A2 B2 C2 D2 A3 B3 C3 D3 + llr256[2] = simde_mm256_permute2x128_si256(xmm0, xmm1, 0x31); // A4 B4 C4 D4 A5 B5 C5 D5 + llr256[3] = simde_mm256_permute2x128_si256(xmm2, xmm3, 0x31); // A6 B6 C6 D6 A7 B7 C7 D7 + llr256+=4; + + } + simde__m128i *llr128 = (simde__m128i*)llr256; + if (len_mod8 >= 4) { + int nb_re128 = nb_re>>2; + simde__m128i xmm0,xmm1,xmm2,xmm3,xmm4,xmm5,xmm6; + simde__m128i *rxF = (simde__m128i*)rxdataF_comp; + simde__m128i *ch_mag = (simde__m128i*)&ul_ch_mag[(symbol*(off+(nb_rb*12)))]; + simde__m128i *ch_magb = (simde__m128i*)&ul_ch_magb[(symbol*(off+(nb_rb*12)))]; + simde__m128i *ch_magc = (simde__m128i*)&ul_ch_magc[(symbol*(off+(nb_rb*12)))]; + + xmm0 = simde_mm_abs_epi16(rxF[nb_re128-1]); // registers of even index in xmm0-> |y_R|, registers of odd index in xmm0-> |y_I| + xmm0 = simde_mm_subs_epi16(ch_mag[nb_re128-1],xmm0); // registers of even index in xmm0-> |y_R|-|h|^2, registers of odd index in xmm0-> |y_I|-|h|^2 + // xmmtmpD2 contains 8 LLRs + xmm1 = simde_mm_abs_epi16(xmm0); + xmm1 = simde_mm_subs_epi16(ch_magb[nb_re128-1],xmm1); // contains 8 LLRs + xmm2 = simde_mm_abs_epi16(xmm1); + xmm2 = simde_mm_subs_epi16(ch_magc[nb_re128-1],xmm2); // contains 8 LLRs + // rxF[i] A0 A1 A2 A3 + // xmm0 B0 B1 B2 B3 + // xmm1 C0 C1 C2 C3 + // xmm2 D0 D1 D2 D3 + xmm3 = simde_mm_unpacklo_epi32(rxF[nb_re128-1],xmm0); // A0 B0 A1 B1 + xmm4 = simde_mm_unpackhi_epi32(rxF[nb_re128-1],xmm0); // A2 B2 A3 B3 + xmm5 = simde_mm_unpacklo_epi32(xmm1,xmm2); // C0 D0 C1 D1 + xmm6 = simde_mm_unpackhi_epi32(xmm1,xmm2); // C2 D2 C3 D3 + + llr128[0] = simde_mm_unpacklo_epi64(xmm3,xmm5); // A0 B0 C0 D0 + llr128[1] = simde_mm_unpackhi_epi64(xmm3,xmm5); // A1 B1 C1 D1 + llr128[2] = simde_mm_unpacklo_epi64(xmm4,xmm6); // A2 B2 C2 D2 + llr128[3] = simde_mm_unpackhi_epi64(xmm4,xmm6); // A3 B3 C3 D3 + llr128+=4; + } + if (len_mod8 == 6) { + int nb_re64 = nb_re>>1; + simde__m64 *llr64 = (simde__m64 *)llr128; + simde__m64 xmm0,xmm1,xmm2; + simde__m64 *rxF = (simde__m64*)rxdataF_comp; + simde__m64 *ch_mag = (simde__m64*)&ul_ch_mag[(symbol*(off+(nb_rb*12)))]; + simde__m64 *ch_magb = (simde__m64*)&ul_ch_magb[(symbol*(off+(nb_rb*12)))]; + simde__m64 *ch_magc = (simde__m64*)&ul_ch_magc[(symbol*(off+(nb_rb*12)))]; + + xmm0 = simde_mm_abs_pi16(rxF[nb_re64-1]); // registers of even index in xmm0-> |y_R|, registers of odd index in xmm0-> |y_I| + xmm0 = simde_mm_subs_pi16(ch_mag[nb_re-1],xmm0); // registers of even index in xmm0-> |y_R|-|h|^2, registers of odd index in xmm0-> |y_I|-|h|^2 + // xmmtmpD2 contains 4 LLRs + xmm1 = simde_mm_abs_pi16(xmm0); + xmm1 = simde_mm_subs_pi16(ch_magb[nb_re64-1],xmm1); // contains 4 LLRs + xmm2 = simde_mm_abs_pi16(xmm1); + xmm2 = simde_mm_subs_pi16(ch_magc[nb_re64-1],xmm2); // contains 4 LLRs + // rxF[i] A0 A1 + // xmm0 B0 B1 + // xmm1 C0 C1 + // xmm2 D0 D1 + llr64[0] = simde_m_punpckldq(rxF[nb_re64-1],xmm0); // A0 B0 + llr64[2] = simde_m_punpckhdq(rxF[nb_re64-1],xmm0); // A1 B1 + llr64[1] = simde_m_punpckldq(xmm1,xmm2); // C0 D0 + llr64[3] = simde_m_punpckhdq(xmm1,xmm2); // C1 D1 + } + +} void nr_ulsch_compute_llr(int32_t *rxdataF_comp, int32_t *ul_ch_mag, int32_t *ul_ch_magb, + int32_t *ul_ch_magc, int16_t *ulsch_llr, uint32_t nb_rb, uint32_t nb_re, @@ -386,8 +494,18 @@ void nr_ulsch_compute_llr(int32_t *rxdataF_comp, nb_re, symbol); break; + case 8: + nr_ulsch_256qam_llr(rxdataF_comp, + ul_ch_mag, + ul_ch_magb, + ul_ch_magc, + ulsch_llr, + nb_rb, + nb_re, + symbol); + break; default: - LOG_E(PHY,"nr_ulsch_compute_llr: invalid Qm value, symbol = %d, Qm = %d\n",symbol, mod_order); + AssertFatal(1==0,"nr_ulsch_compute_llr: invalid Qm value, symbol = %d, Qm = %d\n",symbol, mod_order); break; } } diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 71db65a14e..3dadbb79c8 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -1704,8 +1704,10 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ((int16_t*)&llrs[half_prb])[7]); } // half_prb } // symb + // run polar decoder on llrs - decoderState = polar_decoder_int16((int16_t*)llrs, decodedPayload, 0, 2,nb_bit,pucch_pdu->prb_size); + decoderState = polar_decoder_int16((int16_t *)llrs, decodedPayload, 0, NR_POLAR_UCI_PUCCH_MESSAGE_TYPE, nb_bit, pucch_pdu->prb_size); + LOG_D(PHY,"UCI decoderState %d, payload[0] %llu\n",decoderState,(unsigned long long)decodedPayload[0]); if (decoderState>0) decoderState=1; corr_dB = dB_fixed64(corr); @@ -1774,7 +1776,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, } bit_left = pucch_pdu->bit_len_csi_part1-((csi_part1_bytes-1)<<3); uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<>= pucch_pdu->bit_len_csi_part1; + decodedPayload[0] = pucch_pdu->bit_len_csi_part1 < 64 ? decodedPayload[0] >> pucch_pdu->bit_len_csi_part1 : 0; } if (pucch_pdu->bit_len_csi_part2>0) { diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c index 78dc616d07..be1515072d 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c @@ -88,6 +88,21 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue, ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx; + allocCast3D(rx_spatial_power, + int, + ue->measurements.rx_spatial_power, + NUMBER_OF_CONNECTED_gNB_MAX, + frame_parms->nb_antenna_ports_gNB, + frame_parms->nb_antennas_rx, + false); + allocCast3D(rx_spatial_power_dB, + unsigned short, + ue->measurements.rx_spatial_power_dB, + NUMBER_OF_CONNECTED_gNB_MAX, + frame_parms->nb_antenna_ports_gNB, + frame_parms->nb_antennas_rx, + false); + // signal measurements for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++){ @@ -98,15 +113,14 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue, ue->measurements.rx_power[gNB_id][aarx] = 0; for (aatx = 0; aatx < frame_parms->nb_antenna_ports_gNB; aatx++){ + const int z=signal_energy_nodc(&dl_ch_estimates[gNB_id][ch_offset], N_RB_DL * NR_NB_SC_PER_RB); + rx_spatial_power[gNB_id][aatx][aarx] = z; - ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = (signal_energy_nodc(&dl_ch_estimates[gNB_id][ch_offset], N_RB_DL*NR_NB_SC_PER_RB)); - - if (ue->measurements.rx_spatial_power[gNB_id][aatx][aarx]<0) - ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = 0; - - ue->measurements.rx_spatial_power_dB[gNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[gNB_id][aatx][aarx]); - ue->measurements.rx_power[gNB_id][aarx] += ue->measurements.rx_spatial_power[gNB_id][aatx][aarx]; + if (rx_spatial_power[gNB_id][aatx][aarx] < 0) + rx_spatial_power[gNB_id][aatx][aarx] = 0; + rx_spatial_power_dB[gNB_id][aatx][aarx] = (unsigned short)dB_fixed(rx_spatial_power[gNB_id][aatx][aarx]); + ue->measurements.rx_power[gNB_id][aarx] += rx_spatial_power[gNB_id][aatx][aarx]; } ue->measurements.rx_power_dB[gNB_id][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_power[gNB_id][aarx]); diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index 0e5ba62da7..02f087b2ef 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -980,9 +980,8 @@ int nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r fapi_nr_rx_indication_t rx_ind = {0}; nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, NULL); nr_fill_rx_indication(&rx_ind, FAPI_NR_CSIRS_IND, ue, NULL, NULL, 1, proc, (void *)&csirs_measurements, NULL); - if (ue->if_inst && ue->if_inst->dl_indication) { - ue->if_inst->dl_indication(&dl_indication, NULL); - } + if (ue->if_inst && ue->if_inst->dl_indication) + ue->if_inst->dl_indication(&dl_indication); return 0; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index da99ba7405..e81f8551c0 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -515,7 +515,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, } // if stand alone and sync on ssb do sib1 detection as part of initial sync - if (sa==1 && ret==0) { + if (sa == 1 && ret == 0) { nr_ue_dlsch_init(phy_data.dlsch, 1, ue->max_ldpc_iterations); bool dec = false; proc->gNB_id = 0; //FIXME @@ -524,7 +524,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, int32_t pdcch_est_size = ((((fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH))+15)/16)*16); __attribute__ ((aligned(16))) int32_t pdcch_dl_ch_estimates[4*fp->nb_antennas_rx][pdcch_est_size]; - for(int n_ss = 0; n_ssnb_search_space; n_ss++) { + for(int n_ss = 0; n_ss < phy_pdcch_config->nb_search_space; n_ss++) { proc->nr_slot_rx = phy_pdcch_config->slot; // setting PDCCH slot to proc uint8_t nb_symb_pdcch = phy_pdcch_config->pdcch_config[n_ss].coreset.duration; int start_symb = phy_pdcch_config->pdcch_config[n_ss].coreset.StartSymbolIndex; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 2fa9ca37ef..8195f6bcb2 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -520,7 +520,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, phy_data); nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, NULL, NULL, number_pdus, proc, NULL, NULL); if (ue->if_inst && ue->if_inst->dl_indication) - ue->if_inst->dl_indication(&dl_indication, NULL); + ue->if_inst->dl_indication(&dl_indication); return(decoderState); } // printf("polar decoder output 0x%08x\n",pbch_a_prime); @@ -591,7 +591,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, NULL, NULL, number_pdus, proc, (void *)result, NULL); if (ue->if_inst && ue->if_inst->dl_indication) - ue->if_inst->dl_indication(&dl_indication, NULL); + ue->if_inst->dl_indication(&dl_indication); return 0; } diff --git a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c index 7b602c2e81..2cbd2afbd5 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c @@ -403,7 +403,7 @@ int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu, LOG_I(NR_PHY,"(%d) \t%i\t%i\n", subcarrier_log, (int16_t)(r_real_amp&0xFFFF), (int16_t)(r_imag_amp&0xFFFF)); #endif - txdataF[p_index][symbol_offset+l_line_offset+subcarrier] = (r_real_amp & 0xFFFF) + ((r_imag_amp<<16)&0xFFFF0000); + *(c16_t *)&txdataF[p_index][symbol_offset + l_line_offset + subcarrier] = (c16_t){r_real_amp, r_imag_amp}; // Subcarrier increment subcarrier += K_TC; diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 3079e5029c..e584d9f492 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -34,6 +34,7 @@ #include #include "PHY/sse_intrin.h" #include "common/utils/assertions.h" +#include "common/utils/utils.h" #if defined(__x86_64__) || defined(__i386__) #define simd_q15_t __m128i @@ -94,6 +95,79 @@ extern "C" { int64_t i; } c64_t; + typedef struct { + int dim1; + int dim2; + int dim3; + int dim4; + uint8_t data[]; + } fourDimArray_t; + + static inline fourDimArray_t *allocateFourDimArray(int elmtSz, int dim1, int dim2, int dim3, int dim4) + { + int sz = elmtSz; + DevAssert(dim1 > 0); + sz *= dim1; + if (dim2) { + sz *= dim2; + if (dim3) { + sz *= dim3; + if (dim4) + sz *= dim4; + } + } + fourDimArray_t *tmp = (fourDimArray_t *)malloc16_clear(sizeof(*tmp) + sz); + AssertFatal(tmp, "no more memory\n"); + *tmp = (fourDimArray_t){dim1, dim2, dim3, dim4}; + return tmp; + } + +#define CheckArrAllocated(workingVar, elementType, ArraY, diM1, diM2, diM3, diM4, resizeAllowed) \ + if (!(ArraY)) \ + ArraY = allocateFourDimArray(sizeof(elementType), diM1, diM2, diM3, diM4); \ + else { \ + if ((resizeAllowed) \ + && ((diM1) != (ArraY)->dim1 || (diM2) != (ArraY)->dim2 || (diM3) != (ArraY)->dim3 || (diM4) != (ArraY)->dim4)) { \ + LOG_I(PHY, "resizing %s to %d/%d/%d/%d\n", #ArraY, (diM1), (diM2), (diM3), (diM4)); \ + free(ArraY); \ + ArraY = allocateFourDimArray(sizeof(elementType), diM1, diM2, diM3, diM4); \ + } else \ + DevAssert((diM1) == (ArraY)->dim1 && (diM2) == (ArraY)->dim2 && (diM3) == (ArraY)->dim3 && (diM4) == (ArraY)->dim4); \ + } + +#define cast1Darray(workingVar, elementType, ArraY) elementType *workingVar = (elementType *)((ArraY)->data); + +#define allocCast1D(workingVar, elementType, ArraY, dim1, resizeAllowed) \ + CheckArrAllocated(workingVar, elementType, ArraY, dim1, 0, 0, 0, resizeAllowed); \ + cast1Darray(workingVar, elementType, ArraY); + +#define cast2Darray(workingVar, elementType, ArraY) \ + elementType(*workingVar)[(ArraY)->dim2] = (elementType(*)[(ArraY)->dim2])((ArraY)->data); + +#define allocCast2D(workingVar, elementType, ArraY, dim1, dim2, resizeAllowed) \ + CheckArrAllocated(workingVar, elementType, ArraY, dim1, dim2, 0, 0, resizeAllowed); \ + cast2Darray(workingVar, elementType, ArraY); + +#define cast3Darray(workingVar, elementType, ArraY) \ + elementType(*workingVar)[(ArraY)->dim2][(ArraY)->dim3] = (elementType(*)[(ArraY)->dim2][(ArraY)->dim3])((ArraY)->data); + +#define allocCast3D(workingVar, elementType, ArraY, dim1, dim2, dim3, resizeAllowed) \ + CheckArrAllocated(workingVar, elementType, ArraY, dim1, dim2, dim3, 0, resizeAllowed); \ + cast3Darray(workingVar, elementType, ArraY); + +#define cast4Darray(workingVar, elementType, ArraY) \ + elementType(*workingVar)[(ArraY)->dim2][(ArraY)->dim3][(ArraY)->dim4] = \ + (elementType(*)[(ArraY)->dim2][(ArraY)->dim3][(ArraY)->dim4])((ArraY)->data); + +#define allocCast4D(workingVar, elementType, ArraY, dim1, dim2, dim3, dim4, resizeAllowed) \ + CheckArrAllocated(workingVar, elementType, ArraY, dim1, dim2, dim3, dim4, resizeAllowed); \ + cast4Darray(workingVar, elementType, ArraY); + +#define clearArray(ArraY, elementType) \ + memset((ArraY)->data, \ + 0, \ + sizeof(elementType) * (ArraY)->dim1 * max((ArraY)->dim2, 1) * max((ArraY)->dim3, 1) * max((ArraY)->dim4, 1)) + #define squaredMod(a) ((a).r*(a).r + (a).i*(a).i) #define csum(res, i1, i2) (res).r = (i1).r + (i2).r ; (res).i = (i1).i + (i2).i diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index d9557447ff..0b5c7ba564 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -103,8 +103,8 @@ typedef struct { int total_bytes_rx; int current_Qm; int current_RI; - int power[NB_ANTENNAS_RX]; - int noise_power[NB_ANTENNAS_RX]; + int power[MAX_ANT]; + int noise_power[MAX_ANT]; int DTX; int sync_pos; } NR_gNB_SCH_STATS_t; @@ -229,9 +229,9 @@ typedef struct { typedef struct { //! estimated received spatial signal power (linear) - unsigned int rx_spatial_power[NB_ANTENNAS_TX][NB_ANTENNAS_RX]; + fourDimArray_t * rx_spatial_power; //! estimated received spatial signal power (dB) - unsigned int rx_spatial_power_dB[NB_ANTENNAS_TX][NB_ANTENNAS_RX]; + fourDimArray_t * rx_spatial_power_dB; //! estimated rssi (dBm) int rx_rssi_dBm; //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) @@ -353,28 +353,40 @@ typedef struct { /// - first index: rx antenna id [0..nb_antennas_rx[ /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ int32_t **ul_ch_magb; + /// \brief Magnitude of the UL channel estimates scaled for 4th bit level thresholds in LLR computation + /// - first index: rx antenna id [0..nb_antennas_rx[ + /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ + int32_t **ul_ch_magc; /// \brief Cross-correlation of two UE signals. /// - first index: rx antenna [0..nb_antennas_rx[ /// - second index: symbol [0..] int32_t ***rho; /// \f$\log_2(\max|H_i|^2)\f$ int16_t log2_maxh; - /// \brief Magnitude of Uplink Channel first layer (16QAM level/First 64QAM level). + /// \brief Magnitude of Uplink Channel first layer (16QAM level/First 64QAM level/First 256QAM level). /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_UL[ int32_t **ul_ch_mag0; - /// \brief Magnitude of Uplink Channel second layer (16QAM level/First 64QAM level). + /// \brief Magnitude of Uplink Channel second layer (16QAM level/First 64QAM level/First 256QAM level). /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_UL[ int32_t **ul_ch_mag1[8][8]; - /// \brief Magnitude of Uplink Channel, first layer (2nd 64QAM level). + /// \brief Magnitude of Uplink Channel, first layer (2nd 64QAM/256QAM level). /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_UL[ int32_t **ul_ch_magb0; - /// \brief Magnitude of Uplink Channel second layer (2nd 64QAM level). + /// \brief Magnitude of Uplink Channel second layer (2nd 64QAM/256QAM level). /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_UL[ int32_t **ul_ch_magb1[8][8]; + /// \brief Magnitude of Uplink Channel, first layer (3rd 256QAM level). + /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx + /// - second index: ? [0..168*N_RB_UL[ + int32_t **ul_ch_magc0; + /// \brief Magnitude of Uplink Channel second layer (3rd 256QAM level). + /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx + /// - second index: ? [0..168*N_RB_UL[ + int32_t **ul_ch_magc1[8][8]; /// measured RX power based on DRS int ulsch_power[8]; /// total signal over antennas @@ -546,9 +558,9 @@ typedef struct { //! estimated avg noise power (dB) unsigned int n0_power_tot_dB; //! estimated avg noise power per RB per RX ant (lin) - unsigned int n0_subband_power[NB_ANTENNAS_RX][275]; + fourDimArray_t *n0_subband_power; //! estimated avg noise power per RB per RX ant (dB) - unsigned int n0_subband_power_dB[NB_ANTENNAS_RX][275]; + fourDimArray_t *n0_subband_power_dB; //! estimated avg subband noise power (dB) unsigned int n0_subband_power_avg_dB; //! estimated avg subband noise power per antenna (dB) @@ -557,7 +569,6 @@ typedef struct { int n0_subband_power_tot_dB[275]; //! estimated avg noise power per RB (dBm) int n0_subband_power_tot_dBm[275]; - /// PRACH background noise level int prach_I0; diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 1543c81e00..aa8af44199 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -151,9 +151,9 @@ typedef struct { // UE measurements //! estimated received spatial signal power (linear) - int rx_spatial_power[NUMBER_OF_CONNECTED_gNB_MAX][2][2]; + fourDimArray_t *rx_spatial_power; //! estimated received spatial signal power (dB) - unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_gNB_MAX][2][2]; + fourDimArray_t *rx_spatial_power_dB; /// estimated received signal power (sum over all TX antennas) int rx_power[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX]; @@ -358,18 +358,6 @@ typedef struct UE_NR_SCAN_INFO_s { int32_t freq_offset_Hz[3][10]; } UE_NR_SCAN_INFO_t; -typedef struct NR_UL_TIME_ALIGNMENT { - /// flag used by MAC to inform PHY about a TA to be applied - unsigned char apply_ta; - /// frame and slot when to apply the TA as stated in TS 38.213 setion 4.2 - int16_t ta_frame; - char ta_slot; - /// TA command and TAGID received from the gNB - uint16_t ta_command; - uint32_t ta_total; - uint8_t tag_id; -} NR_UL_TIME_ALIGNMENT_t; - /// Top-level PHY Data Structure for UE typedef struct { /// \brief Module ID indicator for this instance @@ -519,7 +507,6 @@ typedef struct { int dlsch_mcch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX]; int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX]; int current_dlsch_cqi[NUMBER_OF_CONNECTED_gNB_MAX]; - unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_gNB_MAX]; uint8_t decode_SIB; uint8_t decode_MIB; uint8_t init_sync_frame; @@ -533,9 +520,11 @@ typedef struct { /// Timing Advance updates variables /// Timing advance update computed from the TA command signalled from gNB - int timing_advance; - int N_TA_offset; ///timing offset used in TDD - NR_UL_TIME_ALIGNMENT_t ul_time_alignment[NUMBER_OF_CONNECTED_gNB_MAX]; + int timing_advance; + int N_TA_offset; ///timing offset used in TDD + int ta_frame; + int ta_slot; + int ta_command; /// Flag to tell if UE is secondary user (cognitive mode) unsigned char is_secondary_ue; @@ -546,9 +535,6 @@ typedef struct { /// holds the maximum channel/precoder coefficient char log2_maxp; - /// if ==0 enables phy only test mode - int mac_enabled; - /// Flag to initialize averaging of PHY measurements int init_averaging; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index e48d9f30a4..efeba1d546 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1360,7 +1360,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { rb<=ulsch_harq->nb_rb; rb++) { int rb2 = rb+ulsch_harq->first_rb; - eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31)); + eNB->rb_mask_ul[rb2>>5] |= (1L<<(rb2&31)); } LOG_D(PHY,"[eNB %d] frame %d, subframe %d: Scheduling ULSCH Reception for UE %d \n", eNB->Mod_id, frame, subframe, i); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index e24e17920b..2395665245 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -634,7 +634,8 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu; for(int symbol = 0; symbol<(1<num_symbols); symbol++) { for(rb = srs_pdu->bwp_start; rb < (srs_pdu->bwp_start+srs_pdu->bwp_size); rb++) { - gNB->rb_mask_ul[gNB->frame_parms.symbols_per_slot-srs_pdu->time_start_position-1+symbol][rb>>5] |= 1<<(rb&31); + gNB->rb_mask_ul[gNB->frame_parms.symbols_per_slot - srs_pdu->time_start_position - 1 + symbol][rb >> 5] |= 1U + << (rb & 31); } } } diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index adc5a013e6..3b9bb25d75 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -40,10 +40,11 @@ #include "PHY/impl_defs_nr.h" #include "utils.h" #include "openair2/PHY_INTERFACE/queue_t.h" +#include "SCHED_NR_UE/phy_sch_processing_time.h" extern PHY_VARS_NR_UE ***PHY_vars_UE_g; -const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH", "SI_DLSCH", "P_DLSCH", "CSI_RS", "CSI_IM"}; +const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH", "SI_DLSCH", "P_DLSCH", "CSI_RS", "CSI_IM", "TA"}; const char *ul_pdu_type[]={"PRACH", "PUCCH", "PUSCH", "SRS"}; queue_t nr_rx_ind_queue; queue_t nr_crc_ind_queue; @@ -331,6 +332,62 @@ void configure_dlsch(NR_UE_DLSCH_t *dlsch0, } +void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_command_pdu) +{ + + /* Time Alignment procedure + // - UE processing capability 1 + // - Setting the TA update to be applied after the reception of the TA command + // - Timing adjustment computed according to TS 38.213 section 4.2 + // - Durations of N1 and N2 symbols corresponding to PDSCH and PUSCH are + // computed according to sections 5.3 and 6.4 of TS 38.214 */ + const int numerology = ue->frame_parms.numerology_index; + const int ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; + const int nb_prefix_samples = ue->frame_parms.nb_prefix_samples; + const int samples_per_subframe = ue->frame_parms.samples_per_subframe; + const int slots_per_frame = ue->frame_parms.slots_per_frame; + const int slots_per_subframe = ue->frame_parms.slots_per_subframe; + + const double tc_factor = 1.0 / samples_per_subframe; + // convert time factor "16 * 64 * T_c / (2^mu)" in N_TA calculation in TS38.213 section 4.2 to samples by multiplying with samples per second + // 16 * 64 * T_c / (2^mu) * samples_per_second + // = 16 * T_s / (2^mu) * samples_per_second + // = 16 * 1 / (15 kHz * 2048) / (2^mu) * (15 kHz * 2^mu * ofdm_symbol_size) + // = 16 * 1 / 2048 * ofdm_symbol_size + // = 16 * ofdm_symbol_size / 2048 + uint16_t bw_scaling = 16 * ofdm_symbol_size / 2048; + + const int Ta_max = 3846; // Max value of 12 bits TA Command + const double N_TA_max = Ta_max * bw_scaling * tc_factor; + + // symbols corresponding to a PDSCH processing time for UE processing capability 1 + // when additional PDSCH DM-RS is configured + int N_1 = pdsch_N_1_capability_1[numerology][3]; + + /* PUSCH preapration time N_2 for processing capability 1 */ + const int N_2 = pusch_N_2_timing_capability_1[numerology][1]; + + /* N_t_1 time duration in msec of N_1 symbols corresponding to a PDSCH reception time + // N_t_2 time duration in msec of N_2 symbols corresponding to a PUSCH preparation time */ + double N_t_1 = N_1 * (ofdm_symbol_size + nb_prefix_samples) * tc_factor; + double N_t_2 = N_2 * (ofdm_symbol_size + nb_prefix_samples) * tc_factor; + + /* Time alignment procedure */ + // N_t_1 + N_t_2 + N_TA_max must be in msec + const double t_subframe = 1.0; // subframe duration of 1 msec + const int ul_tx_timing_adjustment = 1 + (int)ceil(slots_per_subframe*(N_t_1 + N_t_2 + N_TA_max + 0.5)/t_subframe); + + ue->ta_slot = (ta_command_pdu->ta_slot + ul_tx_timing_adjustment) % slots_per_frame; + if (ta_command_pdu->ta_slot + ul_tx_timing_adjustment > slots_per_frame) + ue->ta_frame = (ta_command_pdu->ta_frame + 1) % 1024; + else + ue->ta_frame = ta_command_pdu->ta_frame; + + ue->ta_command = ta_command_pdu->ta_command; + LOG_D(PHY,"TA command received in Frame.Slot %d.%d -- Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n", + ta_command_pdu->ta_frame, ta_command_pdu->ta_slot, ue->ta_frame, ue->ta_slot); +} + int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ bool found = false; @@ -341,9 +398,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ int slot = scheduled_response->slot; // Note: we have to handle the thread IDs for this. To be revisited completely. - NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0]; - NR_UE_ULSCH_t *ulsch = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->ulsch; - NR_UE_PUCCH *pucch_vars = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->pucch_vars; NR_UE_CSI_IM *csiim_vars = PHY_vars_UE_g[module_id][cc_id]->csiim_vars[0]; NR_UE_CSI_RS *csirs_vars = PHY_vars_UE_g[module_id][cc_id]->csirs_vars[0]; NR_UE_PDCCH_CONFIG *phy_pdcch_config = NULL; @@ -384,26 +438,32 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ memcpy((void*)&(csirs_vars->csirs_config_pdu), (void*)csirs_config_pdu, sizeof(fapi_nr_dl_config_csirs_pdu_rel15_t)); csirs_vars->active = true; break; - case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH: + case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH: { dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; + NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0]; dlsch0->rnti_type = _RA_RNTI_; dlsch0->dlsch_config = *dlsch_config_pdu; configure_dlsch(dlsch0, PHY_vars_UE_g[module_id][cc_id]->dl_harq_processes[0], dlsch_config_pdu, module_id, dl_config->dl_config_list[i].dlsch_config_pdu.rnti); - break; - case FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH: + } break; + case FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH: { dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; + NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0]; dlsch0->rnti_type = _SI_RNTI_; dlsch0->dlsch_config = *dlsch_config_pdu; configure_dlsch(dlsch0, PHY_vars_UE_g[module_id][cc_id]->dl_harq_processes[0], dlsch_config_pdu, module_id, dl_config->dl_config_list[i].dlsch_config_pdu.rnti); - break; - case FAPI_NR_DL_CONFIG_TYPE_DLSCH: + } break; + case FAPI_NR_DL_CONFIG_TYPE_DLSCH: { dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; + NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0]; dlsch0->rnti_type = _C_RNTI_; dlsch0->dlsch_config = *dlsch_config_pdu; configure_dlsch(dlsch0, PHY_vars_UE_g[module_id][cc_id]->dl_harq_processes[0], dlsch_config_pdu, module_id, dl_config->dl_config_list[i].dlsch_config_pdu.rnti); + } break; + case FAPI_NR_CONFIG_TA_COMMAND: + configure_ta_command(PHY_vars_UE_g[module_id][cc_id], &dl_config->dl_config_list[i].ta_command_pdu); break; } } @@ -435,90 +495,136 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ fapi_nr_ul_config_srs_pdu *srs_config_pdu; switch (pdu_type){ + case FAPI_NR_UL_CONFIG_TYPE_PUSCH: { + // pusch config pdu + pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu; + current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id; + NR_UL_UE_HARQ_t *harq_process_ul_ue = &PHY_vars_UE_g[module_id][cc_id]->ul_harq_processes[current_harq_pid]; + NR_UE_ULSCH_t *ulsch = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->ulsch; + nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch->pusch_pdu; - case (FAPI_NR_UL_CONFIG_TYPE_PUSCH): - // pusch config pdu - pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu; - current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id; - NR_UL_UE_HARQ_t *harq_process_ul_ue = &PHY_vars_UE_g[module_id][cc_id]->ul_harq_processes[current_harq_pid]; + LOG_D(PHY, + "In %s i %d: copy pusch_config_pdu nrOfLayers:%d, num_dmrs_cdm_grps_no_data:%d \n", + __FUNCTION__, + i, + pusch_config_pdu->nrOfLayers, + pusch_config_pdu->num_dmrs_cdm_grps_no_data); - nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch->pusch_pdu; + memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t)); + if (scheduled_response->tx_request) { + for (int j = 0; j < scheduled_response->tx_request->number_of_pdus; j++) { + fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j]; + if ((tx_req_body->pdu_index == i) && (tx_req_body->pdu_length > 0)) { + LOG_D(PHY, + "%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n", + scheduled_response->frame, + slot, + tx_req_body->pdu_length, + current_harq_pid); + memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length); + break; + } + } - LOG_D(PHY, "In %s i %d: copy pusch_config_pdu nrOfLayers:%d, num_dmrs_cdm_grps_no_data:%d \n", __FUNCTION__, i, pusch_config_pdu->nrOfLayers,pusch_config_pdu->num_dmrs_cdm_grps_no_data); + harq_process_ul_ue->status = ACTIVE; + ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more + pdu_done++; + LOG_D(PHY, + "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", + scheduled_response->frame, + slot, + ul_config, + pdu_type, + pdu_done, + ul_config->number_pdus); - memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t)); - if (scheduled_response->tx_request) { - for (int j=0; jtx_request->number_of_pdus; j++) { - fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j]; - if ((tx_req_body->pdu_index == i) && (tx_req_body->pdu_length > 0)) { - LOG_D(PHY,"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",scheduled_response->frame,slot,tx_req_body->pdu_length,current_harq_pid); - memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length); + } else { + LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n"); + return -1; + } + } break; + + case FAPI_NR_UL_CONFIG_TYPE_PUCCH: { + NR_UE_PUCCH *pucch_vars = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->pucch_vars; + found = false; + pucch_config_pdu = &ul_config->ul_config_list[i].pucch_config_pdu; + for (int j = 0; j < 2; j++) { + if (pucch_vars->active[j] == false) { + LOG_D(PHY, "%d.%d Copying pucch pdu to UE PHY\n", scheduled_response->frame, slot); + memcpy((void *)&(pucch_vars->pucch_pdu[j]), (void *)pucch_config_pdu, sizeof(fapi_nr_ul_config_pucch_pdu)); + pucch_vars->active[j] = true; + found = true; + ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more + pdu_done++; + LOG_D(PHY, + "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", + scheduled_response->frame, + slot, + ul_config, + pdu_type, + pdu_done, + ul_config->number_pdus); break; } } + if (!found) + LOG_E(PHY, "Couldn't find allocation for PUCCH PDU in PUCCH VARS\n"); + } break; - harq_process_ul_ue->status = ACTIVE; + case FAPI_NR_UL_CONFIG_TYPE_PRACH: + // prach config pdu + prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu; + memcpy((void *)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), + (void *)prach_config_pdu, + sizeof(fapi_nr_ul_config_prach_pdu)); + PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->active = true; ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more pdu_done++; - LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus); + LOG_D(PHY, + "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", + scheduled_response->frame, + slot, + ul_config, + pdu_type, + pdu_done, + ul_config->number_pdus); + break; - } else { + case FAPI_NR_UL_CONFIG_TYPE_DONE: + pdu_done++; // count the no of pdu processed + LOG_D(PHY, + "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", + scheduled_response->frame, + slot, + ul_config, + pdu_type, + pdu_done, + ul_config->number_pdus); + break; - LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n"); - return -1; + case FAPI_NR_UL_CONFIG_TYPE_SRS: + // srs config pdu + srs_config_pdu = &ul_config->ul_config_list[i].srs_config_pdu; + memcpy((void *)&(PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->srs_config_pdu), + (void *)srs_config_pdu, + sizeof(fapi_nr_ul_config_srs_pdu)); + PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->active = true; + ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more + pdu_done++; + break; - } - - break; - - case (FAPI_NR_UL_CONFIG_TYPE_PUCCH): - found = false; - pucch_config_pdu = &ul_config->ul_config_list[i].pucch_config_pdu; - for(int j=0; j<2; j++) { - if(pucch_vars->active[j] == false) { - LOG_D(PHY,"%d.%d Copying pucch pdu to UE PHY\n",scheduled_response->frame,slot); - memcpy((void*)&(pucch_vars->pucch_pdu[j]), (void*)pucch_config_pdu, sizeof(fapi_nr_ul_config_pucch_pdu)); - pucch_vars->active[j] = true; - found = true; - ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more - pdu_done++; - LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus); - break; - } - } - if (!found) - LOG_E(PHY, "Couldn't find allocation for PUCCH PDU in PUCCH VARS\n"); - break; - - case (FAPI_NR_UL_CONFIG_TYPE_PRACH): - // prach config pdu - prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu; - memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu)); - PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->active = true; - ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more - pdu_done++; - LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus); - break; - - case (FAPI_NR_UL_CONFIG_TYPE_DONE): - pdu_done++; // count the no of pdu processed - LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus); - break; - - case (FAPI_NR_UL_CONFIG_TYPE_SRS): - // srs config pdu - srs_config_pdu = &ul_config->ul_config_list[i].srs_config_pdu; - memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->srs_config_pdu), (void*)srs_config_pdu, sizeof(fapi_nr_ul_config_srs_pdu)); - PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->active = true; - ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more - pdu_done++; - break; - - default: - ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more - pdu_done++; // count the no of pdu processed - LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus); - break; + default: + ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more + pdu_done++; // count the no of pdu processed + LOG_D(PHY, + "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", + scheduled_response->frame, + slot, + ul_config, + pdu_type, + pdu_done, + ul_config->number_pdus); + break; } } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 664cddcfdf..8dec02b0a1 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -50,7 +50,6 @@ #endif #include "executables/softmodem-common.h" #include "executables/nr-uesoftmodem.h" -#include "LAYER2/NR_MAC_UE/mac_proto.h" #include "SCHED_NR_UE/pucch_uci_ue_nr.h" #include @@ -87,8 +86,8 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, fapi_nr_rx_indication_t *rx_ind, UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, - void *phy_data){ - + void *phy_data) +{ memset((void*)dl_ind, 0, sizeof(nr_downlink_indication_t)); dl_ind->gNB_index = proc->gNB_id; @@ -223,49 +222,37 @@ int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){ return (amp_x_100); } -// convert time factor "16 * 64 * T_c / (2^mu)" in N_TA calculation in TS38.213 section 4.2 to samples by multiplying with samples per second -// 16 * 64 * T_c / (2^mu) * samples_per_second -// = 16 * T_s / (2^mu) * samples_per_second -// = 16 * 1 / (15 kHz * 2048) / (2^mu) * (15 kHz * 2^mu * ofdm_symbol_size) -// = 16 * 1 / 2048 * ofdm_symbol_size -// = 16 * ofdm_symbol_size / 2048 -static inline -uint16_t get_bw_scaling(uint16_t ofdm_symbol_size){ - return 16 * ofdm_symbol_size / 2048; -} - // UL time alignment procedures: -// - If the current tx frame and slot match the TA configuration in ul_time_alignment +// - If the current tx frame and slot match the TA configuration // then timing advance is processed and set to be applied in the next UL transmission // - Application of timing adjustment according to TS 38.213 p4.2 // todo: // - handle RAR TA application as per ch 4.2 TS 38.213 -void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){ +void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx) +{ + if (frame_tx == ue->ta_frame && slot_tx == ue->ta_slot) { - if (ue->mac_enabled == 1) { + uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; - uint8_t gNB_id = 0; - NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &ue->ul_time_alignment[gNB_id]; + // convert time factor "16 * 64 * T_c / (2^mu)" in N_TA calculation in TS38.213 section 4.2 to samples by multiplying with samples per second + // 16 * 64 * T_c / (2^mu) * samples_per_second + // = 16 * T_s / (2^mu) * samples_per_second + // = 16 * 1 / (15 kHz * 2048) / (2^mu) * (15 kHz * 2^mu * ofdm_symbol_size) + // = 16 * 1 / 2048 * ofdm_symbol_size + // = 16 * ofdm_symbol_size / 2048 + uint16_t bw_scaling = 16 * ofdm_symbol_size / 2048; - if (frame_tx == ul_time_alignment->ta_frame && slot_tx == ul_time_alignment->ta_slot) { + ue->timing_advance += (ue->ta_command - 31) * bw_scaling; - uint16_t ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; - uint16_t bw_scaling = get_bw_scaling(ofdm_symbol_size); + LOG_D(PHY, "[UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", + ue->Mod_id, + frame_tx, + slot_tx, + ue->ta_command, + ue->timing_advance); - ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling; - - LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", - __FUNCTION__, - ue->Mod_id, - frame_tx, - slot_tx, - ul_time_alignment->ta_command, - ue->timing_advance); - - ul_time_alignment->ta_frame = -1; - ul_time_alignment->ta_slot = -1; - - } + ue->ta_frame = -1; + ue->ta_slot = -1; } } @@ -516,7 +503,7 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, // fill dl_indication message nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, phy_data); // send to mac - ue->if_inst->dl_indication(&dl_indication, NULL); + ue->if_inst->dl_indication(&dl_indication); stop_meas(&ue->dlsch_rx_pdcch_stats); @@ -544,7 +531,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, if (!(NR_MAX_NB_LAYERS>4)) { NR_UE_DLSCH_t *dlsch0 = &dlsch[0]; int harq_pid = dlsch0->dlsch_config.harq_process_nbr; - NR_DL_UE_HARQ_t *dlsch0_harq = ue->dl_harq_processes[harq_pid]; + NR_DL_UE_HARQ_t *dlsch0_harq = &ue->dl_harq_processes[0][harq_pid]; uint16_t BWPStart = dlsch0->dlsch_config.BWPStart; uint16_t pdsch_start_rb = dlsch0->dlsch_config.start_rb; uint16_t pdsch_nb_rb = dlsch0->dlsch_config.number_rbs; @@ -705,13 +692,10 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, nr_downlink_indication_t dl_indication; fapi_nr_rx_indication_t rx_ind = {0}; uint16_t number_pdus = 1; - // params for UL time alignment procedure - NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &ue->ul_time_alignment[gNB_id]; uint8_t is_cw0_active = dl_harq0->status; uint8_t is_cw1_active = dl_harq1->status; uint16_t nb_symb_sch = dlsch[0].dlsch_config.number_symbols; - uint16_t start_symbol = dlsch[0].dlsch_config.start_symbol; uint8_t dmrs_type = dlsch[0].dlsch_config.dmrsConfigType; uint8_t nb_re_dmrs; @@ -805,7 +789,7 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, NULL); nr_fill_rx_indication(&rx_ind, ind_type, ue, &dlsch[0], NULL, number_pdus, proc, NULL, p_b); - LOG_D(PHY, "In %s DL PDU length in bits: %d, in bytes: %d \n", __FUNCTION__, dlsch[0].dlsch_config.TBS, dlsch[0].dlsch_config.TBS / 8); + LOG_D(PHY, "DL PDU length in bits: %d, in bytes: %d \n", dlsch[0].dlsch_config.TBS, dlsch[0].dlsch_config.TBS / 8); stop_meas(&ue->dlsch_decoding_stats); if (cpumeas(CPUMEAS_GETSTATE)) { @@ -857,9 +841,10 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, } LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch[1].dlsch_config.TBS); } + // send to mac if (ue->if_inst && ue->if_inst->dl_indication) { - ue->if_inst->dl_indication(&dl_indication, ul_time_alignment); + ue->if_inst->dl_indication(&dl_indication); } // DLSCH decoding finished! don't wait anymore @@ -869,135 +854,6 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, if (ue->phy_sim_dlsch_b) memcpy(ue->phy_sim_dlsch_b, p_b, dlsch_bytes); - if (ue->mac_enabled == 1) { // TODO: move this from PHY to MAC layer! - - /* Time Alignment procedure - // - UE processing capability 1 - // - Setting the TA update to be applied after the reception of the TA command - // - Timing adjustment computed according to TS 38.213 section 4.2 - // - Durations of N1 and N2 symbols corresponding to PDSCH and PUSCH are - // computed according to sections 5.3 and 6.4 of TS 38.214 */ - const int numerology = ue->frame_parms.numerology_index; - const int ofdm_symbol_size = ue->frame_parms.ofdm_symbol_size; - const int nb_prefix_samples = ue->frame_parms.nb_prefix_samples; - const int samples_per_subframe = ue->frame_parms.samples_per_subframe; - const int slots_per_frame = ue->frame_parms.slots_per_frame; - const int slots_per_subframe = ue->frame_parms.slots_per_subframe; - - const double tc_factor = 1.0 / samples_per_subframe; - const uint16_t bw_scaling = get_bw_scaling(ofdm_symbol_size); - - const int Ta_max = 3846; // Max value of 12 bits TA Command - const double N_TA_max = Ta_max * bw_scaling * tc_factor; - - NR_UE_MAC_INST_t *mac = get_mac_inst(0); - NR_BWP_Id_t ul_bwp = mac->current_UL_BWP.bwp_id; - - NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; - if(ul_bwp){ - if (mac->ULbwp[ul_bwp-1] && - mac->ULbwp[ul_bwp-1]->bwp_Dedicated && - mac->ULbwp[ul_bwp-1]->bwp_Dedicated->pusch_Config && - mac->ULbwp[ul_bwp-1]->bwp_Dedicated->pusch_Config->choice.setup && - mac->ULbwp[ul_bwp-1]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp-1]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; - } - else if (mac->ULbwp[ul_bwp-1] && - mac->ULbwp[ul_bwp-1]->bwp_Common && - mac->ULbwp[ul_bwp-1]->bwp_Common->pusch_ConfigCommon && - mac->ULbwp[ul_bwp-1]->bwp_Common->pusch_ConfigCommon->choice.setup && - mac->ULbwp[ul_bwp-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac->ULbwp[ul_bwp-1]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; - } - } - else if (mac->scc_SIB && - mac->scc_SIB->uplinkConfigCommon && - mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon && - mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup && - mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; - } - long mapping_type_ul = pusch_TimeDomainAllocationList ? pusch_TimeDomainAllocationList->list.array[0]->mappingType : NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeA; - - NR_PDSCH_Config_t *pdsch_Config = mac->current_DL_BWP.pdsch_Config; - NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = mac->current_DL_BWP.tdaList_Common; - long mapping_type_dl = pdsch_TimeDomainAllocationList ? pdsch_TimeDomainAllocationList->list.array[0]->mappingType : NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA; - - NR_DMRS_DownlinkConfig_t *NR_DMRS_dlconfig = NULL; - if (pdsch_Config) { - if (mapping_type_dl == NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA) - NR_DMRS_dlconfig = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; - else - NR_DMRS_dlconfig = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup; - } - - pdsch_dmrs_AdditionalPosition_t add_pos_dl = pdsch_dmrs_pos2; - if (NR_DMRS_dlconfig && NR_DMRS_dlconfig->dmrs_AdditionalPosition) - add_pos_dl = *NR_DMRS_dlconfig->dmrs_AdditionalPosition; - - /* PDSCH decoding time N_1 for processing capability 1 */ - int N_1; - - if (add_pos_dl == pdsch_dmrs_pos0) - N_1 = pdsch_N_1_capability_1[numerology][1]; - else if (add_pos_dl == pdsch_dmrs_pos1 || add_pos_dl == pdsch_dmrs_pos2) - N_1 = pdsch_N_1_capability_1[numerology][2]; - else - N_1 = pdsch_N_1_capability_1[numerology][3]; - - /* PUSCH preapration time N_2 for processing capability 1 */ - const int N_2 = pusch_N_2_timing_capability_1[numerology][1]; - - /* d_1_1 depending on the number of PDSCH symbols allocated */ - const int d = 0; // TODO number of overlapping symbols of the scheduling PDCCH and the scheduled PDSCH - int d_1_1 = 0; - if (mapping_type_dl == NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeA) - if (nb_symb_sch + start_symbol < 7) - d_1_1 = 7 - (nb_symb_sch + start_symbol); - else - d_1_1 = 0; - else // mapping type B - switch (nb_symb_sch){ - case 7: d_1_1 = 0; break; - case 4: d_1_1 = 3; break; - case 2: d_1_1 = 3 + d; break; - default: break; - } - - /* d_2_1 */ - int d_2_1; - if (mapping_type_ul == NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB && start_symbol != 0) - d_2_1 = 0; - else - d_2_1 = 1; - - /* d_2_2 */ - const double d_2_2 = pusch_d_2_2_timing_capability_1[numerology][1]; - - /* N_t_1 time duration in msec of N_1 symbols corresponding to a PDSCH reception time - // N_t_2 time duration in msec of N_2 symbols corresponding to a PUSCH preparation time */ - double N_t_1 = (N_1 + d_1_1) * (ofdm_symbol_size + nb_prefix_samples) * tc_factor; - double N_t_2 = (N_2 + d_2_1) * (ofdm_symbol_size + nb_prefix_samples) * tc_factor; - if (N_t_2 < d_2_2) N_t_2 = d_2_2; - - /* Time alignment procedure */ - // N_t_1 + N_t_2 + N_TA_max must be in msec - const double t_subframe = 1.0; // subframe duration of 1 msec - const int ul_tx_timing_adjustment = 1 + (int)ceil(slots_per_subframe*(N_t_1 + N_t_2 + N_TA_max + 0.5)/t_subframe); - - if (ul_time_alignment->apply_ta == 1){ - ul_time_alignment->ta_slot = (nr_slot_rx + ul_tx_timing_adjustment) % slots_per_frame; - if (nr_slot_rx + ul_tx_timing_adjustment > slots_per_frame){ - ul_time_alignment->ta_frame = (frame_rx + 1) % 1024; - } else { - ul_time_alignment->ta_frame = frame_rx; - } - // reset TA flag - ul_time_alignment->apply_ta = 0; - LOG_D(PHY,"Frame %d slot %d -- Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n", - frame_rx, nr_slot_rx, ul_time_alignment->ta_frame, ul_time_alignment->ta_slot); - } - } return dec; } diff --git a/openair1/SCHED_NR_UE/phy_sch_processing_time.h b/openair1/SCHED_NR_UE/phy_sch_processing_time.h index 81cc4496a2..896c93b9ee 100644 --- a/openair1/SCHED_NR_UE/phy_sch_processing_time.h +++ b/openair1/SCHED_NR_UE/phy_sch_processing_time.h @@ -50,7 +50,7 @@ // when PDSCH DM-RS position l1 for the additional DM-RS is != 1,2 */ -int8_t pdsch_N_1_capability_1[4][4] = { +static const int8_t pdsch_N_1_capability_1[4][4] = { /* mu A B C */ { 0, 8, 14, 13 }, { 1, 10, 13, 13 }, @@ -69,7 +69,7 @@ int8_t pdsch_N_1_capability_1[4][4] = { // dmrs-DownlinkForPDSCH-MappingTypeA and dmrs-DownlinkForPDSCH-MappingTypeB // mu == 2 is for FR1 only */ -float pdsch_N_1_capability_2[3][2] = { +static const float pdsch_N_1_capability_2[3][2] = { /* mu A */ { 0, 3 }, { 1, 4.5 }, @@ -84,7 +84,7 @@ float pdsch_N_1_capability_2[3][2] = { // carrying the DCI scheduling the PUSCH was transmitted // mu_UL is the SCS of the UL channel with which PUSCH to be transmitted */ -int8_t pusch_N_2_timing_capability_1[4][2] = { +static const int8_t pusch_N_2_timing_capability_1[4][2] = { /* mu N_2 */ { 0, 10 }, { 1, 12 }, @@ -101,7 +101,7 @@ int8_t pusch_N_2_timing_capability_1[4][2] = { // mu_UL is the SCS of the UL channel with which PUSCH to be transmitted // mu == 2 is for FR1 only */ -float pusch_N_2_timing_capability_2[3][2] = { +static const float pusch_N_2_timing_capability_2[3][2] = { /* mu N_2 */ { 0, 5 }, { 1, 5.5 }, @@ -116,7 +116,7 @@ float pusch_N_2_timing_capability_2[3][2] = { // carrying the DCI scheduling the PUSCH was transmitted // mu_UL is the SCS of the UL channel with which PUSCH to be transmitted */ -float pusch_d_2_2_timing_capability_1[4][2] = { +static const float pusch_d_2_2_timing_capability_1[4][2] = { /* mu d_2_2 */ { 0, 1 }, { 1, 2 }, @@ -132,7 +132,7 @@ float pusch_d_2_2_timing_capability_1[4][2] = { // carrying the DCI scheduling the PUSCH was transmitted // mu_UL is the SCS of the UL channel with which PUSCH to be transmitted */ -float pusch_d_2_2_timing_capability_2[4][2] = { +static const float pusch_d_2_2_timing_capability_2[4][2] = { /* mu d_2_2 */ { 0, 3 }, { 1, 5 }, diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index f8b1e359e5..c7e4f27f70 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -2080,9 +2080,7 @@ int main(int argc, char **argv) { squareRoot(&UE->dlsch_demodulation_stats), median(table_rx_demod), q1(table_rx_demod), q3(table_rx_demod)); //fprintf(time_meas_fd,"DEC;\n"); - fprintf(time_meas_fd,"%f;%f;%f;%f\n", - squareRoot(&UE->dlsch_decoding_stats[subframe]), - median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec)); + fprintf(time_meas_fd, "%f;%f;%f;%f\n", squareRoot(&UE->dlsch_decoding_stats[UE->current_thread_id[subframe]]), median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec)); printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate ); test_passed = 1; break; diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index a0286ad719..f3c2352084 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -53,8 +53,7 @@ #include "executables/lte-softmodem.h" #include "common/ran_context.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" -#include "openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h" - +#include "openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h" const char *__asan_default_options() { /* don't do leak checking in ulsim, not finished yet */ @@ -806,7 +805,7 @@ int main(int argc, char **argv) { if (cqi_flag == 1) coded_bits_per_codeword-=UE->ulsch[0]->O; - rate = (double)dlsch_tbs25[get_I_TBS(mcs)][nb_rb-1]/(coded_bits_per_codeword); + rate = (double)TBStable[get_I_TBS(mcs)][nb_rb - 1] / (coded_bits_per_codeword); printf("Rate = %f (mod %d), coded bits %u\n",rate,get_Qm_ul(mcs),coded_bits_per_codeword); for (ch_realization=0; ch_realizationframe_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS)); UE->frame_parms.nb_antennas_rx = n_rx; + UE->frame_parms.nb_antenna_ports_gNB = n_tx; UE->max_ldpc_iterations = max_ldpc_iterations; if (run_initial_sync==1) @@ -1372,16 +1373,11 @@ int main(int argc, char **argv) void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex, int8_t *ptrs_arg) { NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0]; - int *ptrsFreqDenst = calloc(2, sizeof(long)); - ptrsFreqDenst[0]= 25; - ptrsFreqDenst[1]= 115; - int *ptrsTimeDenst = calloc(3, sizeof(long)); - ptrsTimeDenst[0]= 2; - ptrsTimeDenst[1]= 4; - ptrsTimeDenst[2]= 10; + long ptrsFreqDenst[] = {25, 115}; + long ptrsTimeDenst[] = {2, 4, 10}; - int epre_Ratio = 0; - int reOffset = 0; + long epre_Ratio = 0; + long reOffset = 0; if(ptrs_arg[0] ==0) { ptrsTimeDenst[2]= *mcsIndex -1; diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index f16f8fc5f1..492fbdeafd 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -172,7 +172,8 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, else fp->nr_band = 78; fp->threequarter_fs= 0; - gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band); + int bw_index = get_supported_band_index(mu, fp->nr_band, N_RB_DL); + gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(fp->nr_band > 256 ? FR2 : FR1, bw_index); fp->ofdm_offset_divisor = UINT_MAX; nr_init_frame_parms(gNB_config, fp); diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index a0631767ba..f773b201fd 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -401,7 +401,7 @@ int main(int argc, char **argv) srand(time(NULL)); // Initialization, should only be called once. actual_payload = rand(); // Returns a pseudo-random integer between 0 and RAND_MAX. } - actual_payload &= ((1<pusch_pdu.rnti = n_rnti; + ulsch_ue->pusch_pdu.mcs_table = mcs_table; ulsch_ue->pusch_pdu.mcs_index = Imcs; ulsch_ue->pusch_pdu.nrOfLayers = Nl; ulsch_ue->pusch_pdu.rb_size = nb_rb; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index f660e9559c..6aaa79bb76 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -631,6 +631,10 @@ int main(int argc, char **argv) NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); prepare_scd(scd); + NR_UE_NR_Capability_t* UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t)); + prepare_sim_uecap(UE_Capability_nr,scc,mu, + N_RB_UL,0,mcs_table); + // TODO do a UECAP for phy-sim const gNB_RrcConfigurationReq conf = { .pdsch_AntennaPorts = { .N1 = 1, .N2 = 1, .XP = 1 }, @@ -640,7 +644,8 @@ int main(int argc, char **argv) .do_SRS = 0, .force_256qam_off = false }; - NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, NULL, 0, 1, &conf, 0); + + NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); @@ -873,7 +878,7 @@ int main(int argc, char **argv) if (input_fd != NULL || n_trials == 1) max_rounds=1; - if(1<= nb_symb_sch) + if (enable_ptrs && 1 << ptrs_time_density >= nb_symb_sch) pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS printf("\n"); diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c index 12d50065fa..c19680c6d0 100644 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c +++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c @@ -869,7 +869,6 @@ uint32_t tst_ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t e *********************************************************************/ void tst_set_sr_config(PHY_VARS_NR_UE *ue, int gNB_id) { - ue->mac_enabled = 1; ue->scheduling_request_config[gNB_id].sr_ConfigIndex = 0; p_nr_ue_get_SR = tst_ue_get_SR; } diff --git a/openair1/SIMULATION/TOOLS/rangen_double.c b/openair1/SIMULATION/TOOLS/rangen_double.c index df45199006..ddc453de9c 100644 --- a/openair1/SIMULATION/TOOLS/rangen_double.c +++ b/openair1/SIMULATION/TOOLS/rangen_double.c @@ -190,7 +190,7 @@ void tableNor(unsigned long seed) return; } -double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double variance) +double __attribute__ ((no_sanitize("address", "undefined"))) gaussZiggurat(double mean, double variance) { if (!tableNordDone) { // let's make reasonnable constant tables @@ -200,7 +200,7 @@ double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double v } hz = SHR3; iz = hz & 127; - return abs(hz) < kn[iz] ? hz * wn[iz] : nfix(); + return hz != INT32_MIN && abs(hz) < kn[iz] ? hz * wn[iz] : nfix(); } #ifdef MAIN diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index d766e10ac8..97b5fd388b 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2764,8 +2764,8 @@ uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint * *********************************************************************/ -uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) { - +uint8_t get_K_ptrs(uint32_t nrb0, uint32_t nrb1, uint32_t N_RB) +{ if (N_RB < nrb0) { LOG_D(PHY,"PUSH PT-RS is not present.\n"); return -1; @@ -3836,7 +3836,7 @@ uint8_t get_pusch_mcs_table(long *mcs_Table, if (*mcs_Table == NR_PUSCH_Config__mcs_Table_qam256) return 1; else - return (2+(is_tp<<1)); + return (2 + (is_tp << 1)); } else { if ((*mcs_Table == NR_PUSCH_Config__mcs_Table_qam256) && @@ -3847,14 +3847,12 @@ uint8_t get_pusch_mcs_table(long *mcs_Table, if ((*mcs_Table == NR_PUSCH_Config__mcs_Table_qam64LowSE) && (target_ss == NR_SearchSpace__searchSpaceType_PR_ue_Specific) && ((rnti_type == NR_RNTI_C ) || (rnti_type == NR_RNTI_SP_CSI))) - return (2+(is_tp<<1)); + return (2 + (is_tp << 1)); if (rnti_type == NR_RNTI_MCS_C) - return (2+(is_tp<<1)); - AssertFatal(1==0,"Invalid configuration to set MCS table"); + return (2 + (is_tp << 1)); } } - else - return (0+(is_tp*3)); + return (0 + (is_tp * 3)); } diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 0fa747c3c4..7e3c233228 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -176,7 +176,7 @@ uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength, uint8_t start_symbolt, uint8_t dmrs_typeA_position); uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table); -uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); +uint8_t get_K_ptrs(uint32_t nrb0, uint32_t nrb1, uint32_t N_RB); uint32_t nr_compute_tbs(uint16_t Qm, uint16_t R, diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 43194b324f..c82e363074 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -117,7 +117,6 @@ void set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg, } - void config_common_ue_sa(NR_UE_MAC_INST_t *mac, module_id_t module_id, int cc_idP) { @@ -131,18 +130,20 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, LOG_D(MAC, "Entering SA UE Config Common\n"); // carrier config - cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - *scc->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR); + NR_FrequencyInfoDL_SIB_t *frequencyInfoDL = &scc->downlinkConfigCommon.frequencyInfoDL; + int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR, + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); + cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR > 256 ? FR2 : FR1, bw_index); - uint64_t dl_bw_khz = (12*scc->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth)* - (15<downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); + uint64_t dl_bw_khz = (12 * frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth) * + (15 << frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); cfg->carrier_config.dl_frequency = (downlink_frequency[cc_idP][0]/1000) - (dl_bw_khz>>1); for (int i=0; i<5; i++) { - if (i==scc->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { - cfg->carrier_config.dl_grid_size[i] = scc->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - cfg->carrier_config.dl_k0[i] = scc->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + if (i == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.dl_grid_size[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.dl_k0[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; } else { cfg->carrier_config.dl_grid_size[i] = 0; @@ -150,23 +151,25 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, } } - cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - scc->uplinkConfigCommon->frequencyInfoUL.frequencyBandList==NULL ? - *scc->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR : - *scc->uplinkConfigCommon->frequencyInfoUL.frequencyBandList->list.array[0]->freqBandIndicatorNR); + NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL; + int UL_band_ind = frequencyInfoUL->frequencyBandList == NULL ? + *frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR : + *frequencyInfoUL->frequencyBandList->list.array[0]->freqBandIndicatorNR; + bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + UL_band_ind, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); + cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(UL_band_ind > 256 ? FR2 : FR1, bw_index); - - if (scc->uplinkConfigCommon->frequencyInfoUL.absoluteFrequencyPointA == NULL) + if (frequencyInfoUL->absoluteFrequencyPointA == NULL) cfg->carrier_config.uplink_frequency = cfg->carrier_config.dl_frequency; else // TODO check if corresponds to what reported in SIB1 cfg->carrier_config.uplink_frequency = (downlink_frequency[cc_idP][0]/1000) + uplink_frequency_offset[cc_idP][0]; - for (int i=0; i<5; i++) { - if (i==scc->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { - cfg->carrier_config.ul_grid_size[i] = scc->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - cfg->carrier_config.ul_k0[i] = scc->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + for (int i = 0; i < 5; i++) { + if (i == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.ul_grid_size[i] = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.ul_k0[i] = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; } else { cfg->carrier_config.ul_grid_size[i] = 0; @@ -185,7 +188,7 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, cfg->ssb_config.scs_common = get_softmodem_params()->numerology; // SSB Table config - cfg->ssb_table.ssb_offset_point_a = scc->downlinkConfigCommon.frequencyInfoDL.offsetToPointA; + cfg->ssb_table.ssb_offset_point_a = frequencyInfoDL->offsetToPointA; cfg->ssb_table.ssb_period = scc->ssb_PeriodicityServingCell; cfg->ssb_table.ssb_subcarrier_offset = mac->ssb_subcarrier_offset; @@ -203,26 +206,27 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, // TDD Table Configuration if (cfg->cell_config.frame_duplex_type == TDD){ set_tdd_config_nr_ue(cfg, - scc->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, scc->tdd_UL_DL_ConfigurationCommon); } // PRACH configuration uint8_t nb_preambles = 64; - if(scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) - nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; + NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; + if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL) + nb_preambles = *rach_ConfigCommon->totalNumberOfRA_Preambles; - cfg->prach_config.prach_sequence_length = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1; + cfg->prach_config.prach_sequence_length = rach_ConfigCommon->prach_RootSequenceIndex.present-1; - if (scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing) - cfg->prach_config.prach_sub_c_spacing = *scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing; + if (rach_ConfigCommon->msg1_SubcarrierSpacing) + cfg->prach_config.prach_sub_c_spacing = *rach_ConfigCommon->msg1_SubcarrierSpacing; else - cfg->prach_config.prach_sub_c_spacing = scc->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + cfg->prach_config.prach_sub_c_spacing = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - cfg->prach_config.restricted_set_config = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->restrictedSetConfig; + cfg->prach_config.restricted_set_config = rach_ConfigCommon->restrictedSetConfig; - switch (scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) { + switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) { case 0 : cfg->prach_config.num_prach_fd_occasions = 1; break; @@ -236,25 +240,26 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, cfg->prach_config.num_prach_fd_occasions = 8; break; default: - AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM); + AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM); } cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t)); for (int i=0; iprach_config.num_prach_fd_occasions; i++) { - cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i; + fapi_nr_num_prach_fd_occasions_t *prach_fd_occasion = &cfg->prach_config.num_prach_fd_occasions_list[i]; + prach_fd_occasion->num_prach_fd_occasions = i; if (cfg->prach_config.prach_sequence_length) - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; + prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l139; else - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; - cfg->prach_config.num_prach_fd_occasions_list[i].k1 = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + - scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + - (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); - cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; - cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup, - nb_preambles, mac->frame_type, mac->frequency_range); - //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? + prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l839; + prach_fd_occasion->k1 = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + + rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart + + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + prach_fd_occasion->prach_zero_corr_conf = rach_ConfigCommon->rach_ConfigGeneric.zeroCorrelationZoneConfig; + prach_fd_occasion->num_root_sequences = compute_nr_root_seq(rach_ConfigCommon, + nb_preambles, mac->frame_type, mac->frequency_range); + //prach_fd_occasion->num_unused_root_sequences = ??? } - cfg->prach_config.ssb_per_rach = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; + cfg->prach_config.ssb_per_rach = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; } @@ -264,7 +269,6 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, { fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; NR_ServingCellConfigCommon_t *scc = mac->scc; - int i; mac->phy_config.Mod_id = module_id; mac->phy_config.CC_id = cc_idP; @@ -272,124 +276,127 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, // carrier config LOG_D(MAC, "Entering UE Config Common\n"); - AssertFatal(scc!=NULL,"scc cannot be null\n"); + AssertFatal(scc != NULL, "scc cannot be null\n"); - if (scc) { - cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); + struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; + int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *frequencyInfoDL->frequencyBandList.list.array[0], + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); + cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0] > 256 ? FR2 : FR1, bw_index); - cfg->carrier_config.dl_frequency = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - *scc->ssbSubcarrierSpacing, - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz + cfg->carrier_config.dl_frequency = from_nrarfcn(*frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing, + frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz - for (i=0; i<5; i++) { - if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { - cfg->carrier_config.dl_grid_size[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - cfg->carrier_config.dl_k0[i] = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; - } - else { - cfg->carrier_config.dl_grid_size[i] = 0; - cfg->carrier_config.dl_k0[i] = 0; - } + for (int i = 0; i < 5; i++) { + if (i == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.dl_grid_size[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.dl_k0[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; } - - cfg->carrier_config.uplink_bandwidth = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]); - - int UL_pointA; - if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL) - UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - else - UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; - - cfg->carrier_config.uplink_frequency = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0], - *scc->ssbSubcarrierSpacing, - UL_pointA)/1000; // freq in kHz - - - for (i=0; i<5; i++) { - if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { - cfg->carrier_config.ul_grid_size[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - cfg->carrier_config.ul_k0[i] = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; - } - else { - cfg->carrier_config.ul_grid_size[i] = 0; - cfg->carrier_config.ul_k0[i] = 0; - } + else { + cfg->carrier_config.dl_grid_size[i] = 0; + cfg->carrier_config.dl_k0[i] = 0; } - - uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - mac->frequency_range = band<100?FR1:FR2; - - frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); - - // cell config - - cfg->cell_config.phy_cell_id = *scc->physCellId; - cfg->cell_config.frame_duplex_type = frame_type; - - // SSB config - cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower; - cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing; - - // SSB Table config - int scs_scaling = 1<<(cfg->ssb_config.scs_common); - if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000) - scs_scaling = scs_scaling*3; - if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666) - scs_scaling = scs_scaling>>2; - uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); - cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10; - cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell; + } - // NSA -> take ssb offset from SCS - cfg->ssb_table.ssb_subcarrier_offset = absolute_diff%(12*scs_scaling); - - switch (scc->ssb_PositionsInBurst->present) { - case 1 : - cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24; - cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; - break; - case 2 : - cfg->ssb_table.ssb_mask_list[0].ssb_mask = ((uint32_t) scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]) << 24; - cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; - break; - case 3 : - cfg->ssb_table.ssb_mask_list[0].ssb_mask = 0; - cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; - for (i=0; i<4; i++) { - cfg->ssb_table.ssb_mask_list[0].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[3-i]<ssb_table.ssb_mask_list[1].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[7-i]<ssb_PositionsInBurst->present); - } - - // TDD Table Configuration - if (cfg->cell_config.frame_duplex_type == TDD){ - set_tdd_config_nr_ue(cfg, - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->tdd_UL_DL_ConfigurationCommon); - } + struct NR_FrequencyInfoUL *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; + bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *frequencyInfoUL->frequencyBandList->list.array[0], + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); + cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(*frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, bw_index); - // PRACH configuration - uint8_t nb_preambles = 64; - if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) - nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; + int UL_pointA; + if (frequencyInfoUL->absoluteFrequencyPointA == NULL) + UL_pointA = frequencyInfoDL->absoluteFrequencyPointA; + else + UL_pointA = *frequencyInfoUL->absoluteFrequencyPointA; + + cfg->carrier_config.uplink_frequency = from_nrarfcn(*frequencyInfoUL->frequencyBandList->list.array[0], + *scc->ssbSubcarrierSpacing, + UL_pointA) / 1000; // freq in kHz + + for (int i = 0; i < 5; i++) { + if (i == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.ul_grid_size[i] = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.ul_k0[i] = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + } + else { + cfg->carrier_config.ul_grid_size[i] = 0; + cfg->carrier_config.ul_k0[i] = 0; + } + } + + uint32_t band = *frequencyInfoDL->frequencyBandList.list.array[0]; + mac->frequency_range = band<100?FR1:FR2; + + frame_type_t frame_type = get_frame_type(*frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + + // cell config + + cfg->cell_config.phy_cell_id = *scc->physCellId; + cfg->cell_config.frame_duplex_type = frame_type; + + // SSB config + cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower; + cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing; + + // SSB Table config + int scs_scaling = 1<<(cfg->ssb_config.scs_common); + if (frequencyInfoDL->absoluteFrequencyPointA < 600000) + scs_scaling = scs_scaling*3; + if (frequencyInfoDL->absoluteFrequencyPointA > 2016666) + scs_scaling = scs_scaling>>2; + uint32_t absolute_diff = (*frequencyInfoDL->absoluteFrequencySSB - frequencyInfoDL->absoluteFrequencyPointA); + cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10; + cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell; + + // NSA -> take ssb offset from SCS + cfg->ssb_table.ssb_subcarrier_offset = absolute_diff%(12*scs_scaling); + + switch (scc->ssb_PositionsInBurst->present) { + case 1 : + cfg->ssb_table.ssb_mask_list[0].ssb_mask = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0]<<24; + cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; + break; + case 2 : + cfg->ssb_table.ssb_mask_list[0].ssb_mask = ((uint32_t) scc->ssb_PositionsInBurst->choice.mediumBitmap.buf[0]) << 24; + cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; + break; + case 3 : + cfg->ssb_table.ssb_mask_list[0].ssb_mask = 0; + cfg->ssb_table.ssb_mask_list[1].ssb_mask = 0; + for (int i = 0; i < 4; i++) { + cfg->ssb_table.ssb_mask_list[0].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[3-i]<ssb_table.ssb_mask_list[1].ssb_mask += (scc->ssb_PositionsInBurst->choice.longBitmap.buf[7-i]<ssb_PositionsInBurst->present); + } + + // TDD Table Configuration + if (cfg->cell_config.frame_duplex_type == TDD){ + set_tdd_config_nr_ue(cfg, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc->tdd_UL_DL_ConfigurationCommon); + } + + // PRACH configuration + uint8_t nb_preambles = 64; + NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL) + nb_preambles = *rach_ConfigCommon->totalNumberOfRA_Preambles; + + cfg->prach_config.prach_sequence_length = rach_ConfigCommon->prach_RootSequenceIndex.present-1; + + if (rach_ConfigCommon->msg1_SubcarrierSpacing) + cfg->prach_config.prach_sub_c_spacing = *rach_ConfigCommon->msg1_SubcarrierSpacing; + else + cfg->prach_config.prach_sub_c_spacing = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + + cfg->prach_config.restricted_set_config = rach_ConfigCommon->restrictedSetConfig; - cfg->prach_config.prach_sequence_length = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1; - - if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing) - cfg->prach_config.prach_sub_c_spacing = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing; - else - cfg->prach_config.prach_sub_c_spacing = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - - cfg->prach_config.restricted_set_config = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig; - - switch (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) { + switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) { case 0 : cfg->prach_config.num_prach_fd_occasions = 1; break; @@ -403,28 +410,28 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, cfg->prach_config.num_prach_fd_occasions = 8; break; default: - AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM); - } - - cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t)); - for (i=0; iprach_config.num_prach_fd_occasions; i++) { - cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i; - if (cfg->prach_config.prach_sequence_length) - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; - else - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; - - cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; - cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; - cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, - nb_preambles, frame_type,mac->frequency_range); - //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? - } + AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM); + } - cfg->prach_config.ssb_per_rach = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; - - } // scc - + cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t)); + for (int i = 0; i < cfg->prach_config.num_prach_fd_occasions; i++) { + fapi_nr_num_prach_fd_occasions_t *prach_fd_occasion = &cfg->prach_config.num_prach_fd_occasions_list[i]; + prach_fd_occasion->num_prach_fd_occasions = i; + if (cfg->prach_config.prach_sequence_length) + prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l139; + else + prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l839; + + prach_fd_occasion->k1 = rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart; + prach_fd_occasion->prach_zero_corr_conf = rach_ConfigCommon->rach_ConfigGeneric.zeroCorrelationZoneConfig; + prach_fd_occasion->num_root_sequences = compute_nr_root_seq(rach_ConfigCommon, + nb_preambles, + frame_type, + mac->frequency_range); + //prach_fd_occasion->num_unused_root_sequences = ??? + } + + cfg->prach_config.ssb_per_rach = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; } /** \brief This function is relavant for the UE procedures for control. It loads the search spaces, the BWPs and the CORESETs into the MAC instance and diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 5418d81e92..e5ffe9c356 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -378,6 +378,16 @@ typedef struct { } NR_SSB_meas_t; +typedef struct NR_UL_TIME_ALIGNMENT { + /// TA command and TAGID received from the gNB + bool ta_apply; + int ta_command; + int ta_total; + uint32_t tag_id; + int frame; + int slot; +} NR_UL_TIME_ALIGNMENT_t; + /*!\brief Top level UE MAC structure */ typedef struct { NR_UE_L2_STATE_t state; @@ -400,11 +410,12 @@ typedef struct { NR_UE_DL_BWP_t current_DL_BWP; NR_UE_UL_BWP_t current_UL_BWP; + NR_UL_TIME_ALIGNMENT_t ul_time_alignment; - NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP_UE]; - NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP_UE]; - NR_ControlResourceSet_t *coreset[MAX_NUM_BWP_UE][FAPI_NR_MAX_CORESET_PER_BWP]; - NR_SearchSpace_t *SSpace[MAX_NUM_BWP_UE][FAPI_NR_MAX_SS]; + NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP_UE]; + NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP_UE]; + NR_ControlResourceSet_t *coreset[MAX_NUM_BWP_UE][FAPI_NR_MAX_CORESET_PER_BWP]; + NR_SearchSpace_t *SSpace[MAX_NUM_BWP_UE][FAPI_NR_MAX_SS]; bool phy_config_request_sent; frame_type_t frame_type; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 867f44e640..0c69ee7d5f 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -232,11 +232,9 @@ uint8_t get_rsrp_diff_index(int best_rsrp,int current_rsrp); @returns void */ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, - NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id); void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, - NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id); int nr_write_ce_ulsch_pdu(uint8_t *mac_ce, @@ -322,6 +320,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, void *phy_data); void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot); void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot); +void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment); /* \brief This function schedules the Msg3 transmission @param @@ -356,7 +355,7 @@ random-access procedure @param selected_rar_buffer the output buffer for storing the selected RAR header and RAR payload @returns timing advance or 0xffff if preamble doesn't match */ -int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id); +int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id); void nr_ue_contention_resolution(module_id_t module_id, int cc_id, frame_t frame, int slot, NR_PRACH_RESOURCES_t *prach_resources); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 90775a1029..96a9a3e072 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -51,16 +51,10 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { //LOG_I(MAC, "[MAIN] init UE MAC functions \n"); //init mac here - nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST); - nr_ue_mac_inst->first_sync_frame = -1; - nr_ue_mac_inst->sib1_decoded = false; - nr_ue_mac_inst->phy_config_request_sent = false; - nr_ue_mac_inst->state = UE_NOT_SYNC; - memset(&nr_ue_mac_inst->ssb_measurements, 0, sizeof(nr_ue_mac_inst->ssb_measurements)); + nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t), NB_NR_UE_MAC_INST); - for (int j=0;jscell_group_config) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 3c4fe6c2ee..2cde4d3c07 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -151,9 +151,8 @@ const initial_pucch_resource_t initial_pucch_resource[16] = { }; -void nr_ue_init_mac(module_id_t module_idP) { - int i; - +void nr_ue_init_mac(module_id_t module_idP) +{ NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); // default values as deined in 38.331 sec 9.2.2 LOG_I(NR_MAC, "[UE%d] Applying default macMainConfig\n", module_idP); @@ -182,7 +181,7 @@ void nr_ue_init_mac(module_id_t module_idP) { // mac->scheduling_info.PathlossChange_db = nr_get_db_dl_PathlossChange(mac->scheduling_info.PathlossChange); // mac->PHR_reporting_active = 0; - for (i = 0; i < NR_MAX_NUM_LCID; i++) { + for (int i = 0; i < NR_MAX_NUM_LCID; i++) { LOG_D(NR_MAC, "[UE%d] Applying default logical channel config for LCGID %d\n", module_idP, i); mac->scheduling_info.Bj[i] = -1; @@ -196,8 +195,16 @@ void nr_ue_init_mac(module_id_t module_idP) { mac->scheduling_info.LCID_status[i] = LCID_EMPTY; mac->scheduling_info.LCID_buffer_remain[i] = 0; - for (int i=0;ifirst_ul_tx[i]=1; + for (int i = 0; i < NR_MAX_HARQ_PROCESSES; i++) + mac->first_ul_tx[i] = 1; } + + mac->first_sync_frame = -1; + mac->sib1_decoded = false; + mac->phy_config_request_sent = false; + mac->state = UE_NOT_SYNC; + memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements)); + memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment)); } NR_BWP_DownlinkCommon_t *get_bwp_downlink_common(NR_UE_MAC_INST_t *mac, NR_BWP_Id_t dl_bwp_id) { @@ -2609,6 +2616,7 @@ uint8_t get_ssb_rsrp_payload(NR_UE_MAC_INST_t *mac, int ssbri_bits = ceil(log2(nb_ssb)); int ssb_rsrp[2][nb_meas]; // the array contains index and RSRP of each SSB to be reported (nb_meas highest RSRPs) + memset(ssb_rsrp, 0, sizeof(ssb_rsrp)); //TODO replace the following 2 lines with a function to order the nb_meas highest SSB RSRPs for (int i=0; iframe, dl_info->slot); @@ -2818,10 +2826,10 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u // it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs switch (dl_info->rx_ind->rx_indication_body[pdu_id].pdu_type){ case FAPI_NR_RX_PDU_TYPE_DLSCH: - nr_ue_process_mac_pdu(dl_info, ul_time_alignment, pdu_id); + nr_ue_process_mac_pdu(dl_info, pdu_id); break; case FAPI_NR_RX_PDU_TYPE_RAR: - nr_ue_process_rar(dl_info, ul_time_alignment, pdu_id); + nr_ue_process_rar(dl_info, pdu_id); break; default: break; @@ -3535,8 +3543,8 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, // R: Reserved bit, set to zero. //////////////////////////////// void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, - NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, - int pdu_id){ + int pdu_id) +{ module_id_t module_idP = dl_info->module_id; frame_t frameP = dl_info->frame; @@ -3656,11 +3664,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, const int ta = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND; const int tag = ((NR_MAC_CE_TA *)pduP)[1].TAGID; - ul_time_alignment->apply_ta = 1; - ul_time_alignment->ta_command = ta; //here + + NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &mac->ul_time_alignment; ul_time_alignment->ta_total += ta - 31; ul_time_alignment->tag_id = tag; - + ul_time_alignment->ta_command = ta; + ul_time_alignment->frame = frameP; + ul_time_alignment->slot = slot; + ul_time_alignment->ta_apply = true; /* #ifdef DEBUG_HEADER_PARSING LOG_D(MAC, "[UE] CE %d : UE Timing Advance : %d\n", i, pduP[1]); @@ -3943,8 +3954,8 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce, // - b buffer // - ulsch power offset // - optimize: mu_pusch, j and table_6_1_2_1_1_2_time_dom_res_alloc_A are already defined in nr_ue_procedures -int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){ - +int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) +{ module_id_t mod_id = dl_info->module_id; frame_t frame = dl_info->frame; int slot = dl_info->slot; @@ -4029,12 +4040,12 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t #endif // TA command - ul_time_alignment->apply_ta = 1; + NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &mac->ul_time_alignment; const int ta = rar->TA2 + (rar->TA1 << 5); ul_time_alignment->ta_command = 31 + ta; ul_time_alignment->ta_total = ta; - LOG_W(MAC, "received TA command %d\n", ul_time_alignment->ta_command); - + ul_time_alignment->ta_apply = true; + LOG_W(MAC, "received TA command %d\n", 31 + ta); #ifdef DEBUG_RAR // CSI csi_req = (unsigned char) (rar->UL_GRANT_4 & 0x01); @@ -4102,7 +4113,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t mod_id, rar_grant.Msg3_t_alloc, rar_grant.Msg3_f_alloc, - ul_time_alignment->ta_command, + ta_command, rar_grant.mcs, rar_grant.freq_hopping, tpc_command, @@ -4148,10 +4159,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t } } else { - ra->t_crnti = 0; - ul_time_alignment->ta_command = (0xffff); - } return ret; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index e5c6fb0e3c..94067924d1 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1024,6 +1024,8 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info) nr_ue_dcireq(&dcireq); //to be replaced with function pointer later *dl_config = dcireq.dl_config_req; + if(mac->ul_time_alignment.ta_apply) + schedule_ta_command(dl_config, &mac->ul_time_alignment); nr_schedule_csirs_reception(mac, rx_frame, rx_slot); nr_schedule_csi_for_im(mac, rx_frame, rx_slot); dcireq.dl_config_req = *dl_config; @@ -1037,6 +1039,8 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info) else if (mac->state == UE_PERFORMING_RA) { // this is for Msg2/Msg4 if (mac->ra.ra_state >= WAIT_RAR) { + if(mac->ul_time_alignment.ta_apply) + schedule_ta_command(dl_config, &mac->ul_time_alignment); fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; rel15->num_dci_options = mac->ra.ra_state == WAIT_RAR ? 1 : 2; rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; @@ -3171,5 +3175,15 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, #endif return num_sdus > 0 ? 1 : 0; +} +void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment) +{ + fapi_nr_ta_command_pdu *ta = &dl_config->dl_config_list[dl_config->number_pdus].ta_command_pdu; + ta->ta_frame = ul_time_alignment->frame; + ta->ta_slot = ul_time_alignment->slot; + ta->ta_command = ul_time_alignment->ta_command; + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_CONFIG_TA_COMMAND; + dl_config->number_pdus += 1; + ul_time_alignment->ta_apply = false; } diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 96c3a85b98..a647dcd21c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -170,24 +170,25 @@ void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch_Antenn nrmac->common_channels[0].ServingCellConfigCommon = scc; // Carrier configuration - - cfg->carrier_config.dl_bandwidth.value = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); + struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; + int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *frequencyInfoDL->frequencyBandList.list.array[0], + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); + cfg->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0] > 256 ? FR2 : FR1, bw_index); cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; //temporary cfg->num_tlv++; LOG_I(NR_MAC,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.dl_bandwidth.value); - cfg->carrier_config.dl_frequency.value = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + cfg->carrier_config.dl_frequency.value = from_nrarfcn(*frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz + frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz cfg->carrier_config.dl_frequency.tl.tag = NFAPI_NR_CONFIG_DL_FREQUENCY_TAG; cfg->num_tlv++; - for (int i=0; i<5; i++) { - if (i==scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { - cfg->carrier_config.dl_grid_size[i].value = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - cfg->carrier_config.dl_k0[i].value = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + for (int i = 0; i < 5; i++) { + if (i == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.dl_grid_size[i].value = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.dl_k0[i].value = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; cfg->carrier_config.dl_grid_size[i].tl.tag = NFAPI_NR_CONFIG_DL_GRID_SIZE_TAG; cfg->carrier_config.dl_k0[i].tl.tag = NFAPI_NR_CONFIG_DL_K0_TAG; cfg->num_tlv++; @@ -198,30 +199,31 @@ void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch_Antenn cfg->carrier_config.dl_k0[i].value = 0; } } - - cfg->carrier_config.uplink_bandwidth.value = config_bandwidth(scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]); + struct NR_FrequencyInfoUL *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; + bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *frequencyInfoUL->frequencyBandList->list.array[0], + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); + cfg->carrier_config.uplink_bandwidth.value = get_supported_bw_mhz(*frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, bw_index); cfg->carrier_config.uplink_bandwidth.tl.tag = NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG; //temporary cfg->num_tlv++; LOG_I(NR_MAC,"%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.uplink_bandwidth.value); int UL_pointA; - if (scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA == NULL) - UL_pointA = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + if (frequencyInfoUL->absoluteFrequencyPointA == NULL) + UL_pointA = frequencyInfoDL->absoluteFrequencyPointA; else - UL_pointA = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + UL_pointA = *frequencyInfoUL->absoluteFrequencyPointA; - cfg->carrier_config.uplink_frequency.value = from_nrarfcn(*scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0], + cfg->carrier_config.uplink_frequency.value = from_nrarfcn(*frequencyInfoUL->frequencyBandList->list.array[0], *scc->ssbSubcarrierSpacing, UL_pointA)/1000; // freq in kHz cfg->carrier_config.uplink_frequency.tl.tag = NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG; cfg->num_tlv++; - for (int i=0; i<5; i++) { - if (i==scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { - cfg->carrier_config.ul_grid_size[i].value = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - cfg->carrier_config.ul_k0[i].value = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + for (int i = 0; i < 5; i++) { + if (i == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { + cfg->carrier_config.ul_grid_size[i].value = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + cfg->carrier_config.ul_k0[i].value = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; cfg->carrier_config.ul_grid_size[i].tl.tag = NFAPI_NR_CONFIG_UL_GRID_SIZE_TAG; cfg->carrier_config.ul_k0[i].tl.tag = NFAPI_NR_CONFIG_UL_K0_TAG; cfg->num_tlv++; @@ -233,10 +235,10 @@ void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch_Antenn } } - uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + uint32_t band = *frequencyInfoDL->frequencyBandList.list.array[0]; frequency_range_t frequency_range = band<100?FR1:FR2; - frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(*frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); nrmac->common_channels[0].frame_type = frame_type; // Cell configuration @@ -265,27 +267,28 @@ void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch_Antenn // PRACH configuration uint8_t nb_preambles = 64; - if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) - nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; + NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL) + nb_preambles = *rach_ConfigCommon->totalNumberOfRA_Preambles; - cfg->prach_config.prach_sequence_length.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1; + cfg->prach_config.prach_sequence_length.value = rach_ConfigCommon->prach_RootSequenceIndex.present-1; cfg->prach_config.prach_sequence_length.tl.tag = NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG; - cfg->num_tlv++; + cfg->num_tlv++; - if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing) - cfg->prach_config.prach_sub_c_spacing.value = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing; - else - cfg->prach_config.prach_sub_c_spacing.value = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + if (rach_ConfigCommon->msg1_SubcarrierSpacing) + cfg->prach_config.prach_sub_c_spacing.value = *rach_ConfigCommon->msg1_SubcarrierSpacing; + else + cfg->prach_config.prach_sub_c_spacing.value = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; cfg->prach_config.prach_sub_c_spacing.tl.tag = NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG; cfg->num_tlv++; - cfg->prach_config.restricted_set_config.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig; + cfg->prach_config.restricted_set_config.value = rach_ConfigCommon->restrictedSetConfig; cfg->prach_config.restricted_set_config.tl.tag = NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG; cfg->num_tlv++; - cfg->prach_config.prach_ConfigurationIndex.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; + cfg->prach_config.prach_ConfigurationIndex.value = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex; cfg->prach_config.prach_ConfigurationIndex.tl.tag = NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG; cfg->num_tlv++; - switch (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM) { + switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) { case 0 : cfg->prach_config.num_prach_fd_occasions.value = 1; break; @@ -299,48 +302,57 @@ void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch_Antenn cfg->prach_config.num_prach_fd_occasions.value = 8; break; default: - AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM); + AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM); } cfg->prach_config.num_prach_fd_occasions.tl.tag = NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG; cfg->num_tlv++; - cfg->prach_config.prach_ConfigurationIndex.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; + cfg->prach_config.prach_ConfigurationIndex.value = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex; cfg->prach_config.prach_ConfigurationIndex.tl.tag = NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG; cfg->num_tlv++; cfg->prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions.value*sizeof(nfapi_nr_num_prach_fd_occasions_t)); for (int i=0; iprach_config.num_prach_fd_occasions.value; i++) { -// cfg->prach_config.num_prach_fd_occasions_list[i].num_prach_fd_occasions = i; + nfapi_nr_num_prach_fd_occasions_t *prach_fd_occasion = &cfg->prach_config.num_prach_fd_occasions_list[i]; + // prach_fd_occasion->num_prach_fd_occasions = i; if (cfg->prach_config.prach_sequence_length.value) - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; + prach_fd_occasion->prach_root_sequence_index.value = rach_ConfigCommon->prach_RootSequenceIndex.choice.l139; else - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; - cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG; + prach_fd_occasion->prach_root_sequence_index.value = rach_ConfigCommon->prach_RootSequenceIndex.choice.l839; + prach_fd_occasion->prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + prach_fd_occasion->k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + + rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart + + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); if (get_softmodem_params()->sa) { - cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + prach_fd_occasion->k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + + rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart + + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); } else { - cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + prach_fd_occasion->k1.value = rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart + + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); } - cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG; + prach_fd_occasion->k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; - cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.tl.tag = NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG; + prach_fd_occasion->prach_zero_corr_conf.value = rach_ConfigCommon->rach_ConfigGeneric.zeroCorrelationZoneConfig; + prach_fd_occasion->prach_zero_corr_conf.tl.tag = NFAPI_NR_CONFIG_PRACH_ZERO_CORR_CONF_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences.value = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup,nb_preambles, frame_type, frequency_range); - cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences.tl.tag = NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG; + prach_fd_occasion->num_root_sequences.value = compute_nr_root_seq(rach_ConfigCommon, + nb_preambles, + frame_type, + frequency_range); + prach_fd_occasion->num_root_sequences.tl.tag = NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences.value = 1; + prach_fd_occasion->num_unused_root_sequences.value = 1; } - cfg->prach_config.ssb_per_rach.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; + cfg->prach_config.ssb_per_rach.value = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1; cfg->prach_config.ssb_per_rach.tl.tag = NFAPI_NR_CONFIG_SSB_PER_RACH_TAG; cfg->num_tlv++; // SSB Table Configuration - uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); - const int scaling_5khz = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000 ? 3 : 1; + uint32_t absolute_diff = (*frequencyInfoDL->absoluteFrequencySSB - frequencyInfoDL->absoluteFrequencyPointA); + const int scaling_5khz = frequencyInfoDL->absoluteFrequencyPointA < 600000 ? 3 : 1; int sco = (absolute_diff/scaling_5khz) % 24; if(frequency_range == FR2) sco >>= 1; // this assumes 120kHz SCS for SSB and subCarrierSpacingCommon (only option supported by OAI for @@ -428,7 +440,7 @@ void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch_Antenn } LOG_I(NR_MAC, "Setting TDD configuration period to %d\n", cfg->tdd_table.tdd_period.value); int periods_per_frame = set_tdd_config_nr(cfg, - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, @@ -441,7 +453,6 @@ void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch_Antenn nrmac->tdd_beam_association = (int16_t *)malloc16(periods_per_frame*sizeof(int16_t)); } } - } int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_SubcarrierSpacing_t subcarrierSpacing, uint32_t rrc_reconfiguration_delay) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index d08d2fefb3..5adb036931 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -715,7 +715,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ul_bwp->tdaList_Common; int mu = ul_bwp->scs; uint8_t K2 = *pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2; - const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); + const int sched_frame = (frame + (slot + K2 >= nr_slots_per_frame[mu])) % 1024; const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; if (is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot)) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 7d16783416..71b4499c55 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -108,10 +108,8 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, AssertFatal(timing_advance_cmd < 64, "timing_advance_cmd %d > 63\n", timing_advance_cmd); ((NR_MAC_CE_TA *) ce_ptr)->TA_COMMAND = timing_advance_cmd; //(timing_advance_cmd+31)&0x3f; - if (gNB->tag->tag_Id != 0) { - tag_id = gNB->tag->tag_Id; - ((NR_MAC_CE_TA *) ce_ptr)->TAGID = tag_id; - } + tag_id = gNB->tag->tag_Id; + ((NR_MAC_CE_TA *) ce_ptr)->TAGID = tag_id; LOG_D(NR_MAC, "NR MAC CE timing advance command = %d (%d) TAG ID = %d\n", timing_advance_cmd, ((NR_MAC_CE_TA *) ce_ptr)->TA_COMMAND, tag_id); mac_ce_size = sizeof(NR_MAC_CE_TA); @@ -1191,7 +1189,7 @@ void nr_schedule_ue_spec(module_id_t module_id, T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->transportBlock, TBS)); UE->mac_stats.dl.total_rbs_retx += sched_pdsch->rbSize; } else { /* initial transmission */ - LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); + LOG_D(NR_MAC, "Initial HARQ transmission in %d.%d\n", frame, slot); uint8_t *buf = (uint8_t *) harq->transportBlock; /* first, write all CEs that might be there */ int written = nr_write_ce_dlsch_pdu(module_id, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 6ed327e125..e1a4e716ef 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1662,7 +1662,8 @@ void pf_ul(module_id_t module_id, } const NR_bler_options_t *bo = &nrmac->ul_bler; - const int max_mcs = bo->max_mcs; /* no per-user maximum MCS yet */ + const int max_mcs_table = (current_BWP->mcs_table == 0 || current_BWP->mcs_table == 2) ? 28 : 27; + const int max_mcs = min(bo->max_mcs, max_mcs_table); /* no per-user maximum MCS yet */ if (bo->harq_round_max == 1) sched_pusch->mcs = max_mcs; else @@ -2102,7 +2103,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n sched_ctrl->last_ul_slot = sched_pusch->slot; LOG_D(NR_MAC, - "ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS %2d nrOfLayers %2d num_dmrs_cdm_grps_no_data %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n", + "ULSCH/PUSCH: %4d.%2d RNTI %04x UL sched %4d.%2d DCI L %d start %2d RBS %3d startSymbol %2d nb_symbol %2d dmrs_pos %x MCS Table %2d MCS %2d nrOfLayers %2d num_dmrs_cdm_grps_no_data %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d est %6d sched %6d est BSR %6d TPC %d\n", frame, slot, rnti, @@ -2114,6 +2115,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot, n sched_pusch->tda_info.startSymbolIndex, sched_pusch->tda_info.nrOfSymbols, sched_pusch->dmrs_info.ul_dmrs_symb_pos, + current_BWP->mcs_table, sched_pusch->mcs, sched_pusch->nrOfLayers, sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c b/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c index b42410ab72..c5b1eb04e7 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_pdu.c @@ -151,7 +151,7 @@ void nr_rlc_pdu_encoder_init(nr_rlc_pdu_encoder_t *encoder, { encoder->byte = 0; encoder->bit = 0; - encoder->buffer = buffer; + encoder->buffer = (unsigned char *)buffer; encoder->size = size; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_pdu.h b/openair2/LAYER2/nr_rlc/nr_rlc_pdu.h index 8e9872522f..0f5cd6c6d0 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_pdu.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_pdu.h @@ -71,7 +71,7 @@ int nr_rlc_pdu_decoder_get_bits(nr_rlc_pdu_decoder_t *decoder, int count); typedef struct { int byte; /* next byte to encode */ int bit; /* next bit in next byte to encode */ - char *buffer; + unsigned char *buffer; int size; } nr_rlc_pdu_encoder_t; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 7312eeeef2..187976753d 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -443,9 +443,7 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ rx_ind->sfn = dl_tti_request->SFN; rx_ind->slot = dl_tti_request->Slot; fill_mib_in_rx_ind(pdu_list, rx_ind, 0, FAPI_NR_RX_PDU_TYPE_SSB); - NR_UL_TIME_ALIGNMENT_t ul_time_alignment; - memset(&ul_time_alignment, 0, sizeof(ul_time_alignment)); - nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); + nr_ue_dl_indication(&mac->dl_info); } } dl_info->slot = dl_tti_request->Slot; @@ -729,15 +727,12 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, return; } - - NR_UL_TIME_ALIGNMENT_t ul_time_alignment; - memset(&ul_time_alignment, 0, sizeof(ul_time_alignment)); if (dl_tti_request || tx_data_request || ul_dci_request) { fapi_nr_dl_config_request_t *dl_config = get_dl_config_request(mac, slot); fill_dci_from_dl_config(&mac->dl_info, dl_config); } nr_ue_dl_scheduler(&mac->dl_info); - nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); + nr_ue_dl_indication(&mac->dl_info); if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort(); @@ -1085,7 +1080,8 @@ void handle_ssb_meas(NR_UE_MAC_INST_t *mac, uint8_t ssb_index, int16_t rsrp_dbm) // L2 Abstraction Layer // Note: sdu should always be processed because data and timing advance updates are transmitted by the UE -int8_t handle_dlsch(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){ +int8_t handle_dlsch(nr_downlink_indication_t *dl_info, int pdu_id) +{ /* L1 assigns harq_pid, but in emulated L1 mode we need to assign the harq_pid based on the saved global g_harq_pid. Because we are emulating L1, no antenna measurements are conducted to calculate @@ -1097,7 +1093,7 @@ int8_t handle_dlsch(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid, dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack); if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack) - nr_ue_send_sdu(dl_info, ul_time_alignment, pdu_id); + nr_ue_send_sdu(dl_info, pdu_id); return 0; } @@ -1142,8 +1138,8 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info) return 0; } -int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment){ - +int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) +{ pthread_mutex_lock(&mac_IF_mutex); uint32_t ret_mask = 0x0; module_id_t module_id = dl_info->module_id; @@ -1193,13 +1189,12 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ if (dl_info->rx_ind != NULL) { - for (int i=0; irx_ind->number_pdus; ++i) { + for (int i = 0; i < dl_info->rx_ind->number_pdus; ++i) { fapi_nr_rx_indication_body_t rx_indication_body = dl_info->rx_ind->rx_indication_body[i]; - LOG_D(NR_MAC, "In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n", - __FUNCTION__, - rx_indication_body.pdu_type, - dl_info->rx_ind->number_pdus); + LOG_D(NR_MAC, "Sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n", + rx_indication_body.pdu_type, + dl_info->rx_ind->number_pdus); switch(rx_indication_body.pdu_type){ case FAPI_NR_RX_PDU_TYPE_SSB: @@ -1226,10 +1221,10 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ rx_indication_body.pdsch_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_SIB; break; case FAPI_NR_RX_PDU_TYPE_DLSCH: - ret_mask |= (handle_dlsch(dl_info, ul_time_alignment, i)) << FAPI_NR_RX_PDU_TYPE_DLSCH; + ret_mask |= (handle_dlsch(dl_info, i)) << FAPI_NR_RX_PDU_TYPE_DLSCH; break; case FAPI_NR_RX_PDU_TYPE_RAR: - ret_mask |= (handle_dlsch(dl_info, ul_time_alignment, i)) << FAPI_NR_RX_PDU_TYPE_RAR; + ret_mask |= (handle_dlsch(dl_info, i)) << FAPI_NR_RX_PDU_TYPE_RAR; break; case FAPI_NR_CSIRS_IND: ret_mask |= (handle_csirs_measurements(dl_info->module_id, diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index 91775794ed..e80459ee5f 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -195,7 +195,7 @@ typedef void (nr_ue_synch_request_f)(nr_synch_request_t *synch_request); * -1: Failed to consume bytes. Abort the mission. * Non-negative return values indicate success, and ignored. */ -typedef int (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment); +typedef int (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info); /* * Generic type of an application-defined callback to return various @@ -256,7 +256,7 @@ int nr_ue_if_module_kill(uint32_t module_id); /**\brief interface between L1/L2, indicating the downlink related information, like dci_ind and rx_req \param dl_info including dci_ind and rx_request messages*/ -int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment); +int nr_ue_dl_indication(nr_downlink_indication_t *dl_info); int nr_ue_ul_indication(nr_uplink_indication_t *ul_info); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 5bee6db0f1..1f14eae9f6 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -489,7 +489,7 @@ void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, NR_CellGr // DRB Configuration for (int i = bearer_id_start; i < bearer_id_start + nb_bearers_to_setup; i++ ){ const NR_RLC_Config_PR rlc_conf = use_rlc_um_for_drb ? NR_RLC_Config_PR_um_Bi_Directional : NR_RLC_Config_PR_am; - NR_RLC_BearerConfig_t *rlc_BearerConfig = get_DRB_RLC_BearerConfig(3 + i, i, rlc_conf, priority[0]); // Fixme: priority hardcoded see caller function, all is wrong + NR_RLC_BearerConfig_t *rlc_BearerConfig = get_DRB_RLC_BearerConfig(3 + i, i, rlc_conf, priority[i - 1]); asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); asn1cSeqAdd(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); } diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 54b2ae48c4..46627636de 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -619,7 +619,8 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, NR_ServingCellConfigCommon_t *scc, int numerology, int rbsize, - int mcs_table) { + int mcs_table_dl, + int mcs_table_ul) { NR_Phy_Parameters_t *phy_Parameters = &cap->phy_Parameters; int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; @@ -627,10 +628,15 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, nr_bandnr->bandNR = band; asn1cSeqAdd(&cap->rf_Parameters.supportedBandListNR.list, nr_bandnr); - if (mcs_table == 1) { + NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[0]; + + if (mcs_table_ul == 1) { + bandNRinfo->pusch_256QAM = CALLOC(1,sizeof(*bandNRinfo->pusch_256QAM)); + *bandNRinfo->pusch_256QAM = NR_BandNR__pusch_256QAM_supported; + } + if (mcs_table_dl == 1) { int bw = get_supported_band_index(numerology, band, rbsize); if (band>256) { - NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[0]; bandNRinfo->pdsch_256QAM_FR2 = CALLOC(1,sizeof(*bandNRinfo->pdsch_256QAM_FR2)); *bandNRinfo->pdsch_256QAM_FR2 = NR_BandNR__pdsch_256QAM_FR2_supported; } @@ -949,11 +955,54 @@ static void scheduling_request_config(const NR_ServingCellConfigCommon_t *scc, N asn1cSeqAdd(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig); } +static void set_ul_mcs_table(const NR_UE_NR_Capability_t *cap, + const NR_ServingCellConfigCommon_t *scc, + NR_PUSCH_Config_t *pusch_Config) +{ + + if (cap == NULL){ + pusch_Config->mcs_Table = NULL; + return; + } + + int band; + if (scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList) + band = *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; + else + band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + bool supported = false; + for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { + NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; + if(bandNRinfo->bandNR == band && bandNRinfo->pusch_256QAM) { + supported = true; + break; + } + } + if (supported) { + if(pusch_Config->transformPrecoder == NULL || + *pusch_Config->transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) { + if(pusch_Config->mcs_Table == NULL) + pusch_Config->mcs_Table = calloc(1, sizeof(*pusch_Config->mcs_Table)); + *pusch_Config->mcs_Table = NR_PUSCH_Config__mcs_Table_qam256; + } + else { + if(pusch_Config->mcs_TableTransformPrecoder == NULL) + pusch_Config->mcs_TableTransformPrecoder = calloc(1, sizeof(*pusch_Config->mcs_TableTransformPrecoder)); + *pusch_Config->mcs_TableTransformPrecoder = NR_PUSCH_Config__mcs_TableTransformPrecoder_qam256; + } + } + else { + pusch_Config->mcs_Table = NULL; + pusch_Config->mcs_TableTransformPrecoder = NULL; + } +} + static void set_dl_mcs_table(int scs, const NR_UE_NR_Capability_t *cap, NR_BWP_DownlinkDedicated_t *bwp_Dedicated, const NR_ServingCellConfigCommon_t *scc) { + if (cap == NULL){ bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NULL; return; @@ -992,7 +1041,9 @@ static void set_dl_mcs_table(int scs, bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NULL; } -static struct NR_SetupRelease_PUSCH_Config *config_pusch(NR_PUSCH_Config_t *pusch_Config) +static struct NR_SetupRelease_PUSCH_Config *config_pusch(NR_PUSCH_Config_t *pusch_Config, + const NR_ServingCellConfigCommon_t *scc, + const NR_UE_NR_Capability_t *uecap) { struct NR_SetupRelease_PUSCH_Config *setup_puschconfig = calloc(1, sizeof(*setup_puschconfig)); setup_puschconfig->present = NR_SetupRelease_PUSCH_Config_PR_setup; @@ -1057,8 +1108,7 @@ static struct NR_SetupRelease_PUSCH_Config *config_pusch(NR_PUSCH_Config_t *pusc pusch_Config->resourceAllocation = NR_PUSCH_Config__resourceAllocation_resourceAllocationType1; pusch_Config->pusch_TimeDomainAllocationList = NULL; pusch_Config->pusch_AggregationFactor = NULL; - pusch_Config->mcs_Table = NULL; - pusch_Config->mcs_TableTransformPrecoder = NULL; + set_ul_mcs_table(uecap, scc, pusch_Config); pusch_Config->transformPrecoder = NULL; if (!pusch_Config->codebookSubset) pusch_Config->codebookSubset = calloc(1, sizeof(*pusch_Config->codebookSubset)); @@ -1261,7 +1311,7 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp, bwp_loop < servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count) { pusch_Config = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_loop]->bwp_Dedicated->pusch_Config->choice.setup; } - ubwp->bwp_Dedicated->pusch_Config = config_pusch(pusch_Config); + ubwp->bwp_Dedicated->pusch_Config = config_pusch(pusch_Config, scc, configuration->force_256qam_off ? NULL : uecap); long maxMIMO_Layers = servingcellconfigdedicated && servingcellconfigdedicated->uplinkConfig @@ -2057,7 +2107,7 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, config_pucch_resset1(pucch_Config, NULL); set_pucch_power_config(pucch_Config, configuration->do_CSIRS); - initialUplinkBWP->pusch_Config = config_pusch(NULL); + initialUplinkBWP->pusch_Config = config_pusch(NULL, scc, NULL); long maxMIMO_Layers = uplinkConfig && uplinkConfig->pusch_ServingCellConfig && uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 @@ -2385,6 +2435,10 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, configuration->force_256qam_off ? NULL : uecap, bwp_Dedicated, scc); + + NR_BWP_UplinkDedicated_t *ul_bwp_Dedicated = SpCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; + set_ul_mcs_table(configuration->force_256qam_off ? NULL : uecap, scc, ul_bwp_Dedicated->pusch_Config->choice.setup); + struct NR_ServingCellConfig__downlinkBWP_ToAddModList *DL_BWP_list = SpCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; struct NR_UplinkConfig__uplinkBWP_ToAddModList *UL_BWP_list = uplinkConfig->uplinkBWP_ToAddModList; @@ -2395,12 +2449,13 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, set_dl_mcs_table(scs, configuration->force_256qam_off ? NULL : uecap, bwp->bwp_Dedicated, scc); } } - if (configuration->do_SRS && UL_BWP_list) { + if (UL_BWP_list) { for (int i = 0; i < UL_BWP_list->list.count; i++) { NR_BWP_Uplink_t *ul_bwp = UL_BWP_list->list.array[i]; int bwp_size = NRRIV2BW(ul_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); if (ul_bwp->bwp_Dedicated->pusch_Config) { NR_PUSCH_Config_t *pusch_Config = ul_bwp->bwp_Dedicated->pusch_Config->choice.setup; + set_ul_mcs_table(configuration->force_256qam_off ? NULL : uecap, scc, pusch_Config); if (pusch_Config->maxRank == NULL) { pusch_Config->maxRank = calloc(1, sizeof(*pusch_Config->maxRank)); } @@ -2609,7 +2664,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC pusch_Config = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup; } - initialUplinkBWP->pusch_Config = config_pusch(pusch_Config); + initialUplinkBWP->pusch_Config = config_pusch(pusch_Config, servingcellconfigcommon, uecap); long maxMIMO_Layers = servingcellconfigdedicated->uplinkConfig && servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index bf8a22a9e7..592d14bf01 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -44,8 +44,8 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, NR_ServingCellConfigCommon_t *scc, int numerology, int rbsize, - int mcs_table); - + int mcs_table_dl, + int mcs_table_ul); NR_BCCH_BCH_Message_t *get_new_MIB_NR(const NR_ServingCellConfigCommon_t *scc); void free_MIB_NR(NR_BCCH_BCH_Message_t *mib); @@ -80,5 +80,4 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC const gNB_RrcConfigurationReq *configuration, int uid); - #endif diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 6497874ab6..87d786b773 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -121,7 +121,7 @@ void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe); \ *ptrsMcs Pointer to L_ptrs MCS related parameters \ *epre_Ratio Pointer to ep_ratio \ *reOffset Pointer to RE Offset Value */ -void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMcs, int *epre_Ratio, int * reOffset); +void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset); void nr_rrc_mac_remove_ue(rnti_t rntiP); void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a3dd0891f5..dff2da86c8 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -664,7 +664,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( //----------------------------------------------------------------------------- { gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; - long drb_priority[1] = {13}; // For now, we assume only one drb per pdu sessions with a default preiority (will be dynamique in future) + long drb_priority[NGAP_MAX_DRBS_PER_UE]; NR_CellGroupConfig_t *cellGroupConfig = NULL; int xid = -1; @@ -696,6 +696,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration( } xid = ue_p->pduSession[j].xid; + drb_priority[DRB_config->drb_Identity - 1] = 13; // For now, we assume only one drb per pdu sessions with a default preiority (will be dynamique in future) } /* If list is empty free the list and reset the address */ diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index ffe8d0438a..bb107d8592 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -77,36 +77,39 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon } /* Function to set or overwrite PTRS DL RRC parameters */ -void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMcs, int *epre_Ratio, int * reOffset) +void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset) { int i=0; + NR_DMRS_DownlinkConfig_t *tmp = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; + // struct NR_SetupRelease_PTRS_DownlinkConfig *tmp=bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS; /* check for memory allocation */ - if(bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS == NULL) { - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup= calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio = calloc(1,sizeof(long)); - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = calloc(1,sizeof(long)); + if (tmp->phaseTrackingRS == NULL) { + asn1cCalloc(tmp->phaseTrackingRS, TrackingRS); + TrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; + asn1cCalloc(TrackingRS->choice.setup, setup); + asn1cCalloc(setup->frequencyDensity, freqD); /* Fill the given values */ for(i = 0; i < 2; i++) { - asn1cSeqAdd(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list,&ptrsNrb[i]); + asn1cSequenceAdd(freqD->list, long, nbr); + *nbr = ptrsNrb[i]; } + asn1cCalloc(setup->timeDensity, timeD); for(i = 0; i < 3; i++) { - asn1cSeqAdd(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list,&ptrsMcs[i]); + asn1cSequenceAdd(timeD->list, long, mcs); + *mcs = ptrsMcs[i]; } - }// if memory exist then over write the old values - else { + asn1cCallocOne(setup->epre_Ratio, epre_Ratio[0]); + asn1cCallocOne(setup->resourceElementOffset, reOffset[0]); + } else { + NR_PTRS_DownlinkConfig_t *TrackingRS = tmp->phaseTrackingRS->choice.setup; for(i = 0; i < 2; i++) { - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] = ptrsNrb[i]; + *TrackingRS->frequencyDensity->list.array[i] = ptrsNrb[i]; } for(i = 0; i < 3; i++) { - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] = ptrsMcs[i]; + *TrackingRS->timeDensity->list.array[i] = ptrsMcs[i]; } + *TrackingRS->epre_Ratio = epre_Ratio[0]; + *TrackingRS->resourceElementOffset = reOffset[0]; } - - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio = *epre_Ratio; - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = *reOffset; } #endif diff --git a/openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c b/openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c index d94df434b2..741ec095c3 100644 --- a/openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c +++ b/openair3/NAS/COMMON/EMM/MSG/FGSUplinkNasTransport.c @@ -55,9 +55,11 @@ int encode_fgs_payload_container(FGSPayloadContainer *paycontainer, uint8_t iei, encoded += encode_result; } if(iei > 0){ - *(uint16_t*) (buffer+1) = htons(encoded - 3); + uint16_t tmp = htons(encoded - 3); + memcpy(buffer + 1, &tmp, sizeof(tmp)); } else { - *(uint16_t*) (buffer) = htons(encoded - 2); + uint16_t tmp = htons(encoded - 2); + memcpy(buffer, &tmp, sizeof(tmp)); } return encoded; diff --git a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c b/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c index ddda52e5f7..72dedb3f7a 100644 --- a/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c +++ b/openair3/NAS/COMMON/ESM/MSG/PduSessionEstablishmentAccept.c @@ -35,14 +35,18 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ pdu_session_establishment_accept_msg_t psea_msg; sec_nas_hdr.epd = *(buffer + (offset++)); sec_nas_hdr.sht = *(buffer + (offset++)); - sec_nas_hdr.mac = htonl(*(uint32_t *)(buffer + offset)); + uint32_t tmp; + memcpy(&tmp, buffer + offset, sizeof(tmp)); + sec_nas_hdr.mac = htonl(tmp); offset+=sizeof(sec_nas_hdr.mac); sec_nas_hdr.sqn = *(buffer + (offset++)); sec_nas_msg.epd = *(buffer + (offset++)); sec_nas_msg.sht = *(buffer + (offset++)); sec_nas_msg.msg_type = *(buffer + (offset++)); sec_nas_msg.payload_type = *(buffer + (offset++)); - sec_nas_msg.payload_len = htons(*(uint16_t *)(buffer + offset)); + uint16_t tmp16; + memcpy(&tmp16, buffer + offset, sizeof(tmp16)); + sec_nas_msg.payload_len = htons(tmp16); offset+=sizeof(sec_nas_msg.payload_len); /* Mandatory Presence IEs */ psea_msg.epd = *(buffer + (offset++)); @@ -51,12 +55,14 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_ psea_msg.msg_type = *(buffer + (offset++)); psea_msg.pdu_type = *(buffer + offset) & 0x0f; psea_msg.ssc_mode = (*(buffer + (offset++)) & 0xf0) >> 4; - psea_msg.qos_rules.length = htons(*(uint16_t *)(buffer + offset)); + memcpy(&tmp16, buffer + offset, sizeof(tmp16)); + psea_msg.qos_rules.length = htons(tmp16); offset+=sizeof(psea_msg.qos_rules.length); /* Supports the capture of only one QoS Rule, it should be changed for multiple QoS Rules */ qos_rule_t qos_rule; qos_rule.id = *(buffer + (offset++)); - qos_rule.length = htons(*(uint16_t *)(buffer + offset)); + memcpy(&tmp16, buffer + offset, sizeof(tmp16)); + qos_rule.length = htons(tmp16); offset+=sizeof(qos_rule.length); qos_rule.oc = (*(buffer + offset) & 0xE0) >> 5; qos_rule.dqr = (*(buffer + offset) & 0x10) >> 4; diff --git a/openair3/NAS/COMMON/IES/FGCNasMessageContainer.c b/openair3/NAS/COMMON/IES/FGCNasMessageContainer.c index 874f61e7b3..4e8de951a5 100644 --- a/openair3/NAS/COMMON/IES/FGCNasMessageContainer.c +++ b/openair3/NAS/COMMON/IES/FGCNasMessageContainer.c @@ -76,7 +76,8 @@ int encode_fgc_nas_message_container(FGCNasMessageContainer *nasmessagecontainer if ((encode_result = encode_octet_string(&nasmessagecontainer->nasmessagecontainercontents, buffer + encoded, len - encoded)) < 0) { return encode_result; } else { - *(uint16_t*) (buffer+1) = htons(encoded + encode_result - 3); + uint16_t tmp = htons(encoded + encode_result - 3); + memcpy(buffer + 1, &tmp, sizeof(tmp)); encoded += encode_result; } diff --git a/openair3/NAS/COMMON/IES/FGSMobileIdentity.c b/openair3/NAS/COMMON/IES/FGSMobileIdentity.c index 872fc8e53c..ea877481e6 100644 --- a/openair3/NAS/COMMON/IES/FGSMobileIdentity.c +++ b/openair3/NAS/COMMON/IES/FGSMobileIdentity.c @@ -53,8 +53,9 @@ int decode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei CHECK_IEI_DECODER(iei, *buffer); decoded++; } - - ielen = *(uint16_t*)(buffer + decoded); /* length is two bytes */ + uint16_t tmp; + memcpy(&tmp, buffer + decoded, sizeof(tmp)); + ielen = (uint8_t)tmp; decoded += 2; CHECK_LENGTH_DECODER(len - decoded, ielen); @@ -106,9 +107,11 @@ int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei } if(iei > 0){ - *(uint16_t*) (buffer+1) = htons(encoded + encoded_rc - 3); + uint16_t tmp = htons(encoded + encoded_rc - 3); + memcpy(buffer + 1, &tmp, sizeof(tmp)); } else { - *(uint16_t*) buffer = htons(encoded + encoded_rc - 2); + uint16_t tmp = htons(encoded + encoded_rc - 2); + memcpy(buffer, &tmp, sizeof(tmp)); } return (encoded + encoded_rc); diff --git a/openair3/NAS/COMMON/UTIL/TLVDecoder.h b/openair3/NAS/COMMON/UTIL/TLVDecoder.h index e8dce87d8d..941cbd850b 100644 --- a/openair3/NAS/COMMON/UTIL/TLVDecoder.h +++ b/openair3/NAS/COMMON/UTIL/TLVDecoder.h @@ -41,9 +41,13 @@ vALUE = ntohl(*(uint32_t*)(bUFFER)) >> 8; \ sIZE += sizeof(uint8_t) + sizeof(uint16_t) -#define DECODE_U32(bUFFER, vALUE, sIZE) \ - vALUE = ntohl(*(uint32_t*)(bUFFER)); \ - sIZE += sizeof(uint32_t) +#define DECODE_U32(bUFFER, vALUE, sIZE) \ + { \ + uint32_t v; \ + memcpy(&v, bUFFER, sizeof(v)); \ + vALUE = ntohl(v); \ + } \ + sIZE += sizeof(uint32_t) #if (BYTE_ORDER == LITTLE_ENDIAN) # define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \ diff --git a/openair3/NAS/COMMON/UTIL/TLVEncoder.h b/openair3/NAS/COMMON/UTIL/TLVEncoder.h index df5b58a07f..a46de3fbba 100644 --- a/openair3/NAS/COMMON/UTIL/TLVEncoder.h +++ b/openair3/NAS/COMMON/UTIL/TLVEncoder.h @@ -36,9 +36,12 @@ *(uint32_t*)(buffer) = htonl(value); \ size += sizeof(uint8_t) + sizeof(uint16_t) -#define ENCODE_U32(buffer, value, size) \ - *(uint32_t*)(buffer) = htonl(value); \ - size += sizeof(uint32_t) +#define ENCODE_U32(buffer, value, size) \ + { \ + uint32_t tmp = htonl(value); \ + memcpy(buffer, &tmp, sizeof(tmp)); \ + } \ + size += sizeof(uint32_t) #define IES_ENCODE_U8(buffer, encoded, value) \ ENCODE_U8(buffer + encoded, value, encoded) diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index e20a0fc99e..e57e3800de 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -883,7 +883,9 @@ uint8_t get_msg_type(uint8_t *pdu_buffer, uint32_t length) { msg_type = ((mm_msg_header_t *)(pdu_buffer + offset))->message_type; if (msg_type == FGS_DOWNLINK_NAS_TRANSPORT) { - msg_type = ((dl_nas_transport_t *)(pdu_buffer+ offset))->sm_nas_msg_header.message_type; + dl_nas_transport_t tmp; + memcpy(&tmp, pdu_buffer + offset, sizeof(tmp)); + msg_type = tmp.sm_nas_msg_header.message_type; } } } else { // plain 5GS NAS message diff --git a/openshift/oai-clang-bc.yaml b/openshift/oai-clang-bc.yaml new file mode 100644 index 0000000000..f882df8700 --- /dev/null +++ b/openshift/oai-clang-bc.yaml @@ -0,0 +1,39 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- + +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: "oai-clang" +spec: + runPolicy: "Serial" + nodeSelector: + kubernetes.io/hostname: theseus + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.clang.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-clang:latest" diff --git a/openshift/oai-clang-is.yaml b/openshift/oai-clang-is.yaml new file mode 100644 index 0000000000..d1d4c477f4 --- /dev/null +++ b/openshift/oai-clang-is.yaml @@ -0,0 +1,30 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: oai-clang + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true diff --git a/radio/USRP/README.md b/radio/USRP/README.md index b89cabe649..c1c555828c 100644 --- a/radio/USRP/README.md +++ b/radio/USRP/README.md @@ -39,11 +39,38 @@ Note 2: when using multiple USRPs they always have to be synchronized using "ext Last but not least you may specify that only a specfic subdevice of the USRP is used. See also https://files.ettus.com/manual/page_configuration.html#config_subdev -For example on a USRP N310 the following fields will specify that you use channel 0 of subdevice A. +For example on a USRP N310 the following fields will specify that you use channel 0 of subdevice A. You can enter this information after providing the ip addresses of the USRPs in sdr_addrs. ```bash tx_subdev = "A:0" rx_subdev = "A:0" ``` +Here is an example of the RUs configuration for a setup with 2 USRP N310. -When combining this with the multi USRP feature you can easily create a distributed antenna array with only 1 channel used at each USRP. +```bash +RUs = ( +{ + local_rf = "yes" + nb_tx = 2 + nb_rx = 2 + att_tx = 0 + att_rx = 0; + bands = [78]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + sdr_addrs = "addr0=192.168.10.2,addr1=192.168.20.2,clock_source=external,time_source=external" + tx_subdev ="A:0 B:0" + rx_subdev ="A:1 B:1" +} +); +``` +Hint: + +You cannot see TX/RX spread over multiple USRPs, if you use "internal" as a refrence of the clock and time source. + +Furthur information about synchronization on the USRP N3xx devices can be found here: https://kb.ettus.com/Using_Ethernet-Based_Synchronization_on_the_USRP%E2%84%A2_N3xx_Devices + +When combining this with the multi USRP feature you can create a distributed antenna array with only 1 channel used at each USRP. diff --git a/radio/iqplayer/DOC/iqrecordplayer_usage.md b/radio/iqplayer/DOC/iqrecordplayer_usage.md index f66c91bc26..942b00cfe9 100644 --- a/radio/iqplayer/DOC/iqrecordplayer_usage.md +++ b/radio/iqplayer/DOC/iqrecordplayer_usage.md @@ -75,7 +75,7 @@ U[HW]I ru thread Writing file header to /tmp/iqfile ``` ### Playback/replay mode -When replaying iq's received by eNB or gNB The option works only for 5MHz bandwidth because the information stored in the iq's file header regarding bandwidth is not yet properly processed. +When replaying iq's received by eNB or gNB The option works only for 40MHz bandwidth 3/4 sampling because the information stored in the iq's file header regarding bandwidth is not yet properly processed. In addition the current implementation has only been validated with nr-uesoftmodem in 5G SA configuration. In this version, mismatch between file content and run time parameters might lead to unpredictable results. In addition a file recorded on a AVX2-capable processor cannot be replayed on a non-AVX2-capable processor (this is to be further investigated). options for replay mode are: * `subframes-replay` Activate replay mode @@ -159,6 +159,6 @@ The replay feature is implemented as a oai device. * s device is automatically, dynamicaly loaded when the player feature is activated at runtime when the boolean `device.recplay.subframes-replay` option is set. ### iq's file format -The recorder adds a header containing the device type, the bandwith and a format identifier. Using these information when replaying a file has not yet been implemented, so the player only supports USRP B2xx device and 5MHz bandwith. +The recorder adds a header containing the device type, the bandwith and a format identifier. Using these information when replaying a file has not yet been implemented, so the player only supports USRP B2xx device and 40MHz bandwith 3/4 sampling. [oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)