if4_tools.c 5.15 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
* \note
* \warning
*/

Sandeep Kumar's avatar
Sandeep Kumar committed
41 42 43 44
#ifndef USER_MODE
#include "if4_tools.h"
#include <stdint.h>
#else
45
#include "PHY/LTE_TRANSPORT/if4_tools.h"
Sandeep Kumar's avatar
Sandeep Kumar committed
46
#endif
47

Sandeep Kumar's avatar
Sandeep Kumar committed
48
// Define how data blocks are stored and transferred
49

Sandeep Kumar's avatar
Sandeep Kumar committed
50 51
//void send_IF4(PHY_VARS_eNB *eNB, int subframe){
	//eNB_proc_t *proc = &eNB->proc;
52 53 54
	//int frame=proc->frame_tx;
	//int subframe=proc->subframe_tx;

Sandeep Kumar's avatar
Sandeep Kumar committed
55
	//LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
56

Sandeep Kumar's avatar
Sandeep Kumar committed
57 58
	//uint32_t i,j;
	//float *data_block = malloc(length*sizeof(long));
59

Sandeep Kumar's avatar
Sandeep Kumar committed
60
  // Generate IF4 packet (for now DL) with frame status information
Sandeep Kumar's avatar
Sandeep Kumar committed
61
  //dl_packet = gen_IF4_dl_packet( /* ADD INFO and data_block pointer */ );
62
	
Sandeep Kumar's avatar
Sandeep Kumar committed
63
	//for(i=0; i<fp->symbols_per_tti; i++) {
Sandeep Kumar's avatar
Sandeep Kumar committed
64 65 66
    
    // Do compression of the two parts and generate data blocks
    
Sandeep Kumar's avatar
Sandeep Kumar committed
67 68 69
    //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]);
Sandeep Kumar's avatar
Sandeep Kumar committed
70 71 72 73 74
    
    // Set data blocks and update subframe no./other information to generated packet
    
    
    // Write the packet(s) to the fronthaul
75
    
Sandeep Kumar's avatar
Sandeep Kumar committed
76
  //}
Sandeep Kumar's avatar
Sandeep Kumar committed
77
  		    
Sandeep Kumar's avatar
Sandeep Kumar committed
78
//}
79

Sandeep Kumar's avatar
Sandeep Kumar committed
80 81 82 83 84 85 86
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)
87 88 89
  
}

Sandeep Kumar's avatar
Sandeep Kumar committed
90 91
struct IF4_dl_packet gen_IF4_dl_packet( /* ADD INFO and data_block pointer */ ) {  
  struct IF4_dl_packet dl_packet;
92
  
Sandeep Kumar's avatar
Sandeep Kumar committed
93 94 95
  // Set destination and source address
  
  // Set Type and Sub-Type
Sandeep Kumar's avatar
Sandeep Kumar committed
96
  dl_packet.type = 0x080A; 
Sandeep Kumar's avatar
Sandeep Kumar committed
97 98 99 100 101 102
  dl_packet.sub_type = 0x0020;

  // Leave reserved as it is 
  //dl_packet.rsvd = ;
  
  // Set frame status
Sandeep Kumar's avatar
Sandeep Kumar committed
103 104 105 106 107
  dl_packet.frame_status.ant_num = 0;
  dl_packet.frame_status.ant_start = 0;
  dl_packet.frame_status.rf_num = 0;
  dl_packet.frame_status.sf_num = 0;
  dl_packet.frame_status.sym_num = 0;
Sandeep Kumar's avatar
Sandeep Kumar committed
108 109 110
  //dl_packet.frame_status.rsvd = ;
    
  // Set data blocks if sent
Sandeep Kumar's avatar
Sandeep Kumar committed
111 112 113 114 115
  //if (data_block != NULL) {
  //  
  //} else {
  //  
  //}
Sandeep Kumar's avatar
Sandeep Kumar committed
116 117
  
