1 /******************************************************************************
3 * Copyright (c) 2019 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 "#DIRTY#"
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
55 //#define SLOTNUM_PER_SUBFRAME 8
57 #define SUBFRAMES_PER_SYSTEMFRAME 10
58 #define IQ_PLAYBACK_BUFFER_BYTES (XRAN_NUM_OF_SLOT_IN_TDD_LOOP*N_SYM_PER_SLOT*XRAN_MAX_PRBS*N_SC_PER_PRB*4L)
59 /* PRACH data samples are 32 bits wide, 16bits for I and 16bits for Q. Each packet contains 839 samples for long sequence or 144*14 (max) for short sequence. The payload length is 3356 octets.*/
60 #define PRACH_PLAYBACK_BUFFER_BYTES (144*14*4L)
63 #define iAssert(p) if(!(p)){fprintf(stderr,\
64 "Assertion failed: %s, file %s, line %d, val %d\n",\
65 #p, __FILE__, __LINE__, p);exit(-1);}
70 extern int iq_playback_buffer_size_dl;
71 extern int iq_playback_buffer_size_ul;
73 extern int iq_bfw_buffer_size_dl;
74 extern int iq_bfw_buffer_size_ul;
76 extern int iq_srs_buffer_size_ul;
78 extern uint8_t numCCPorts;
79 /* Number of antennas supported by front-end */
81 extern uint8_t num_eAxc;
82 /* Number of antennas supported by front-end */
83 extern int16_t *p_tx_play_buffer[MAX_ANT_CARRIER_SUPPORTED];
84 extern int32_t tx_play_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
85 extern int32_t tx_play_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
87 extern int16_t *p_tx_prach_play_buffer[MAX_ANT_CARRIER_SUPPORTED];
88 extern int32_t tx_prach_play_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
89 extern int32_t tx_prach_play_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
91 extern int16_t *p_tx_srs_play_buffer[XRAN_MAX_SECTOR_NR*XRAN_MAX_ANT_ARRAY_ELM_NR];
92 extern int32_t tx_srs_play_buffer_size[XRAN_MAX_SECTOR_NR*XRAN_MAX_ANT_ARRAY_ELM_NR];
93 extern int32_t tx_srs_play_buffer_position[XRAN_MAX_SECTOR_NR*XRAN_MAX_ANT_ARRAY_ELM_NR];
95 /* Number of antennas supported by front-end */
96 extern int16_t *p_rx_log_buffer[MAX_ANT_CARRIER_SUPPORTED];
97 extern int32_t rx_log_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
98 extern int32_t rx_log_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
100 extern int16_t *p_prach_log_buffer[MAX_ANT_CARRIER_SUPPORTED];
101 extern int32_t prach_log_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
102 extern int32_t prach_log_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
104 extern int16_t *p_srs_log_buffer[XRAN_MAX_SECTOR_NR*XRAN_MAX_ANT_ARRAY_ELM_NR];
105 extern int32_t srs_log_buffer_size[XRAN_MAX_SECTOR_NR*XRAN_MAX_ANT_ARRAY_ELM_NR];
106 extern int32_t srs_log_buffer_position[XRAN_MAX_SECTOR_NR*XRAN_MAX_ANT_ARRAY_ELM_NR];
108 extern int16_t *p_tx_buffer[MAX_ANT_CARRIER_SUPPORTED];
109 extern int32_t tx_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
111 extern int16_t *p_rx_buffer[MAX_ANT_CARRIER_SUPPORTED];
112 extern int32_t rx_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
114 /* beamforming weights for UL (O-DU) */
115 extern int16_t *p_tx_dl_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED];
116 extern int32_t tx_dl_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
117 extern int32_t tx_dl_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
119 /* beamforming weights for UL (O-DU) */
120 extern int16_t *p_tx_ul_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED];
121 extern int32_t tx_ul_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
122 extern int32_t tx_ul_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
124 /* beamforming weights for UL (O-RU) */
125 extern int16_t *p_rx_dl_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED];
126 extern int32_t rx_dl_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
127 extern int32_t rx_dl_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
129 /* beamforming weights for UL (O-RU) */
130 extern int16_t *p_rx_ul_bfw_buffer[MAX_ANT_CARRIER_SUPPORTED];
131 extern int32_t rx_ul_bfw_buffer_size[MAX_ANT_CARRIER_SUPPORTED];
132 extern int32_t rx_ul_bfw_buffer_position[MAX_ANT_CARRIER_SUPPORTED];
134 void sys_save_buf_to_file_txt(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num);
135 void sys_save_buf_to_file(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num);
136 int sys_load_file_to_buff(char *filename, char *bufname, unsigned char *pBuffer, unsigned int size, unsigned int buffers_num);
137 uint32_t app_xran_get_scs(uint8_t nMu);
138 uint16_t app_xran_get_num_rbs(uint32_t nNumerology, uint32_t nBandwidth, uint32_t nAbsFrePointA);
139 uint32_t app_xran_cal_nrarfcn(uint32_t nCenterFreq);
140 int32_t app_xran_set_slot_type(uint32_t nPhyInstanceId, uint32_t nFrameDuplexType,
141 uint32_t nTddPeriod, struct xran_slot_config *psSlotConfig);
142 uint32_t app_xran_get_tti_interval(uint8_t nMu);
146 #endif /*_XRAN_APP_COMMON_H_*/