defs.h 23.2 KB
Newer Older
ghaddab's avatar
ghaddab committed
1
/*******************************************************************************
2
    OpenAirInterface
ghaddab's avatar
ghaddab committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    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
17
18
    along with OpenAirInterface.The full GNU General Public License is
   included in this distribution in the file called "COPYING". If not,
ghaddab's avatar
ghaddab committed
19
20
21
22
23
   see <http://www.gnu.org/licenses/>.

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

ghaddab's avatar
ghaddab committed
26
  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
ghaddab's avatar
ghaddab committed
27
28

 *******************************************************************************/
29
30
31
32
33
34
35
36
37
38
39
/*
  \author R. Knopp, F. Kaltenberger
  \company EURECOM
  \email knopp@eurecom.fr
*/

#ifndef __openair_SCHED_H__
#define __openair_SCHED_H__

#include "PHY/defs.h"

knopp's avatar
   
knopp committed
40

41
enum THREAD_INDEX { OPENAIR_THREAD_INDEX = 0,
42
                    TOP_LEVEL_SCHEDULER_THREAD_INDEX,
43
                    DLC_SCHED_THREAD_INDEX,
44
45
                    openair_SCHED_NB_THREADS
                  }; // do not modify this line
46
47
48
49
50


#define OPENAIR_THREAD_PRIORITY        255


thomasl's avatar
thomasl committed
51
#define OPENAIR_THREAD_STACK_SIZE     PTHREAD_STACK_MIN //4096 //RTL_PTHREAD_STACK_MIN*6
52
53
54
//#define DLC_THREAD_STACK_SIZE        4096 //DLC stack size

enum openair_SCHED_STATUS {
55
56
57
58
59
  openair_SCHED_STOPPED=1,
  openair_SCHED_STARTING,
  openair_SCHED_STARTED,
  openair_SCHED_STOPPING
};
60
61
62
63
64
65
66
67
68
69
70
71
72
73

enum openair_ERROR {
  // HARDWARE CAUSES
  openair_ERROR_HARDWARE_CLOCK_STOPPED= 1,

  // SCHEDULER CAUSE
  openair_ERROR_OPENAIR_RUNNING_LATE,
  openair_ERROR_OPENAIR_SCHEDULING_FAILED,

  // OTHERS
  openair_ERROR_OPENAIR_TIMING_OFFSET_OUT_OF_BOUNDS,
};

enum openair_SYNCH_STATUS {
74
75
76
77
  openair_NOT_SYNCHED=1,
  openair_SYNCHED,
  openair_SCHED_EXIT
};
78
79
80
81
82
83
84
85
86
87
88


#define DAQ_AGC_ON 1
#define DAQ_AGC_OFF 0


/** @addtogroup _PHY_PROCEDURES_
 * @{
 */


89
90

/*! \brief Top-level entry routine for eNB procedures.  Called every slot by process scheduler. In even slots, it performs RX functions from previous subframe (if required).  On odd slots, it generate TX waveform for the following subframe.
knopp's avatar
   
knopp committed
91
  @param subframe Index of current subframe (0-9)
92
93
  @param phy_vars_eNB Pointer to eNB variables on which to act
  @param abstraction_flag Indicator of PHY abstraction
94
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
95
  @param *phy_vars_rn pointer to RN variables
96
*/
knopp's avatar
   
knopp committed
97
void phy_procedures_eNB_lte(uint8_t subframe,PHY_VARS_eNB **phy_vars_eNB,uint8_t abstraction_flag, relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn);
98
99

/*! \brief Top-level entry routine for UE procedures.  Called every slot by process scheduler. In even slots, it performs RX functions from previous subframe (if required).  On odd slots, it generate TX waveform for the following subframe.
100
101
102
103
  @param phy_vars_ue Pointer to UE variables on which to act
  @param eNB_id ID of eNB on which to act
  @param abstraction_flag Indicator of PHY abstraction
  @param mode calibration/debug mode
104
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
105
  @param *phy_vars_rn pointer to RN variables
106
*/
107
void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
108