  // Set frame check sequence
Sandeep Kumar's avatar
Sandeep Kumar committed
118
  dl_packet.fcs = 0;
Sandeep Kumar's avatar
Sandeep Kumar committed
119
  
120 121 122
  return dl_packet;
}

Sandeep Kumar's avatar
Sandeep Kumar committed
123 124
struct IF4_ul_packet gen_IF4_ul_packet( /* ADD INFO and data_block pointer */ ) {
  struct IF4_ul_packet ul_packet;
Sandeep Kumar's avatar
Sandeep Kumar committed
125 126 127 128

  // Set destination and source address
  
  // Set Type and Sub-Type
Sandeep Kumar's avatar
Sandeep Kumar committed
129
  ul_packet.type = 0x080A; 
Sandeep Kumar's avatar
Sandeep Kumar committed
130 131 132 133 134 135
  ul_packet.sub_type = 0x0019;

  // Leave reserved as it is 
  //ul_packet.rsvd = ;
  
  // Set frame status
Sandeep Kumar's avatar
Sandeep Kumar committed
136 137 138 139 140
  ul_packet.frame_status.ant_num = 0;
  ul_packet.frame_status.ant_start = 0;
  ul_packet.frame_status.rf_num = 0;
  ul_packet.frame_status.sf_num = 0;
  ul_packet.frame_status.sym_num = 0;
Sandeep Kumar's avatar
Sandeep Kumar committed
141 142 143
  //ul_packet.frame_status.rsvd = ;
    
  // Set antenna specific gain
Sandeep Kumar's avatar
Sandeep Kumar committed
144
  ul_packet.gain0.exponent = 0;
Sandeep Kumar's avatar
Sandeep Kumar committed
145 146 147
  //ul_packet.gain0.rsvd = ;
  
  // Set data blocks if sent
Sandeep Kumar's avatar
Sandeep Kumar committed
148 149 150 151 152
  //if (data_block != NULL) {
  //  
  //} else {
  //  
  //}
Sandeep Kumar's avatar
Sandeep Kumar committed
153 154
  
  // Set frame check sequence
Sandeep Kumar's avatar
Sandeep Kumar committed
155
  ul_packet.fcs = 0;
156 157 158 159
  
  return ul_packet;
}

Sandeep Kumar's avatar
Sandeep Kumar committed
160 161
struct IF4_prach_packet gen_IF4_prach_packet( /* ADD INFO and data_block pointer */ ) {
  struct IF4_prach_packet prach_packet;
Sandeep Kumar's avatar
Sandeep Kumar committed
162 163 164 165

  // Set destination and source address
  
  // Set Type and Sub-Type
Sandeep Kumar's avatar
Sandeep Kumar committed
166
  prach_packet.type = 0x080A; 
Sandeep Kumar's avatar
Sandeep Kumar committed
167 168 169 170 171 172 173
  prach_packet.sub_type = 0x0021;

  // Leave reserved as it is 
  //prach_packet.rsvd = ;
  
  // Set LTE Prach configuration
  //prach_packet.prach_conf.rsvd = ;
Sandeep Kumar's avatar
Sandeep Kumar committed
174 175 176 177
  prach_packet.prach_conf.ant = 0;
  prach_packet.prach_conf.rf_num = 0;
  prach_packet.prach_conf.sf_num = 0;
  prach_packet.prach_conf.exponent = 0;  
Sandeep Kumar's avatar
Sandeep Kumar committed
178 179
      
  // Set data blocks if sent
Sandeep Kumar's avatar
Sandeep Kumar committed
180 181 182 183 184
  //if (data_block != NULL) {
  //  
  //} else {
  //  
  //}
Sandeep Kumar's avatar
Sandeep Kumar committed
185 186
  
  // Set frame check sequence
Sandeep Kumar's avatar
Sandeep Kumar committed
187
  prach_packet.fcs = 0;
188 189 190
  
  return prach_packet;
} 
Sandeep Kumar's avatar
Sandeep Kumar committed
191 192 193 194 195 196 197

int main(){
  
  uint32_t i=0;
  
  return 0;
}