Merge remote-tracking branch 'origin/PHY_defs_common' into integration_2025_w14_p1 (!3350)

Cleanup NR PHY common definitions
This commit is contained in:
Robert Schmidt
2025-04-03 10:13:42 +02:00
38 changed files with 92 additions and 94 deletions
+5
View File
@@ -69,6 +69,11 @@ typedef bool sl_discovery_flag_t;
#define SL_DISCOVERY_FLAG_NO false
#define SL_DISCOVERY_FLAG_YES true
typedef enum {
TDD = 1,
FDD = 0
} frame_type_t;
typedef enum link_direction_e { UNKNOWN_DIR = 0, DIR_UPLINK = 1, DIR_DOWNLINK = 2 } link_direction_t;
typedef enum rb_type_e { UNKNOWN_RADIO_BEARER = 0, SIGNALLING_RADIO_BEARER = 1, RADIO_ACCESS_BEARER = 2 } rb_type_t;
+2 -45
View File
@@ -33,8 +33,9 @@
#include <stdint.h>
#include "assertions.h"
#include "common/utils/assertions.h"
#include "common/utils/LOG/log.h"
#include "nr_common.h"
#include <complex.h>
#include <limits.h>
#define C_SRS_NUMBER (64)
#define B_SRS_NUMBER (4)
@@ -124,36 +125,6 @@ static const uint8_t bit_reverse_table_256[] = {
0x3B, 0xBB, 0x7B, 0xFB, 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF};
simde__m128i byte2bit16_lut[256];
void init_byte2bit16(void)
{
for (int s = 0; s < 256; s++) {
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], s & 1, 0);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 1) & 1, 1);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 2) & 1, 2);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 3) & 1, 3);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 4) & 1, 4);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 5) & 1, 5);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 6) & 1, 6);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 7) & 1, 7);
}
}
simde__m128i byte2m128i[256];
void init_byte2m128i(void) {
for (int s=0;s<256;s++) {
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*(s&1)),0);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>1)&1)),1);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>2)&1)),2);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>3)&1)),3);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>4)&1)),4);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>5)&1)),5);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>6)&1)),6);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>7)&1)),7);
}
}
void reverse_bits_u8(uint8_t const* in, size_t sz, uint8_t* out)
{
DevAssert(in != NULL);
@@ -1349,20 +1320,6 @@ int get_delay_idx(int delay, int max_delay_comp)
return delay_idx;
}
void init_delay_table(uint16_t ofdm_symbol_size,
int max_delay_comp,
int max_ofdm_symbol_size,
c16_t delay_table[][max_ofdm_symbol_size])
{
for (int delay = -max_delay_comp; delay <= max_delay_comp; delay++) {
for (int k = 0; k < ofdm_symbol_size; k++) {
double complex delay_cexp = cexp(I * (2.0 * M_PI * k * delay / ofdm_symbol_size));
delay_table[max_delay_comp + delay][k].r = (int16_t)round(256 * creal(delay_cexp));
delay_table[max_delay_comp + delay][k].i = (int16_t)round(256 * cimag(delay_cexp));
}
}
}
int set_default_nta_offset(frequency_range_t freq_range, uint32_t samples_per_subframe)
{
// ta_offset_samples : ta_offset = samples_per_subframe : (Δf_max x N_f / 1000)
+2 -11
View File
@@ -36,7 +36,7 @@
#include <stdint.h>
#include <stdlib.h>
#include "assertions.h"
#include "PHY/defs_common.h"
#include "common/utils/utils.h"
#define NR_MAX_PDSCH_TBS 3824
#define MAX_NUM_BEAM_PERIODS 4
@@ -83,7 +83,7 @@ static inline const char *rnti_types(nr_rnti_type_t rr)
#define MU_SCS(m) (15 << m)
#define MAX_GSCN_BAND 620 // n78 has the highest GSCN range of 619
#define NR_NUMBER_OF_SYMBOLS_PER_SLOT 14
#define NR_MAX_NB_LAYERS 4 // 8
// Since the IQ samples are represented by SQ15 R+I (see https://en.wikipedia.org/wiki/Q_(number_format)) we need to compensate when
@@ -212,15 +212,6 @@ uint32_t nr_timer_elapsed_time(const NR_timer_t *timer);
int set_default_nta_offset(frequency_range_t freq_range, uint32_t samples_per_subframe);
extern simde__m128i byte2bit16_lut[256];
void init_byte2bit16(void);
void init_byte2m128i(void);
static inline simde__m128i byte2bit16(uint8_t b)
{
return byte2bit16_lut[b];
}
static inline int get_num_dmrs(uint16_t dmrs_mask )
{
int num_dmrs=0;
-1
View File
@@ -51,7 +51,6 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "PHY/INIT/nr_phy_init.h"
#include "PHY/TOOLS/phy_scope_interface.h"
#include "PHY/defs_common.h"
#include "PHY/defs_gNB.h"
#include "PHY/defs_nr_common.h"
#include "PHY/phy_vars.h"
@@ -19,10 +19,9 @@
* contact@openairinterface.org
*/
#include "PHY/defs_common.h"
#include "PHY/sse_intrin.h"
#include "nr_rate_matching.h"
#include "common/utils/LOG/log.h"
// #define RM_DEBUG 1
-3
View File
@@ -85,7 +85,6 @@
#define LTE_CE_OFFSET LTE_CE_FILTER_LENGTH
#define TX_RX_SWITCH_SYMBOL (NUMBER_OF_SYMBOLS_PER_FRAME>>1)
#define PBCH_PDU_SIZE 3 //bytes
#define NR_NUMBER_OF_SYMBOLS_PER_SLOT 14
#define PRACH_SYMBOL 3 //position of the UL PSS wrt 2nd slot of special subframe
@@ -101,8 +100,6 @@
#define TC_NSEC_x32768 16667
typedef enum {TDD=1,FDD=0} frame_type_t;
typedef enum {EXTENDED=1,NORMAL=0} lte_prefix_type_t;
typedef enum {LOCALIZED=0,DISTRIBUTED=1} vrb_t;
-2
View File
@@ -39,12 +39,10 @@
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
#include "PHY/impl_defs_top.h"
#include "PHY/defs_common.h"
#include "PHY/CODING/nrLDPC_coding/nrLDPC_coding_interface.h"
#include "PHY/CODING/nrLDPC_extern.h"
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
#include "nfapi_nr_interface_scf.h"
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
#define MAX_NUM_RU_PER_gNB 8
#define MAX_PUCCH0_NID 8
-4
View File
@@ -34,14 +34,10 @@
#define __PHY_DEFS_NR_COMMON__H__
#include "PHY/impl_defs_top.h"
#include "defs_common.h"
#include "nfapi_nr_interface_scf.h"
#include "impl_defs_nr.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
#define nr_subframe_t lte_subframe_t
#define nr_slot_t lte_subframe_t
#define MAX_NUM_SUBCARRIER_SPACING 5
#define NR_MAX_OFDM_SYMBOL_SIZE 8192
@@ -26,6 +26,15 @@
#include "PHY/NR_REFSIG/nr_refsig_common.h"
#include "PHY/MODULATION/nr_modulation.h"
extern simde__m128i byte2bit16_lut[256];
void init_byte2bit16(void);
void init_byte2m128i(void);
static inline simde__m128i byte2bit16(uint8_t b)
{
return byte2bit16_lut[b];
}
typedef struct {
int size;
int ports;
@@ -20,12 +20,57 @@
*/
#include "nr_phy_common.h"
#include <complex.h>
#ifdef __aarch64__
#define USE_128BIT
#endif
#define PEAK_DETECT_THRESHOLD 15
simde__m128i byte2bit16_lut[256];
void init_byte2bit16(void)
{
for (int s = 0; s < 256; s++) {
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], s & 1, 0);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 1) & 1, 1);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 2) & 1, 2);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 3) & 1, 3);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 4) & 1, 4);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 5) & 1, 5);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 6) & 1, 6);
byte2bit16_lut[s] = simde_mm_insert_epi16(byte2bit16_lut[s], (s >> 7) & 1, 7);
}
}
simde__m128i byte2m128i[256];
void init_byte2m128i(void) {
for (int s=0;s<256;s++) {
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*(s&1)),0);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>1)&1)),1);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>2)&1)),2);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>3)&1)),3);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>4)&1)),4);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>5)&1)),5);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>6)&1)),6);
byte2m128i[s] = simde_mm_insert_epi16(byte2m128i[s],(1-2*((s>>7)&1)),7);
}
}
void init_delay_table(uint16_t ofdm_symbol_size,
int max_delay_comp,
int max_ofdm_symbol_size,
c16_t delay_table[][max_ofdm_symbol_size])
{
for (int delay = -max_delay_comp; delay <= max_delay_comp; delay++) {
for (int k = 0; k < ofdm_symbol_size; k++) {
double complex delay_cexp = cexp(I * (2.0 * M_PI * k * delay / ofdm_symbol_size));
delay_table[max_delay_comp + delay][k].r = (int16_t)round(256 * creal(delay_cexp));
delay_table[max_delay_comp + delay][k].i = (int16_t)round(256 * cimag(delay_cexp));
}
}
}
int16_t saturating_sub(int16_t a, int16_t b)
{
int32_t result = (int32_t)a - (int32_t)b;
+1 -1
View File
@@ -63,7 +63,7 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, int frame, int slot
{
int found = 0;
for (int id = 0; id < NR_SYMBOLS_PER_SLOT; id++) {
for (int id = 0; id < NR_NUMBER_OF_SYMBOLS_PER_SLOT; id++) {
NR_gNB_CSIRS_t *csirs = &msgTx->csirs_pdu[id];
if (csirs->active == 0) {
LOG_D(NR_PHY,"Frame %d Slot %d CSI_RS with ID %d is now active\n",frame,slot,id);
+22
View File
@@ -1,3 +1,25 @@
/*
* 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
*/
#include "PHY/defs_common.h"
double median(varArray_t *input) {
return *(double *)((uint8_t *)(input+1)+(input->size/2)*input->atomSize);
-1
View File
@@ -56,7 +56,6 @@
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "PHY/TOOLS/tools_defs.h"
#include "PHY/defs_RU.h"
#include "PHY/defs_common.h"
#include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/defs_nr_common.h"
-1
View File
@@ -42,7 +42,6 @@
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "PHY/TOOLS/tools_defs.h"
#include "PHY/defs_RU.h"
#include "PHY/defs_common.h"
#include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/defs_nr_common.h"
-1
View File
@@ -56,7 +56,6 @@
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "PHY/TOOLS/tools_defs.h"
#include "PHY/defs_RU.h"
#include "PHY/defs_common.h"
#include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/defs_nr_common.h"
-2
View File
@@ -40,7 +40,6 @@
#include "L1_nr_paramdef.h"
#include "MACRLC_nr_paramdef.h"
#include "PHY/INIT/nr_phy_init.h"
#include "PHY/defs_common.h"
#include "PHY/defs_gNB.h"
#include "PHY/defs_nr_common.h"
#include "RRC/NR/nr_rrc_config.h"
@@ -71,7 +70,6 @@
#include "ngap_messages_types.h"
#include "nr_common.h"
#include "oai_asn1.h"
#include "openair1/PHY/defs_common.h"
#include "prs_nr_paramdef.h"
#include "radio/ETHERNET/if_defs.h"
#include "rrc_messages_types.h"
@@ -26,6 +26,7 @@
#define INDEX_MAX_TBS_TABLE (93)
#include "common/utils/nr/nr_common.h"
#include "common/utils/LOG/log.h"
#include <math.h>
//Table 5.1.2.2-2
+2
View File
@@ -38,8 +38,10 @@
#include <string.h>
#include <stdbool.h>
#include "common/utils/nr/nr_common.h"
#include "common/utils/LOG/log.h"
#include "NR_CellGroupConfig.h"
#define MAX_FRAME_NUMBER 0x400
#define NR_SHORT_BSR_TABLE_SIZE 32
#define NR_LONG_BSR_TABLE_SIZE 256
@@ -30,6 +30,7 @@
*/
#include <math.h>
#include "nr_mac.h"
#include "nr_mac_common.h"
#include "common/utils/nr/nr_common.h"
-2
View File
@@ -43,8 +43,6 @@
#include "NR_BCCH-BCH-Message.h"
#include "NR_ServingCellConfigCommon.h"
#include "NR_MIB.h"
#include "PHY/TOOLS/tools_defs.h"
#include "PHY/defs_common.h"
#include "RRC/NR/nr_rrc_config.h"
#include "SCHED_NR/phy_frame_config_nr.h"
#include "T.h"
-1
View File
@@ -53,7 +53,6 @@
#include "NR_ServingCellConfig.h"
#include "NR_ServingCellConfigCommon.h"
#include "NR_TAG.h"
#include "PHY/defs_common.h"
#include "RRC/NR/MESSAGES/asn1_msg.h"
#include "RRC/NR/nr_rrc_config.h"
#include "assertions.h"
@@ -29,7 +29,6 @@
#include "NR_PDCP-Config.h"
#include "NR_QFI.h"
#include "NR_SDAP-Config.h"
#include "PHY/defs_common.h"
#include "RRC/NR/nr_rrc_common.h"
#include "SDAP/nr_sdap/nr_sdap_entity.h"
#include "asn_internal.h"
-1
View File
@@ -21,7 +21,6 @@
#include "m2ap_timers.h"
#include "assertions.h"
#include "PHY/defs_common.h" /* TODO: try to not include this */
#include "m2ap_messages_types.h"
#include "m2ap_eNB_defs.h"
#include "m2ap_ids.h"
-1
View File
@@ -35,7 +35,6 @@
#include <stdlib.h>
#include <string.h>
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "PHY/defs_common.h"
#include "common/platform_constants.h"
#include "common/utils/T/T.h"
#include "executables/softmodem-common.h"
+1 -1
View File
@@ -38,8 +38,8 @@
#include "NR_CellGroupConfig.h"
#include "NR_UE-NR-Capability.h"
#include "NR_UL-CCCH-Message.h"
#include "PHY/defs_common.h"
#include "f1ap_messages_types.h"
#include "common/platform_types.h"
struct NR_MeasurementTimingConfiguration;
struct NR_PDSCH_TimeDomainResourceAllocationList;
-1
View File
@@ -48,7 +48,6 @@
#include "NGAP_CauseRadioNetwork.h"
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
#include "OCTET_STRING.h"
#include "PHY/defs_common.h"
#include "RRC/NR/MESSAGES/asn1_msg.h"
#include "RRC/NR/mac_rrc_dl.h"
#include "RRC/NR/nr_rrc_common.h"
-1
View File
@@ -52,7 +52,6 @@
#include "NR_UERadioAccessCapabilityInformation.h"
#include "MAC/mac.h"
#include "OCTET_STRING.h"
#include "PHY/defs_common.h"
#include "RRC/NR/MESSAGES/asn1_msg.h"
#include "RRC/NR/nr_rrc_common.h"
#include "RRC/NR/nr_rrc_defs.h"
-1
View File
@@ -26,7 +26,6 @@
#include "F1AP_CauseMisc.h"
#include "F1AP_CauseProtocol.h"
#include "F1AP_CauseRadioNetwork.h"
#include "PHY/defs_common.h"
#include "T.h"
#include "asn_codecs.h"
#include "assertions.h"
-1
View File
@@ -34,7 +34,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "OCTET_STRING.h"
#include "PHY/defs_common.h"
#include "RRC/NR/nr_rrc_proto.h"
#include "T.h"
#include "asn_codecs.h"
-1
View File
@@ -40,7 +40,6 @@
#include <string.h>
#include "MESSAGES/asn1_msg.h"
#include "OCTET_STRING.h"
#include "PHY/defs_common.h"
#include "RRC/NR/nr_rrc_config.h"
#include "T.h"
#include "asn_codecs.h"
-1
View File
@@ -22,7 +22,6 @@
#include "rrc_gNB_radio_bearers.h"
#include <stddef.h>
#include "E1AP_RLC-Mode.h"
#include "PHY/defs_common.h"
#include "RRC/NR/nr_rrc_defs.h"
#include "T.h"
#include "asn_internal.h"
-1
View File
@@ -25,7 +25,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "PHY/defs_common.h"
#include "T.h"
#include "assertions.h"
#include "common/utils/T/T.h"
-1
View File
@@ -21,7 +21,6 @@
#include "x2ap_timers.h"
#include "assertions.h"
#include "PHY/defs_common.h" /* TODO: try to not include this */
#include "x2ap_messages_types.h"
#include "x2ap_eNB_defs.h"
#include "x2ap_ids.h"
-1
View File
@@ -21,7 +21,6 @@
#include "m3ap_timers.h"
#include "assertions.h"
#include "PHY/defs_common.h" /* TODO: try to not include this */
#include "m3ap_messages_types.h"
#include "m3ap_MCE_defs.h"
#include "m3ap_ids.h"
-1
View File
@@ -37,7 +37,6 @@
#include "BIT_STRING.h"
#include "ngap_msg_includes.h"
#include "OCTET_STRING.h"
#include "PHY/defs_common.h"
#include "T.h"
#include "asn_internal.h"
#include "assertions.h"
-1
View File
@@ -35,7 +35,6 @@
#include "INTEGER.h"
#include "ngap_msg_includes.h"
#include "OCTET_STRING.h"
#include "PHY/defs_common.h"
#include "T.h"
#include "assertions.h"
#include "common/utils/T/T.h"
-1
View File
@@ -39,7 +39,6 @@
#include "INTEGER.h"
#include "ngap_msg_includes.h"
#include "OCTET_STRING.h"
#include "PHY/defs_common.h"
#include "T.h"
#include "aper_encoder.h"
#include "asn_application.h"
-1
View File
@@ -30,7 +30,6 @@
#include "ngap_gNB_ue_context.h"
#include <stdint.h>
#include <stdio.h>
#include "PHY/defs_common.h"
#include "T.h"
#include "common/utils/T/T.h"
#include "ngap_common.h"