109
#ifdef Rel10
110
/*! \brief Top-level entry routine for relay node procedures when acting as eNB. This proc will make us of the existing eNB procs.
111
112
113
114
115
  @param last_slot Index of last slot (0-19)
  @param next_slot Index of next_slot (0-19)
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
*/
int phy_procedures_RN_eNB_TX(unsigned char last_slot, unsigned char next_slot, relaying_type_t r_type);
116
/*! \brief Top-level entry routine for relay node procedures actinf as UE. This proc will make us of the existing UE procs.
117
118
119
120
121
122
  @param last_slot Index of last slot (0-19)
  @param next_slot Index of next_slot (0-19)
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
*/
int phy_procedures_RN_UE_RX(unsigned char last_slot, unsigned char next_slot, relaying_type_t r_type);
#endif
123

124
/*! \brief Scheduling for UE TX procedures in normal subframes.
125
  @param phy_vars_ue Pointer to UE variables on which to act
126
  @param proc Pointer to RXn-TXnp4 proc information
127
128
129
  @param eNB_id Local id of eNB on which to act
  @param abstraction_flag Indicator of PHY abstraction
  @param mode calib/normal mode
130
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
131
*/
132
void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type);
133
/*! \brief Scheduling for UE RX procedures in normal subframes.
134
135
  @param last_slot Index of last slot (0-19)
  @param phy_vars_ue Pointer to UE variables on which to act
136
  @param proc Pointer to RXn_TXnp4 proc information
137
138
139
  @param eNB_id Local id of eNB on which to act
  @param abstraction_flag Indicator of PHY abstraction
  @param mode calibration/debug mode
140
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
141
  @param phy_vars_rn pointer to RN variables
142
*/
143
int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
144

145
/*! \brief Scheduling for UE TX procedures in TDD S-subframes.
146
147
148
  @param phy_vars_ue Pointer to UE variables on which to act
  @param eNB_id Local id of eNB on which to act
  @param abstraction_flag Indicator of PHY abstraction
149
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
150
*/
knopp's avatar
   
knopp committed
151
void phy_procedures_UE_S_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,relaying_type_t r_type);
152

153
/*! \brief Scheduling for UE RX procedures in TDD S-subframes.
154
155
156
  @param phy_vars_ue Pointer to UE variables on which to act
  @param eNB_id Local id of eNB on which to act
  @param abstraction_flag Indicator of PHY abstraction
157
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
158
*/
159
void phy_procedures_UE_S_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag, relaying_type_t r_type);
160

161
/*! \brief Scheduling for eNB TX procedures in normal subframes.
162
163
  @param phy_vars_eNB Pointer to eNB variables on which to act
  @param abstraction_flag Indicator of PHY abstraction
164
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
165
  @param phy_vars_rn pointer to the RN variables
166
*/
167
void phy_procedures_eNB_TX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
168

169
/*! \brief Scheduling for eNB RX UE-specific procedures in normal subframes.
170
  @param phy_vars_eNB Pointer to eNB variables on which to act
knopp's avatar
knopp committed
171
  @param proc Pointer to RXn-TXnp4 proc information
172
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
173
*/
174
void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type);
175
176
177

/*! \brief Scheduling for eNB TX procedures in TDD S-subframes.
  @param phy_vars_eNB Pointer to eNB variables on which to act
knopp's avatar
knopp committed
178
  @param proc Pointer to RXn-TXnp4 proc information
179
180
181
182
183
184
185
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
*/

/*! \brief Scheduling for eNB RX common procedures in normal subframes.
  @param phy_vars_eNB Pointer to eNB variables on which to act
  @param abstraction_flag Indicator of PHY abstraction
*/
186
void phy_procedures_eNB_common_RX(PHY_VARS_eNB *phy_vars_eNB);
187

