beamforming.c 4.26 KB
Newer Older
Cedric Roux's avatar
Cedric Roux committed
1 2 3 4 5
/*
 * 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
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
Cedric Roux's avatar
Cedric Roux committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * 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
 */
Xiwen JIANG's avatar
Xiwen JIANG committed
21

22
/*! \file PHY/MODULATION/beamforming.c
Xiwen JIANG's avatar
Xiwen JIANG committed
23
 * \brief 
24 25
 * \author X. JIANG, F. Kaltenberger, R. KNOPP
 * \date 2016
Xiwen JIANG's avatar
Xiwen JIANG committed
26 27
 * \version 0.1
 * \company Eurecom
28
 * \email: xiwen.jiang@eurecom.fr,florian.kaltenberger@eurecom.fr,raymond.knopp@eurecom.fr
Xiwen JIANG's avatar
Xiwen JIANG committed
29 30 31
 * \note
 * \warning
 */
32 33 34 35 36
#include "PHY/defs_common.h"
#include "PHY/defs_eNB.h"
#include "PHY/phy_extern.h"
#include "PHY/CODING/coding_defs.h"
#include "PHY/CODING/coding_extern.h"
Xiwen JIANG's avatar
Xiwen JIANG committed
37
#include "PHY/CODING/lte_interleaver_inline.h"
38 39
#include "PHY/LTE_TRANSPORT/transport_eNB.h"
#include "modulation_eNB.h"
40
#include "common/utils/LOG/vcd_signal_dumper.h"
Xiwen JIANG's avatar
Xiwen JIANG committed
41

42 43 44 45 46
int beam_precoding(int32_t **txdataF,
	           int32_t **txdataF_BF,
                   LTE_DL_FRAME_PARMS *frame_parms,
	           int32_t ***beam_weights,
                   int slot,
47 48
                   int symbol,
                   int aa)
Xiwen JIANG's avatar
Xiwen JIANG committed
49
{
50
  uint8_t p;
51
  //uint16_t re=0;
Xiwen JIANG's avatar
Xiwen JIANG committed
52 53 54 55
  int slot_offset_F;
  
  slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7);

Xiwen JIANG's avatar
Xiwen JIANG committed
56
  // clear txdata_BF[aa][re] for each call of ue_spec_beamforming
57
  memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size));
Xiwen JIANG's avatar
Xiwen JIANG committed
58

59
  for (p=0; p<NB_ANTENNA_PORTS_ENB; p++) {
60
    if (p<frame_parms->nb_antenna_ports_eNB || p==5) {
61 62 63 64 65 66
      multadd_cpx_vector((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size],
			 (int16_t*)beam_weights[p][aa], 
			 (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 
			 0, 
			 frame_parms->ofdm_symbol_size, 
			 15);
67
      //mult_cpx_conj_vector((int16_t*)beam_weights[p][aa], (int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size], (int16_t*)txdataF_BF[aa], frame_parms->ofdm_symbol_size, 15, 1);
68

69 70
      // if check version
      /*for (re=0;re<frame_parms->ofdm_symbol_size;re++) {
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
        if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) {
          ((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15);
          ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15);
          ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15);
          ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15);

            printf("beamforming.c:txdataF[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n",
                   p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re,
                   ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0],
                   ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1],
                   p,aa,re,
                   ((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1],
                   aa,re,
                   ((int16_t*)&txdataF_BF[aa][re])[0],
                   ((int16_t*)&txdataF_BF[aa][re])[1]);
        }
87
      }*/
88
    }
Xiwen JIANG's avatar
Xiwen JIANG committed
89
  }
90
  return 0;
Xiwen JIANG's avatar
Xiwen JIANG committed
91
}