[GITLAB] - UPGRADE TO v12 on Wednesday the 18th of December at 11.30AM

pilots.c 7.64 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * 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.0  (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
 */

22 23 24 25 26 27 28 29 30 31 32 33 34
/*! \file PHY/LTE_TRANSPORT/pilots.c
* \brief Top-level routines for generating DL cell-specific reference signals V8.6 2009-03
* \author R. Knopp, F. Kaltenberger
* \date 2011
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr,florian.kaltenberger.fr
* \note
* \warning
*/
//#include "defs.h"
#include "PHY/defs.h"

35
void generate_pilots(PHY_VARS_eNB *eNB,
36
                     int32_t **txdataF,
37 38 39
                     int16_t amp,
                     uint16_t Ntti)
{
40

41
  LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
42

43 44
  uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol;
  uint8_t second_pilot;
45 46 47 48 49 50 51 52



  Nsymb = (frame_parms->Ncp==0)?14:12;
  second_pilot = (frame_parms->Ncp==0)?4:3;

  //  printf("Doing TX pilots Nsymb %d, second_pilot %d\n",Nsymb,second_pilot);

53 54 55
  for (tti=0; tti<Ntti; tti++) {


56 57 58 59 60


    tti_offset = tti*frame_parms->ofdm_symbol_size*Nsymb;
    samples_per_symbol = frame_parms->ofdm_symbol_size;
    slot_offset = (tti*2)%20;
61

62 63
    //    printf("tti %d : offset %d (slot %d)\n",tti,tti_offset,slot_offset);
    //Generate Pilots
64

65
    //antenna 0 symbol 0 slot 0
66
    lte_dl_cell_spec(eNB,&txdataF[0][tti_offset],
67 68 69 70 71
                     amp,
                     slot_offset,
                     0,
                     0);

72 73 74

    //    printf("tti %d : second_pilot offset %d \n",tti,tti_offset+(second_pilot*samples_per_symbol));
    //antenna 0 symbol 3/4 slot 0
75
    lte_dl_cell_spec(eNB,&txdataF[0][tti_offset+(second_pilot*samples_per_symbol)],
76 77 78 79
                     amp,
                     slot_offset,
                     1,
                     0);
80

81
    //    printf("tti %d : third_pilot offset %d \n",tti,tti_offset+((Nsymb>>1)*samples_per_symbol));
82
    //antenna 0 symbol 0 slot 1
83
    lte_dl_cell_spec(eNB,&txdataF[0][tti_offset+((Nsymb>>1)*samples_per_symbol)],
84 85 86 87 88 89
                     amp,
                     1+slot_offset,
                     0,
                     0);

    //    printf("tti %d : third_pilot offset %d \n",tti,tti_offset+(((Nsymb>>1)+second_pilot)*samples_per_symbol));
90
    //antenna 0 symbol 3/4 slot 1
91
    lte_dl_cell_spec(eNB,&txdataF[0][tti_offset+(((Nsymb>>1)+second_pilot)*samples_per_symbol)],
92 93 94 95 96
                     amp,
                     1+slot_offset,
                     1,
                     0);

97 98 99

    if (frame_parms->nb_antennas_tx > 1) {
      if (frame_parms->mode1_flag) {
100
        // antenna 1 symbol 0 slot 0
101
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset],
102 103 104 105 106 107
                         amp,
                         slot_offset,
                         0,
                         0);

        // antenna 1 symbol 3 slot 0
108
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset+(second_pilot*samples_per_symbol)],
109 110 111 112 113 114
                         amp,
                         slot_offset,
                         1,
                         0);

        //antenna 1 symbol 0 slot 1
115
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset+(Nsymb>>1)*samples_per_symbol],
116 117 118 119 120 121
                         amp,
                         1+slot_offset,
                         0,
                         0);

        // antenna 1 symbol 3 slot 1
122
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset+(((Nsymb>>1)+second_pilot)*samples_per_symbol)],
123 124 125 126 127 128 129 130
                         amp,
                         1+slot_offset,
                         1,
                         0);

      } else {

        // antenna 1 symbol 0 slot 0
131
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset],
132 133 134 135 136 137
                         amp,
                         slot_offset,
                         0,
                         1);

        // antenna 1 symbol 3 slot 0
138
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset+(second_pilot*samples_per_symbol)],
139 140 141 142 143 144
                         amp,
                         slot_offset,
                         1,
                         1);

        //antenna 1 symbol 0 slot 1
145
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset+(Nsymb>>1)*samples_per_symbol],
146 147 148 149 150 151
                         amp,
                         1+slot_offset,
                         0,
                         1);

        // antenna 1 symbol 3 slot 1
152
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset+(((Nsymb>>1)+second_pilot)*samples_per_symbol)],
153 154 155 156
                         amp,
                         1+slot_offset,
                         1,
                         1);
157 158 159 160
      }
    }
  }
}
161

162
int generate_pilots_slot(PHY_VARS_eNB *eNB,
163
                         int32_t **txdataF,
164 165 166 167
                         int16_t amp,
                         uint16_t slot,
                         int first_pilot_only)
{
168

169
  LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
170 171
  uint32_t slot_offset,Nsymb,samples_per_symbol;
  uint8_t second_pilot;
172 173 174 175 176 177 178 179 180 181 182 183

  if (slot<0 || slot>= 20) {
    msg("generate_pilots_slot: slot not in range (%d)\n",slot);
    return(-1);
  }

  Nsymb = (frame_parms->Ncp==0)?7:6;
  second_pilot = (frame_parms->Ncp==0)?4:3;


  slot_offset = slot*frame_parms->ofdm_symbol_size*Nsymb;
  samples_per_symbol = frame_parms->ofdm_symbol_size;
184 185 186 187 188

  //    printf("tti %d : offset %d (slot %d)\n",tti,tti_offset,slot_offset);
  //Generate Pilots

  //antenna 0 symbol 0 slot 0
189
  lte_dl_cell_spec(eNB,
190 191 192 193 194 195
                   &txdataF[0][slot_offset],
                   amp,
                   slot,
                   0,
                   0);

196 197 198

  if (first_pilot_only==0) {
    //antenna 0 symbol 3 slot 0
199
    lte_dl_cell_spec(eNB,
200 201 202 203 204
                     &txdataF[0][slot_offset+(second_pilot*samples_per_symbol)],
                     amp,
                     slot,
                     1,
                     0);
205 206 207 208 209
  }

  if (frame_parms->nb_antennas_tx > 1) {
    if (frame_parms->mode1_flag) {
      // antenna 1 symbol 0 slot 0
210
      lte_dl_cell_spec(eNB,
211 212 213 214 215 216
                       &txdataF[1][slot_offset],
                       amp,
                       slot,
                       0,
                       0);

217
      if (first_pilot_only==0) {
218
        // antenna 1 symbol 3 slot 0
219
        lte_dl_cell_spec(eNB,
220 221 222 223 224
                         &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)],
                         amp,
                         slot,
                         1,
                         0);
225
      }
226 227
    } else {

228
      // antenna 1 symbol 0 slot 0
229
      lte_dl_cell_spec(eNB,
230 231 232 233 234
                       &txdataF[1][slot_offset],
                       amp,
                       slot,
                       0,
                       1);
235 236

      if (first_pilot_only == 0) {
237
        // antenna 1 symbol 3 slot 0
238
        lte_dl_cell_spec(eNB,
239 240 241 242 243
                         &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)],
                         amp,
                         slot,
                         1,
                         1);
244 245 246 247 248 249 250
      }
    }
  }

  return(0);
}