if4_tools.h 4.36 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
32
33
34
35
36
37
38
39
40
/*******************************************************************************
    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.h
* \brief 
* \author S. Sandeep Kumar, Raymond Knopp
* \date 2016
* \version 0.1
* \company Eurecom
* \email: ee13b1025@iith.ac.in, knopp@eurecom.fr 
* \note
* \warning
*/

41
42
/// Macro for IF4 packet type
#define IF4_PACKET_TYPE 0x080A 
Sandeep Kumar's avatar
Sandeep Kumar committed
43
44
45
46
#define IF4_PULFFT 0x0019 
#define IF4_PDLFFT 0x0020
#define IF4_PRACH 0x0021

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/// IF4 Frame Status (32 bits)
struct IF4_frame_status {
  /// Antenna Numbers
  uint32_t ant_num:3;
  /// Antenna Start
  uint32_t ant_start:3;
  /// Radio Frame Number
  uint32_t rf_num:16;
  /// Sub-frame Number
  uint32_t sf_num:4;
  /// Symbol Number
  uint32_t sym_num:4;
  /// Reserved
  uint32_t rsvd:2;    
};

63
64
65
typedef struct IF4_frame_status IF4_frame_status_t;
#define sizeof_IF4_frame_status_t 4 

Sandeep Kumar's avatar
Sandeep Kumar committed
66
/// IF4 Antenna Gain (16 bits)
67
68
struct IF4_gain {
  /// Reserved 
Sandeep Kumar's avatar
Sandeep Kumar committed
69
  uint16_t rsvd:10;
70
  /// FFT Exponent Output
Sandeep Kumar's avatar
Sandeep Kumar committed
71
  uint16_t exponent:6;  
72
73
};  

74
75
76
typedef struct IF4_gain IF4_gain_t;
#define sizeof_IF_gain_t 2

77
/// IF4 LTE PRACH Configuration (32 bits)
78
79
80
81
82
83
84
85
86
87
88
89
struct IF4_lte_prach_conf {
  /// Reserved
  uint32_t rsvd:3;
  /// Antenna Indication
  uint32_t ant:3;
  /// Radio Frame Number
  uint32_t rf_num:16;
  /// Sub-frame Number
  uint32_t sf_num:4;
  /// FFT Exponent Output
  uint32_t exponent:6;  
};
Sandeep Kumar's avatar
Sandeep Kumar committed
90

91
92
93
typedef struct IF4_lte_prach_conf IF4_lte_prach_conf_t;
#define sizeof_IF4_lte_prach_conf_t 4

94
95
96
97
98
99
struct IF4_dl_packet {
  /// Destination Address
  
  /// Source Address
  
  /// Type
100
  uint16_t type; 
101
  /// Sub-Type
102
  uint16_t sub_type;
103
  /// Reserved
104
  uint32_t rsvd;
105
  /// Frame Status
106
  IF4_frame_status_t frame_status;
107
  /// Data Blocks
108
  uint16_t *data_block;
109
  /// Frame Check Sequence
110
  uint32_t fcs; 
111
112
};

113
114
typedef struct IF4_dl_packet IF4_dl_packet_t;
#define sizeof_IF4_dl_packet_t 18 
Sandeep Kumar's avatar
Sandeep Kumar committed
115

116
117
118
119
120
121
struct IF4_ul_packet {
  /// Destination Address
  
  /// Source Address
  
  /// Type
122
  uint16_t type;
123
  /// Sub-Type
124
  uint16_t sub_type;
125
  /// Reserved
126
  uint32_t rsvd;
127
  /// Frame Status
128
  IF4_frame_status_t frame_status;
129
  /// Gain 0
130
  IF4_gain_t gain0;
131
  /// Gain 1
132
  IF4_gain_t gain1;
133
  /// Gain 2
134
  IF4_gain_t gain2;
135
  /// Gain 3
136
  IF4_gain_t gain3;
137
  /// Gain 4
138
  IF4_gain_t gain4;
139
  /// Gain 5
140
  IF4_gain_t gain5;
141
  /// Gain 6
142
  IF4_gain_t gain6;
143
  /// Gain 7
144
  IF4_gain_t gain7;
145
  /// Data Blocks
146
  uint16_t *data_block;
147
148
149
150
  /// Frame Check Sequence
  uint32_t fcs;
};

151
152
153
typedef struct IF4_ul_packet IF4_ul_packet_t;
#define sizeof_IF4_ul_packet_t 34 

154
struct IF4_prach_packet {
155
  /// Destination Address 
156
  
157
  /// Source Address
158
  
159
160
161
162
163
164
165
  /// Type
  uint16_t type;
  /// Sub-Type
  uint16_t sub_type;
  /// Reserved
  uint32_t rsvd;
  /// LTE Prach Configuration
166
  IF4_lte_prach_conf_t prach_conf;
167
  /// Prach Data Block (one antenna)
168
  uint16_t *data_block;
169
170
  /// Frame Check Sequence
  uint32_t fcs;
171
172
};

173
174
typedef struct IF4_prach_packet IF4_prach_packet_t;
#define sizeof_IF4_prach_packet_t 18
Sandeep Kumar's avatar
Sandeep Kumar committed
175

176
void gen_IF4_dl_packet(IF4_dl_packet_t*, eNB_rxtx_proc_t*);
177

178
void gen_IF4_ul_packet(IF4_ul_packet_t*, eNB_rxtx_proc_t*);
179

180
void gen_IF4_prach_packet(IF4_prach_packet_t*, eNB_rxtx_proc_t*);
181

182
void send_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*);
183

184
void recv_IF4(PHY_VARS_eNB*, eNB_rxtx_proc_t*, uint16_t*, uint32_t*);