1 /******************************************************************************
3 * Copyright (c) 2020 Intel.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 *******************************************************************************/
19 #ifndef _XRAN_APP_COMMON_H_
20 #define _XRAN_APP_COMMON_H_
25 #include "xran_fh_o_du.h"
26 #include "xran_pkt_up.h"
28 #include <rte_common.h>
31 #define VERSIONX "oran_e_maintenance_release_v1.0"
44 PHY_BW_5_0_MHZ = 5, PHY_BW_10_0_MHZ = 10, PHY_BW_15_0_MHZ = 15, PHY_BW_20_0_MHZ = 20, PHY_BW_25_0_MHZ = 25,
45 PHY_BW_30_0_MHZ = 30, PHY_BW_40_0_MHZ = 40, PHY_BW_50_0_MHZ = 50, PHY_BW_60_0_MHZ = 60, PHY_BW_70_0_MHZ = 70,
46 PHY_BW_80_0_MHZ = 80, PHY_BW_90_0_MHZ = 90, PHY_BW_100_0_MHZ = 100, PHY_BW_200_0_MHZ = 200, PHY_BW_400_0_MHZ = 400
49 #define N_SC_PER_PRB 12
50 #define N_SYM_PER_SLOT 14
51 #define MAX_ANT_CARRIER_SUPPORTED (XRAN_MAX_SECTOR_NR*XRAN_MAX_ANTENNA_NR)
52 #define MAX_ANT_CARRIER_SUPPORTED_CAT_B (XRAN_MAX_SECTOR_NR*XRAN_MAX_ANT_ARRAY_ELM_NR)
54 #define SUBFRAME_DURATION_US 1000
56 #define SUBFRAMES_PER_SYSTEMFRAME 10
57 #define IQ_PLAYBACK_BUFFER_BYTES (XRAN_NUM_OF_SLOT_IN_TDD_LOOP*N_SYM_PER_SLOT*XRAN_MAX_PRBS*N_SC_PER_PRB*4L)
58 /* PRACH data samples are 32 bits wide, 16bits for I and 16bits for Q. Each packet contains 840 samples for long sequence or 144 for short sequence. The payload length is 840*16*2/8 octets.*/
59 #ifdef FCN_1_2_6_EARLIER
60 #define PRACH_PLAYBACK_BUFFER_BYTES (144*4L)
62 #define PRACH_PLAYBACK_BUFFER_BYTES (840*4L)
66 #define iAssert(p) if(!(p)){fprintf(stderr,\
67 "Assertion failed: %s, file %s, line %d, val %d\n",\
68 #p, __FILE__, __LINE__, p);exit(-1);}
73 /**< all the buffers allocated for O-XU */
75 int iq_playback_buffer_size_dl;
76 int iq_playback_buffer_size_ul;
78 int iq_bfw_buffer_size_dl;
79 int iq_bfw_buffer_size_ul;
81 int iq_srs_buffer_size_ul;
83 int16_t *p_tx_play_buffer[MAX_ANT_CARRIER_SUPPORTED];
84 int32_t tx_play_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
85 int32_t tx_play_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
87 int16_t *p_tx_prach_play_buffer[MAX_ANT_CARRIER_SUPPORTED];
88 int32_t tx_prach_play_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
89 int32_t tx_prach_play_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
91 int16_t *p_tx_srs_play_buffer[MAX_ANT_CARRIER_SUPPORTED_CAT_B];
92 int32_t tx_srs_play_buffer_size[MAX_ANT_CARRIER_SUPPORTED_CAT_B];
93 int32_t tx_srs_play_buffer_position[MAX_ANT_CARRIER_SUPPORTED_CAT_B];
95 int16_t *p_rx_log_buffer[MAX_ANT_CARRIER_SUPPORTED];
96 int32_t rx_log_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
97 int32_t rx_log_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
99 int16_t *p_prach_log_buffer[MAX_ANT_CARRIER_SUPPORTED];
100 int32_t prach_log_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
101 int32_t prach_log_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
103 int16_t *p_srs_log_buffer[MAX_ANT_CARRIER_SUPPORTED_CAT_B];
104 int32_t srs_log_buffer_size[MAX_ANT_CARRIER_SUPPORTED_CAT_B];
105 int32_t srs_log_buffer_position[MAX_ANT_CARRIER_SUPPORTED_CAT_B];
107 int16_t *p_tx_buffer[MAX_ANT_CARRIER_SUPPORTED];
108 int32_t tx_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
109 int16_t *p_rx_buffer[MAX_ANT_CARRIER_SUPPORTED];
110 int32_t rx_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
112 /* beamforming weights for UL (O-DU) */
113 int16_t *p_tx_dl_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED];
114 int32_t tx_dl_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
115 int32_t tx_dl_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
117 /* beamforming weights for UL (O-DU) */
118 int16_t *p_tx_ul_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED];
119 int32_t tx_ul_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
120 int32_t tx_ul_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
122 /* beamforming weights for UL (O-RU) */
123 int16_t *p_rx_dl_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED];
124 int32_t rx_dl_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
125 int32_t rx_dl_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
127 /* beamforming weights for UL (O-RU) */
128 int16_t *p_rx_ul_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED];
129 int32_t rx_ul_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
130 int32_t rx_ul_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
133 extern struct o_xu_buffers* p_o_xu_buff[XRAN_PORTS_NUM];
135 void sys_save_buf_to_file_txt(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num);
136 void sys_save_buf_to_file(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num);
137 int sys_load_file_to_buff(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num);
139 uint32_t app_xran_get_scs(uint8_t nMu);
140 uint16_t app_xran_get_num_rbs(uint8_t ranTech, uint32_t nNumerology, uint32_t nBandwidth, uint32_t nAbsFrePointA);
141 uint32_t app_xran_cal_nrarfcn(uint32_t nCenterFreq);
142 int32_t app_xran_set_slot_type(uint32_t nPhyInstanceId, uint32_t nFrameDuplexType,
143 uint32_t nTddPeriod, struct xran_slot_config *psSlotConfig);
144 uint32_t app_xran_get_tti_interval(uint8_t nMu);
146 #endif /*_XRAN_APP_COMMON_H_*/