sched_eNB.h 8.57 KB
Newer Older
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
Cedric Roux's avatar
Cedric Roux committed
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
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
 */
ghaddab's avatar
ghaddab committed
21

22
23
24
25
26
27
/*
  \author R. Knopp, F. Kaltenberger
  \company EURECOM
  \email knopp@eurecom.fr
*/

28
29
#ifndef __openair_SCHED_ENB_H__
#define __openair_SCHED_ENB_H__
30

31
32
#include "PHY/defs_eNB.h"
#include "PHY_INTERFACE/phy_interface.h"
knopp's avatar
   
knopp committed
33

34
enum THREAD_INDEX { OPENAIR_THREAD_INDEX = 0,
35
                    TOP_LEVEL_SCHEDULER_THREAD_INDEX,
36
                    DLC_SCHED_THREAD_INDEX,
37
38
                    openair_SCHED_NB_THREADS
                  }; // do not modify this line
39
40
41
42
43


#define OPENAIR_THREAD_PRIORITY        255


thomasl's avatar
thomasl committed
44
#define OPENAIR_THREAD_STACK_SIZE     PTHREAD_STACK_MIN //4096 //RTL_PTHREAD_STACK_MIN*6
45
//#define DLC_THREAD_STACK_SIZE        4096 //DLC stack size
fnabet's avatar
fnabet committed
46
//#define UE_SLOT_PARALLELISATION
47
48

enum openair_SCHED_STATUS {
49
50
51
52
53
  openair_SCHED_STOPPED=1,
  openair_SCHED_STARTING,
  openair_SCHED_STARTED,
  openair_SCHED_STOPPING
};
54
55
56
57
58
59
60
61
62
63
64
65
66
67

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 {
68
69
70
71
  openair_NOT_SYNCHED=1,
  openair_SYNCHED,
  openair_SCHED_EXIT
};
72

73
74
75
76
77
enum openair_HARQ_TYPE {
  openair_harq_DL = 0,
  openair_harq_UL,
  openair_harq_RA
};
78
79
80
81
82
83
84
85
86
87

#define DAQ_AGC_ON 1
#define DAQ_AGC_OFF 0


/** @addtogroup _PHY_PROCEDURES_
 * @{
 */


88
89

/*! \brief Scheduling for eNB TX procedures in normal subframes.
90
91
  @param phy_vars_eNB Pointer to eNB variables on which to act
  @param abstraction_flag Indicator of PHY abstraction
92
  @param do_meas Do inline timing measurement
93
*/
94
void phy_procedures_eNB_TX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,int do_meas);
95

96
/*! \brief Scheduling for eNB RX UE-specific procedures in normal subframes.
97
  @param phy_vars_eNB Pointer to eNB variables on which to act
knopp's avatar
knopp committed
98
  @param proc Pointer to RXn-TXnp4 proc information
99
*/
100
void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc);
101
102
103

/*! \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
104
  @param proc Pointer to RXn-TXnp4 proc information
105
106
107
108
109
110
111
  @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
*/
112
void phy_procedures_eNB_common_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc);
113

114
/*! \brief Scheduling for eNB TX procedures in TDD S-subframes.
115
116
  @param phy_vars_eNB Pointer to eNB variables on which to act
*/
117

118
void phy_procedures_eNB_S_TX(PHY_VARS_eNB *phy_vars_eNB);
119

120
/*! \brief Scheduling for eNB RX procedures in TDD S-subframes.
121
122
  @param phy_vars_eNB Pointer to eNB variables on which to act
*/
123
void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc);
124

125
/*! \brief Scheduling for eNB PRACH RX procedures
126
  @param phy_vars_eNB Pointer to eNB variables on which to act
127
  @param br_flag indicator for eMTC PRACH
128
*/
129
#ifdef Rel14
130
131
132
133
void prach_procedures(PHY_VARS_eNB *eNB,
		      int br_flag);
#else
void prach_procedures(PHY_VARS_eNB *eNB);
134
#endif
135

136
/*! \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).
137
  @param frame_parms Pointer to DL frame parameter descriptor
138
  @param current_subframe Index of subframe where RA_RNTI was received
139
140
141
142
143
  @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,
144
145
146
147
                    uint8_t current_subframe,
                    uint32_t current_frame,
                    uint32_t *frame,
                    uint8_t *subframe);
148

149
/*! \brief Function to compute timing of Msg3 retransmission on UL-SCH (first UE transmission in RA procedure).
150
  @param frame_parms Pointer to DL frame parameter descriptor
151
  @param current_subframe Index of subframe where RA_RNTI was received
152
153
154
155
156
  @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,
157
158
159
160
                        uint8_t current_subframe,
                        uint32_t current_frame,
                        uint32_t *frame,
                        uint8_t *subframe);
161

162
/*! \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
163
164
165
166
167
   @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
168
uint8_t get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t current_subframe);
169

170
/*! \brief Get ULSCH harq_pid from PHICH subframe
171
172
173
174
175
   @param frame_parms Pointer to DL Frame Parameters
   @param subframe subframe of PHICH
   @returns harq_pid (0 ... 7)
 */

176
/*! \brief Function to indicate failure of contention resolution or RA procedure.  It places the UE back in PRACH mode.
177
    @param Mod_id Instance index of UE
knopp's avatar
   
knopp committed
178
    @param CC_id Component Carrier Index
179
180
    @param eNB_index Index of eNB
 */
knopp's avatar
   
knopp committed
181
void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
182

183
/*! \brief Indicates the SR TXOp in current subframe for eNB and particular UE index.  Implements Table 10.1-5 from 36.213.
184
185
186
187
  @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
188
uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,uint8_t UE_id);
189

190
191
192
int8_t find_ue_dlsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int8_t find_ue_ulsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);

193
194


knopp's avatar
knopp committed
195

196

197
198
void schedule_response(Sched_Rsp_t *Sched_INFO);

199
LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti);
200

201
202
203
204
205
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.  Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler.
  @param Mod_id Index of eNB
  @param CC_id Component Carrier Index
  @param subframe Subframe index
  @returns Subframe type (DL,UL,S)
*/
lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe);
knopp's avatar
knopp committed
208
209


210
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);
211
212
213

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
214
215
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);
216

217
218
219
220
int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx);

void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);

221
/*@}*/
222
223
224
225
226


#endif