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

Xiwen JIANG's avatar
Xiwen JIANG committed
65
    //antenna port 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

    //    printf("tti %d : second_pilot offset %d \n",tti,tti_offset+(second_pilot*samples_per_symbol));
Xiwen JIANG's avatar
Xiwen JIANG committed
74
    //antenna port 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));
Xiwen JIANG's avatar
Xiwen JIANG committed
82
    //antenna port 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));
Xiwen JIANG's avatar
Xiwen JIANG committed
90
    //antenna port 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

Xiwen JIANG's avatar
Xiwen JIANG committed
98
    if (frame_parms->nb_antenna_ports_eNB > 1) {
99

Xiwen JIANG's avatar
Xiwen JIANG committed
100
        // antenna port 1 symbol 0 slot 0
101
        lte_dl_cell_spec(eNB,&txdataF[1][tti_offset],
102 103 104 105 106
                         amp,
                         slot_offset,
                         0,
                         1);

Xiwen JIANG's avatar
Xiwen JIANG committed
107
        // antenna port 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
                         amp,
                         slot_offset,
                         1,
                         1);

Xiwen JIANG's avatar
Xiwen JIANG committed
114
        //antenna port 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
                         amp,
                         1+slot_offset,
                         0,
                         1);

Xiwen JIANG's avatar
Xiwen JIANG committed
121
        // antenna port 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
                         amp,
                         1+slot_offset,
                         1,
                         1);
127 128 129
    }
  }
}
130

131
int generate_pilots_slot(PHY_VARS_eNB *eNB,
132
                         int32_t **txdataF,
133 134 135 136
                         int16_t amp,
                         uint16_t slot,
                         int first_pilot_only)
{
137

138
  LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
139 140
  uint32_t slot_offset,Nsymb,samples_per_symbol;
  uint8_t second_pilot;
141 142 143 144 145 146 147 148 149 150 151 152

  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;
153 154 155 156

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

Xiwen JIANG's avatar
Xiwen JIANG committed
157
  //antenna port 0 symbol 0 slot 0
158
  lte_dl_cell_spec(eNB,
159 160 161 162 163 164
                   &txdataF[0][slot_offset],
                   amp,
                   slot,
                   0,
                   0);

165 166 167

  if (first_pilot_only==0) {
    //antenna 0 symbol 3 slot 0
168
    lte_dl_cell_spec(eNB,
169 170 171 172 173
                     &txdataF[0][slot_offset+(second_pilot*samples_per_symbol)],
                     amp,
                     slot,
                     1,
                     0);
174 175
  }

Xiwen JIANG's avatar
Xiwen JIANG committed
176
  if (frame_parms->nb_antenna_ports_eNB > 1) {
177

Xiwen JIANG's avatar
Xiwen JIANG committed
178
    // antenna port 1 symbol 0 slot 0
179
    lte_dl_cell_spec(eNB,
Xiwen JIANG's avatar
Xiwen JIANG committed
180 181 182 183 184
                     &txdataF[1][slot_offset],
                     amp,
                     slot,
                     0,
                     1);
185

Xiwen JIANG's avatar
Xiwen JIANG committed
186 187
    if (first_pilot_only == 0) {
      // antenna port 1 symbol 3 slot 0
188
      lte_dl_cell_spec(eNB,
Xiwen JIANG's avatar
Xiwen JIANG committed
189
                       &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)],
190 191
                       amp,
                       slot,
Xiwen JIANG's avatar
Xiwen JIANG committed
192
                       1,
193
                       1);
194 195 196 197 198 199
    }
  }

  return(0);
}