mac_proto.h 4.97 KB
Newer Older
ChenWeiTai's avatar
ChenWeiTai committed
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
/*
 * 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
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
 * 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
 */

/*! \file mac_proto.h
 * \brief MAC functions prototypes for gNB
 * \author Navid Nikaein and Raymond Knopp, WEI-TAI CHEN
 * \date 2010 - 2014, 2018
 * \email navid.nikaein@eurecom.fr, kroempa@gmail.com
 * \version 1.0
 * \company Eurecom, NTUST
 */
30
31
32
33

#ifndef __LAYER2_NR_MAC_PROTO_H__
#define __LAYER2_NR_MAC_PROTO_H__

34
35
#include "nr_mac_gNB.h"
#include "PHY/defs_gNB.h"
36
37
38

void mac_top_init_gNB(void);

39
40
void config_common(int Mod_idP,
                   int CC_idP,
41
		   int Nid_cell,
42
                   int nr_bandP,
43
44
		   uint64_t ssb_pattern,
		   uint16_t ssb_periodicity,
45
                   uint64_t dl_CarrierFreqP,
46
                   uint32_t dl_BandwidthP);
47

48
49
int rrc_mac_config_req_gNB(module_id_t Mod_idP, 
                           int CC_id,
50
			   int cellid,
51
                           int p_gNB,
52
                           int nr_bandP,
53
                           uint64_t ssb_pattern,
54
                           uint16_t ssb_periodicity,
55
                           uint64_t dl_CarrierFreqP,
56
57
58
59
60
                           int dl_BandwidthP,
                           NR_BCCH_BCH_Message_t *mib,
                           NR_ServingCellConfigCommon_t *servingcellconfigcommon
                           );

61
int  is_nr_UL_slot(NR_COMMON_channels_t * ccP, int slotP);
ChenWeiTai's avatar
ChenWeiTai committed
62

ChenWeiTai's avatar
ChenWeiTai committed
63
64
65
void clear_nr_nfapi_information(gNB_MAC_INST * gNB, 
                                int CC_idP,
                                frame_t frameP, 
ChenWeiTai's avatar
ChenWeiTai committed
66
                                sub_frame_t subframeP);
ChenWeiTai's avatar
ChenWeiTai committed
67

68
69
70
71
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, 
                               frame_t frameP,
                               sub_frame_t subframeP);

ChenWeiTai's avatar
ChenWeiTai committed
72
73
void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP);

knopp's avatar
knopp committed
74
75
76
77
78
79


void nr_schedule_css_dlsch_phytest(module_id_t   module_idP,
                                   frame_t       frameP,
                                   sub_frame_t   subframeP);

80
81
82
83
void nr_schedule_uss_dlsch_phytest(module_id_t   module_idP,
                                   frame_t       frameP,
                                   sub_frame_t   slotP);

knopp's avatar
knopp committed
84

85
86
87
88
89
90
void nr_configure_css_dci_initial(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params,
				  nr_scs_e scs_common,
				  nr_scs_e pdcch_scs,
				  nr_frequency_range_e freq_range,
				  uint8_t rmsi_pdcch_config,
				  uint8_t ssb_idx,
91
92
93
          uint8_t k_ssb,
          uint16_t sfn_ssb,
          uint8_t n_ssb,
94
95
				  uint16_t nb_slots_per_frame,
				  uint16_t N_RB);
knopp's avatar
knopp committed
96

97
98
99
100
101
int nr_is_dci_opportunity(nfapi_nr_search_space_t search_space,
                                nfapi_nr_coreset_t coreset,
                                uint16_t frame,
                                uint16_t slot,
                                nfapi_nr_config_request_t cfg);
knopp's avatar
knopp committed
102

Guy De Souza's avatar
Guy De Souza committed
103
void nr_configure_dci_from_pdcch_config(nfapi_nr_dl_config_pdcch_parameters_rel15_t* pdcch_params,
knopp's avatar
knopp committed
104
                                            nfapi_nr_coreset_t* coreset,
105
106
                                            nfapi_nr_search_space_t* search_space,
                                            nfapi_nr_config_request_t cfg,
Guy De Souza's avatar
Guy De Souza committed
107
                                            uint16_t N_RB);
knopp's avatar
knopp committed
108

109
110
111
112
113
114
115
116
int get_dlscs(nfapi_nr_config_request_t *cfg);

int get_ulscs(nfapi_nr_config_request_t *cfg);

int get_spf(nfapi_nr_config_request_t *cfg);

int to_absslot(nfapi_nr_config_request_t *cfg,int frame,int slot);

117
118
int get_symbolsperslot(nfapi_nr_config_request_t *cfg);

119
120
void get_band(uint32_t downlink_frequency,   uint8_t *current_band,   int32_t *current_offset, lte_frame_type_t *current_type);

121
122
123
124
uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn);

uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw);

125
126
127
128
129
130
131
132
133
134
void config_nr_mib(int Mod_idP, 
                int CC_idP,
                int p_gNBP,
                int subCarrierSpacingCommon, 
                uint32_t ssb_SubcarrierOffset,
                int dmrs_TypeA_Position,
                uint32_t pdcch_ConfigSIB1,
                int cellBarred,
                int intraFreqReselection);

135
#endif /*__LAYER2_NR_MAC_PROTO_H__*/