188
/*! \brief Scheduling for eNB TX procedures in TDD S-subframes.
189
  @param phy_vars_eNB Pointer to eNB variables on which to act
190
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
191
*/
192

193
void phy_procedures_eNB_S_TX(PHY_VARS_eNB *phy_vars_eNB,relaying_type_t r_type);
194

195
/*! \brief Scheduling for eNB RX procedures in TDD S-subframes.
196
  @param phy_vars_eNB Pointer to eNB variables on which to act
197
  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
198
*/
199
void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type);
200
201
202

/*! \brief Scheduling for eNB PRACH RX procedures 
  @param phy_vars_eNB Pointer to eNB variables on which to act
knopp's avatar
knopp committed
203
  @param proc Pointer to RXn-TXnp4 proc information
204
*/
205
void prach_procedures(PHY_VARS_eNB *eNB);
206

207
/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index.
208
209
  @param frame_parms Pointer to DL frame parameter descriptor
  @param subframe Subframe index
210
  @returns Subframe type (DL,UL,S)
211
*/
212
213


gauthier's avatar
gauthier committed
214
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
215

216
/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index.  Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler.
217
  @param Mod_id Index of eNB
knopp's avatar
   
knopp committed
218
  @param CC_id Component Carrier Index
219
  @param subframe Subframe index
220
  @returns Subframe type (DL,UL,S)
221
*/
knopp's avatar
   
knopp committed
222
lte_subframe_t get_subframe_direction(uint8_t Mod_id, uint8_t CC_id,uint8_t subframe);
223

224
/*! \brief Function to indicate PHICH transmission subframes.  Implements Table 9.1.2-1 for TDD.
225
226
227
228
  @param frame_parms Pointer to DL frame parameter descriptor
  @param subframe Subframe index
  @returns 1 if PHICH can be transmitted in subframe (always 1 for FDD)
*/
gauthier's avatar
gauthier committed
229
uint32_t is_phich_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
230

231
/*! \brief Function to compute timing of Msg3 transmission on UL-SCH (first UE transmission in RA procedure). This implements the timing in paragraph a) from Section 6.1.1 in 36.213 (p. 17 in version 8.6).  Used by eNB upon transmission of random-access response (RA_RNTI) to program corresponding ULSCH reception procedure.  Used by UE upon reception of random-access response (RA_RNTI) to program corresponding ULSCH transmission procedure.  This does not support the UL_delay field in RAR (always assumed to be 0).
232
  @param frame_parms Pointer to DL frame parameter descriptor
233
  @param current_subframe Index of subframe where RA_RNTI was received
234
235
236
237
238
  @param current_frame Index of frame where RA_RNTI was received
  @param frame Frame index where Msg3 is to be transmitted (n+6 mod 10 for FDD, different for TDD)
  @param subframe subframe index where Msg3 is to be transmitted (n, n+1 or n+2)
*/
void get_Msg3_alloc(LTE_DL_FRAME_PARMS *frame_parms,
239
240
241
242
                    uint8_t current_subframe,
                    uint32_t current_frame,
                    uint32_t *frame,
                    uint8_t *subframe);
243

244
/*! \brief Function to compute timing of Msg3 retransmission on UL-SCH (first UE transmission in RA procedure).
245
  @param frame_parms Pointer to DL frame parameter descriptor
246
  @param current_subframe Index of subframe where RA_RNTI was received
247
248
249
250
251
  @param current_frame Index of frame where RA_RNTI was received
  @param frame Frame index where Msg3 is to be transmitted (n+6 mod 10 for FDD, different for TDD)
  @param subframe subframe index where Msg3 is to be transmitted (n, n+1 or n+2)
*/
void get_Msg3_alloc_ret(LTE_DL_FRAME_PARMS *frame_parms,
252
253
254
255
                        uint8_t current_subframe,
                        uint32_t current_frame,
                        uint32_t *frame,
                        uint8_t *subframe);
256

