nr_modulation.h 4.93 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*
 * 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
 */

#ifndef __NR_MODULATION_H__
#define __NR_MODULATION_H__

#include <stdint.h>
#include "PHY/defs_nr_common.h"
27
#include "PHY/defs_gNB.h"
28
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
29

30
#define DMRS_MOD_ORDER 2
31 32 33 34 35 36 37
/*Precoding matices: W[pmi][antenna_port][layer]*/
extern char nr_W_1l_2p[6][2][1];
extern char nr_W_2l_2p[3][2][2];
extern char nr_W_1l_4p[28][4][1];
extern char nr_W_2l_4p[22][4][2];
extern char nr_W_3l_4p[7][4][3];
extern char nr_W_4l_4p[5][4][4];
38 39 40 41 42 43 44 45
/*! \brief Perform NR modulation. TS 38.211 V15.4.0 subclause 5.1
  @param[in] in, Pointer to input bits
  @param[in] length, size of input bits
  @param[in] modulation_type, modulation order
  @param[out] out, complex valued modulated symbols
*/

void nr_modulation(uint32_t *in,
46
                   uint32_t length,
47 48 49
                   uint16_t mod_order,
                   int16_t *out);

50 51 52 53 54 55 56 57 58
/*! \brief Perform NR layer mapping. TS 38.211 V15.4.0 subclause 7.3.1.3
  @param[in] mod_symbs, double Pointer to modulated symbols for each codeword
  @param[in] n_layers, number of layers
  @param[in] n_symbs, number of modulated symbols
  @param[out] tx_layers, modulated symbols for each layer
*/

void nr_layer_mapping(int16_t **mod_symbs,
                         uint8_t n_layers,
59
                         uint32_t n_symbs,
60 61
                         int16_t **tx_layers);

62 63 64 65 66 67 68
/*! \brief Perform NR layer mapping. TS 38.211 V15.4.0 subclause 7.3.1.3
  @param[in] ulsch_ue, double Pointer to NR_UE_ULSCH_t struct
  @param[in] n_layers, number of layers
  @param[in] n_symbs, number of modulated symbols
  @param[out] tx_layers, modulated symbols for each layer
*/

69
void nr_ue_layer_mapping(int16_t *mod_symbs,
70
                         uint8_t n_layers,
71
                         uint32_t n_symbs,
72
                         int16_t **tx_layers);
73

74 75 76

/*!
\brief This function implements the OFDM front end processor on reception (FEP)
77 78 79
\param frame_parms Pointer to frame parameters
\param rxdata Pointer to input data in time domain
\param rxdataF Pointer to output data in frequency domain
80 81 82 83
\param symbol symbol within slot (0..12/14)
\param Ns Slot number (0..19)
\param sample_offset offset within rxdata (points to beginning of subframe)
*/
Your Name's avatar
Your Name committed
84 85
uint cal_amp(int16_t *dataIn, int len);

86

87 88 89
int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
                   int32_t *rxdata,
                   int32_t *rxdataF,
90 91
                   unsigned char symbol,
                   unsigned char Ns,
92
                   int sample_offset);
93

94 95 96 97 98 99 100 101
/*!
\brief This function implements the dft transform precoding in PUSCH
\param z Pointer to output in frequnecy domain
\param d Pointer to input in time domain
\param Msc_PUSCH number of allocated data subcarriers
*/
void nr_dft(int32_t *z,int32_t *d, uint32_t Msc_PUSCH);

102 103 104 105 106 107
int nr_beam_precoding(int32_t **txdataF,
	              int32_t **txdataF_BF,
                      NR_DL_FRAME_PARMS *frame_parms,
	              int32_t ***beam_weights,
                      int slot,
                      int symbol,
108
                      int aa,
109 110
                      int nb_antenna_ports,
                      int offset
111
);
112

113 114 115 116
void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
		       int16_t* txdata,
		       int slot,
		       int first_symbol,
117
		       int nsymb);
118

119
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp);
120

121 122
void init_timeshift_rotation(NR_DL_FRAME_PARMS *fp);

123 124 125 126
void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
			  int32_t *rxdataF,
			  int slot,
			  int first_symbol,
127
			  int nsymb);
128 129 130 131 132 133 134 135 136 137

/*! \brief Perform NR precoding. TS 38.211 V15.4.0 subclause 6.3.1.5
  @param[in] datatx_F_precoding, Pointer to n_layers*re data array
  @param[in] prec_matrix, Pointer to precoding matrix
  @param[in] n_layers, number of DLSCH layers
*/
int nr_layer_precoder(int16_t **datatx_F_precoding,
		char *prec_matrix,
		uint8_t n_layers,
		int32_t re_offset);
138 139 140 141 142

int nr_layer_precoder_cm(int16_t **datatx_F_precoding,
                int *prec_matrix,
                uint8_t n_layers,
                int32_t re_offset);
143
#endif