if4_tools.c 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 27 28 29 30 31
/*******************************************************************************
    OpenAirInterface
    Copyright(c) 1999 - 2014 Eurecom

    OpenAirInterface is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.


    OpenAirInterface is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with OpenAirInterface.The full GNU General Public License is
   included in this distribution in the file called "COPYING". If not,
   see <http://www.gnu.org/licenses/>.

  Contact Information
  OpenAirInterface Admin: openair_admin@eurecom.fr
  OpenAirInterface Tech : openair_tech@eurecom.fr
  OpenAirInterface Dev  : openair4g-devel@lists.eurecom.fr

  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE

 *******************************************************************************/

/*! \file PHY/LTE_TRANSPORT/if4_tools.c
* \brief 
Sandeep Kumar's avatar
Sandeep Kumar committed
32
* \author Mauricio Gunther, S. Sandeep Kumar, Raymond Knopp
33 34 35
* \date 2016
* \version 0.1
* \company Eurecom
Sandeep Kumar's avatar
Sandeep Kumar committed
36
* \email: knopp@eurecom.fr 
37 38 39 40 41 42
* \note
* \warning
*/

#include "PHY/LTE_TRANSPORT/if4_tools.h"

Sandeep Kumar's avatar
Sandeep Kumar committed
43
// Define how data blocks are stored and transferred
44 45 46 47 48 49 50 51 52


void send_IF4(PHY_VARS_eNB *eNB, int subframe){
	eNB_proc_t *proc = &eNB->proc;
	//int frame=proc->frame_tx;
	//int subframe=proc->subframe_tx;

	LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;

Sandeep Kumar's avatar
Sandeep Kumar committed
53
	uint32_t i,j;
54 55
	float *data_block = malloc(length*sizeof(long));

Sandeep Kumar's avatar
Sandeep Kumar committed
56 57
  // Generate IF4 packet (for now DL) with frame status information
  dl_packet = gen_IF4_dl_packet( /* ADD INFO and data_block pointer */ );
58
	
Sandeep Kumar's avatar
Sandeep Kumar committed
59 60 61 62 63 64 65 66 67 68 69 70
	for(i=0; i<fp->symbols_per_tti; i++) {
    
    // Do compression of the two parts and generate data blocks
    
    symbol = eNB->common_vars.txdataF[0][0 /*antenna number*/][subframe*fp->ofdm_symbol_size*(fp->symbols_per_tti)]
    data_block[j] = Atan(symbol[fp->ofmd_symbol_size - NrOfNonZeroValues + j -1])<<16 + Atan(symbol[fp->ofmd_symbol_size - NrOfNonZeroValues + j]);
    data_block[j+NrOfNonZeroValues] = Atan(subframe[i][j+1])<<16 + Atan(subframe[i][j+2]);
    
    // Set data blocks and update subframe no./other information to generated packet
    
    
    // Write the packet(s) to the fronthaul
71
    
Sandeep Kumar's avatar
Sandeep Kumar committed
72 73
  }
  		    
74 75
}

Sandeep Kumar's avatar
Sandeep Kumar committed
76 77 78 79 80 81 82
void recv_IF4( /* ADD INFO and data_block pointer */ ) {

  // Read packet(s) from the fronthaul
  
  // Apply reverse processing - decompression
  
  // Generate and return the OFDM symbols (txdataF)
83 84 85
  
}

Sandeep Kumar's avatar
Sandeep Kumar committed
86
IF4_dl_packet gen_IF4_dl_packet( /* ADD INFO and data_block pointer */ ) {  
87 88
  IF4_dl_packet dl_packet;
  
Sandeep Kumar's avatar
Sandeep Kumar committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
  // Set destination and source address
  
  // Set Type and Sub-Type
  dl_packet.type = ; //08_0A ? 
  dl_packet.sub_type = 0x0020;

  // Leave reserved as it is 
  //dl_packet.rsvd = ;
  
  // Set frame status
  dl_packet.frame_status.ant_num = ;
  dl_packet.frame_status.ant_start = ;
  dl_packet.frame_status.rf_num = ;
  dl_packet.frame_status.sf_num = ;
  dl_packet.frame_status.sym_num = ;
  //dl_packet.frame_status.rsvd = ;
    
  // Set data blocks if sent
  if (data_block != NULL) {
    
  } else {
    
  }
  
  // Set frame check sequence
  dl_packet.fcs = ;
  
116 117 118
  return dl_packet;
}

Sandeep Kumar's avatar
Sandeep Kumar committed
119
IF4_ul_packet gen_IF4_ul_packet( /* ADD INFO and data_block pointer */ ) {
120
  IF4_ul_packet ul_packet;
Sandeep Kumar's avatar
Sandeep Kumar committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151

  // Set destination and source address
  
  // Set Type and Sub-Type
  ul_packet.type = ; //08_0A ? 
  ul_packet.sub_type = 0x0019;

  // Leave reserved as it is 
  //ul_packet.rsvd = ;
  
  // Set frame status
  ul_packet.frame_status.ant_num = ;
  ul_packet.frame_status.ant_start = ;
  ul_packet.frame_status.rf_num = ;
  ul_packet.frame_status.sf_num = ;
  ul_packet.frame_status.sym_num = ;
  //ul_packet.frame_status.rsvd = ;
    
  // Set antenna specific gain
  ul_packet.gain0.exponent = ;
  //ul_packet.gain0.rsvd = ;
  
  // Set data blocks if sent
  if (data_block != NULL) {
    
  } else {
    
  }
  
  // Set frame check sequence
  ul_packet.fcs = ;
152 153 154 155
  
  return ul_packet;
}

Sandeep Kumar's avatar
Sandeep Kumar committed
156
IF4_prach_packet gen_IF4_prach_packet( /* ADD INFO and data_block pointer */ ) {
157
  IF4_prach_packet prach_packet;
Sandeep Kumar's avatar
Sandeep Kumar committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183

  // Set destination and source address
  
  // Set Type and Sub-Type
  prach_packet.type = ; //08_0A ? 
  prach_packet.sub_type = 0x0021;

  // Leave reserved as it is 
  //prach_packet.rsvd = ;
  
  // Set LTE Prach configuration
  //prach_packet.prach_conf.rsvd = ;
  prach_packet.prach_conf.ant = ;
  prach_packet.prach_conf.rf_num = ;
  prach_packet.prach_conf.sf_num = ;
  prach_packet.prach_conf.exponent = ;  
      
  // Set data blocks if sent
  if (data_block != NULL) {
    
  } else {
    
  }
  
  // Set frame check sequence
  prach_packet.fcs = ;
184 185 186
  
  return prach_packet;
}