257
/*! \brief Get ULSCH harq_pid for Msg3 from RAR subframe.  This returns n+k mod 10 (k>6) and corresponds to the rule in Section 6.1.1 from 36.213
258
259
260
261
262
   @param frame_parms Pointer to DL Frame Parameters
   @param frame Frame index
   @param current_subframe subframe of RAR transmission
   @returns harq_pid (0 ... 7)
 */
gauthier's avatar
gauthier committed
263
uint8_t get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t current_subframe);
264

265
/*! \brief Get ULSCH harq_pid from PHICH subframe
266
267
268
269
270
   @param frame_parms Pointer to DL Frame Parameters
   @param subframe subframe of PHICH
   @returns harq_pid (0 ... 7)
 */

271
/*! \brief Function to indicate failure of contention resolution or RA procedure.  It places the UE back in PRACH mode.
272
    @param Mod_id Instance index of UE
knopp's avatar
   
knopp committed
273
    @param CC_id Component Carrier Index
274
275
    @param eNB_index Index of eNB
 */
knopp's avatar
   
knopp committed
276
void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
277

278
/*! \brief Function to indicate success of contention resolution or RA procedure.
279
    @param Mod_id Instance index of UE
knopp's avatar
   
knopp committed
280
    @param CC_id Component Carrier Index
281
282
    @param eNB_index Index of eNB
 */
knopp's avatar
   
knopp committed
283
void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
284

gauthier's avatar
gauthier committed
285
uint8_t phich_subframe_to_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe);
286

287
/*! \brief Get PDSCH subframe (n+k) from PDCCH subframe n using relationship from Table 8-2 from 36.213
288
289
290
291
   @param frame_parms Pointer to DL Frame Parameters
   @param n subframe of PDCCH
   @returns PDSCH subframe (0 ... 7) (note: this is n+k from Table 8-2)
 */
gauthier's avatar
gauthier committed
292
uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
293

294
295

/*! \brief Compute ACK/NACK information for PUSCH/PUCCH for UE transmission in subframe n. This function implements table 10.1-1 of 36.213, p. 69.
296
297
298
299
300
301
  @param frame_parms Pointer to DL frame parameter descriptor
  @param harq_ack Pointer to dlsch_ue harq_ack status descriptor
  @param subframe Subframe for UE transmission (n in 36.213)
  @param o_ACK Pointer to ACK/NAK payload for PUCCH/PUSCH
  @returns status indicator for PUCCH/PUSCH transmission
*/
gauthier's avatar
gauthier committed
302
uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,harq_status_t *harq_ack,uint8_t subframe,uint8_t *o_ACK);
303

304
/*! \brief Compute UL ACK subframe from DL subframe. This is used to retrieve corresponding DLSCH HARQ pid at eNB upon reception of ACK/NAK information on PUCCH/PUSCH.  Derived from Table 10.1-1 in 36.213 (p. 69 in version 8.6)
305
306
307
308
309
  @param frame_parms Pointer to DL frame parameter descriptor
  @param subframe Subframe for UE transmission (n in 36.213)
  @param ACK_index TTI bundling index (0,1)
  @returns Subframe index for corresponding DL transmission
*/
gauthier's avatar
gauthier committed
310
uint8_t ul_ACK_subframe2_dl_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe,uint8_t ACK_index);
311

312
/*! \brief Computes number of DL subframes represented by a particular ACK received on UL (M from Table 10.1-1 in 36.213, p. 69 in version 8.6)
313
314
315
316
  @param frame_parms Pointer to DL frame parameter descriptor
  @param subframe Subframe for UE transmission (n in 36.213)
  @returns Number of DL subframes (M)
*/
gauthier's avatar
gauthier committed
317
uint8_t ul_ACK_subframe2_M(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe);
318

319
/*! \brief Indicates the SR TXOp in current subframe.  Implements Table 10.1-5 from 36.213.
320
  @param phy_vars_ue Pointer to UE variables
321
  @param proc Pointer to RXn_TXnp4 thread context
322
323
324
  @param eNB_id ID of eNB which is to receive the SR
  @returns 1 if TXOp is active.
*/
325
uint8_t is_SR_TXOp(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id);
326

327
/*! \brief Indicates the SR TXOp in current subframe for eNB and particular UE index.  Implements Table 10.1-5 from 36.213.
328
329
330
331
  @param phy_vars_eNB Pointer to eNB variables
  @param UE_id ID of UE which may be issuing the SR
  @returns 1 if TXOp is active.
*/
knopp's avatar
knopp committed
332
uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id);
333

334
/*! \brief Gives the UL subframe corresponding to a PDDCH order in subframe n
335
  @param frame_parms Pointer to DL frame parameters
knopp's avatar
knopp committed
336
  @param proc Pointer to RXn-TXnp4 proc information
337
338
339
  @param n subframe of PDCCH
  @returns UL subframe corresponding to pdcch order
*/
gauthier's avatar
gauthier committed
340
uint8_t pdcch_alloc2ul_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n);
341

342
/*! \brief Gives the UL frame corresponding to a PDDCH order in subframe n
343
344
345
346
347
  @param frame_parms Pointer to DL frame parameters
  @param frame Frame of received PDCCH
  @param n subframe of PDCCH
  @returns UL frame corresponding to pdcch order
*/
knopp's avatar
   
knopp committed
348
uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n);
349
350


gauthier's avatar
gauthier committed
351
uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
352
353


gauthier's avatar
gauthier committed
354
355
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
356
int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rnti);
357

358
void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance);
359
void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint16_t timing_advance);
360

knopp's avatar
   
knopp committed
361
unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb);
362

363
void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
364

365
/*! \brief This function retrives the resource (n1_pucch) corresponding to a PDSCH transmission in
366
367
368
subframe n-4 which is acknowledged in subframe n (for FDD) according to n1_pucch = Ncce + N1_pucch.  For
TDD, this routine computes the complex procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2)
@param phy_vars_ue Pointer to UE variables
369
@param proc Pointer to RXn-TXnp4 proc information
370
371
372
373
374
@param eNB_id Index of eNB
@param b Pointer to PUCCH payload (b[0],b[1])
@param SR 1 means there's a positive SR in parallel to ACK/NAK
@returns n1_pucch
*/
gauthier's avatar
gauthier committed
375
uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue,
376
		      UE_rxtx_proc_t *proc,
377
378
379
                      uint8_t eNB_id,
                      uint8_t *b,
                      uint8_t SR);
380

381
/*! \brief This function retrives the resource (n1_pucch) corresponding to a PDSCH transmission in
382
383
subframe n-4 which is acknowledged in subframe n (for FDD) according to n1_pucch = Ncce + N1_pucch.  For
TDD, this routine computes the procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2)
knopp's avatar
knopp committed
384
385
@param phy_vars_eNB Pointer to eNB variables
@param proc Pointer to RXn-TXnp4 proc information
386
387
388
389
390
391
392
393
394
@param eNB_id Index of eNB
@param subframe Index of subframe
@param b Pointer to PUCCH payload (b[0],b[1])
@param n1_pucch0 Pointer to n1_pucch0
@param n1_pucch1 Pointer to n1_pucch1
@param n1_pucch2 Pointer to n1_pucch2
@param n1_pucch3 Pointer to n1_pucch3
*/
void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
knopp's avatar
knopp committed
395
		      eNB_rxtx_proc_t *proc,
396
397
398
399
400
                      uint8_t UE_id,
                      int16_t *n1_pucch0,
                      int16_t *n1_pucch1,
                      int16_t *n1_pucch2,
                      int16_t *n1_pucch3);
401
402


403
/*! \brief This function retrieves the harq_pid of the corresponding DLSCH process and updates the error statistics of the DLSCH based on the received ACK info from UE along with the round index.  It also performs the fine-grain rate-adaptation based on the error statistics derived from the ACK/NAK process.
404
405
  @param UE_id Local UE index on which to act
  @param phy_vars_eNB Pointer to eNB variables on which to act
knopp's avatar
knopp committed
406
  @param proc Pointer to RXn-TXnp4 proc information
407
408
409
410
411
  @param pusch_flag Indication that feedback came from PUSCH
  @param pucch_payload Resulting payload from pucch
  @param pucch_sel Selection of n1_pucch0 or n1_pucch1 (TDD specific)
  @param SR_payload Indication of SR presence (TDD specific)
*/
412
413
void process_HARQ_feedback(uint8_t UE_id,
                           PHY_VARS_eNB *phy_vars_eNB,
knopp's avatar
knopp committed
414
			   eNB_rxtx_proc_t *proc,
415
416
417
418
                           uint8_t pusch_flag,
                           uint8_t *pucch_payload,
                           uint8_t pucch_sel,
                           uint8_t SR_payload);
419

420
/*! \brief This function retrieves the PHY UE mode. It is used as a helper function for the UE MAC.
421
  @param Mod_id Local UE index on which to act
knopp's avatar
   
knopp committed
422
  @param CC_id Component Carrier Index
423
424
  @param eNB_index ID of eNB
  @returns UE mode
425
*/
knopp's avatar
   
knopp committed
426
UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
427

428
/*! \brief This function implements the power control mechanism for PUCCH from 36.213.
429
    @param phy_vars_ue PHY variables
430
    @param proc Pointer to proc descriptor
431
432
433
434
    @param eNB_id Index of eNB
    @param pucch_fmt Format of PUCCH that is being transmitted
    @returns Transmit power
 */
435
int8_t pucch_power_cntl(PHY_VARS_UE *phy_vars_ue, UE_rxtx_proc_t *proc,uint8_t eNB_id,PUCCH_FMT_t pucch_fmt);
436

437
/*! \brief This function implements the power control mechanism for PUCCH from 36.213.
438
    @param phy_vars_ue PHY variables
439
    @param proc Pointer to proc descriptor
440
441
442
443
    @param eNB_id Index of eNB
    @param j index of type of PUSCH (SPS, Normal, Msg3)
    @returns Transmit power
 */
444
void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag);
445

446
int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id, uint8_t eNB_index);
447

448
#ifdef LOCALIZATION
449
/*! \brief This function collects eNB_UE stats and aggregate them in lists for localization
450
451
452
453
454
455
456
457
458
    @param phy_vars_ue PHY variables
    @param UE_id Index of UE
    @param frame Index of frame
    @param subframe Index of subframe
    @param UE_tx_power_dB estimated UE Tx power
    @returns -1 if updated list, 0 if calculated median
 */
double aggregate_eNB_UE_localization_stats(PHY_VARS_eNB *phy_vars_eNB, int8_t UE_id, frame_t frameP, sub_frame_t subframeP, int32_t UE_tx_power_dB);
#endif
459
LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti);
460
461
462

LTE_DL_FRAME_PARMS *get_lte_frame_parms(module_id_t Mod_id, uint8_t CC_id);

463
MU_MIMO_mode* get_mu_mimo_mode (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
464

465
466
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t harq_pid);

467
int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor);
468
469
470

int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid);

knopp's avatar
knopp committed
471
472
int16_t get_target_pusch_rx_power(module_id_t module_idP, uint8_t CC_id);
int16_t get_target_pucch_rx_power(module_id_t module_idP, uint8_t CC_id);
473

knopp's avatar
   
knopp committed
474
int get_ue_active_harq_pid(uint8_t Mod_id,uint8_t CC_id,uint16_t rnti,int frame, uint8_t subframe,uint8_t *harq_pid,uint8_t *round,uint8_t ul_flag);
475

476
477
478
479
void dump_dlsch(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe,uint8_t harq_pid);
void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe);
void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t subframe);
void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int round);
480

481
/*@}*/
482
483
484
485
486


#endif