NR_IF_Module.h 6.93 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * 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
 */

22 23 24 25 26 27 28 29 30 31 32
/* \file NR_IF_Module.h
 * \brief data structures for L1/L2 interface modules
 * \author R. Knopp, K.H. HSU
 * \date 2018
 * \version 0.1
 * \company Eurecom / NTUST
 * \email: knopp@eurecom.fr, kai-hsiang.hsu@eurecom.fr
 * \note
 * \warning
 */

33 34 35 36
#ifndef __NR_IF_MODULE_H__
#define __NR_IF_MODULE_H__

#include "platform_types.h"
laurent's avatar
fixes  
laurent committed
37
#include <openair1/PHY/thread_NR_UE.h>
38 39
#include "fapi_nr_ue_interface.h"

40 41


42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
typedef struct {
    /// module id
  module_id_t module_id;
  /// gNB index
  uint32_t gNB_index;
  /// component carrier id
  int cc_id;
  /// frame 
  frame_t frame;
  /// slot
  int slot;

  fapi_nr_dl_config_request_t dl_config_req;
} nr_dcireq_t;

57 58 59
typedef struct {
    /// module id
    module_id_t module_id;
60 61
    /// gNB index
    uint32_t gNB_index;
62
    /// component carrier id
63
    int cc_id;
64 65 66
    /// frame 
    frame_t frame;
    /// slot
67
    int slot;
68
    /// proc is needed to signal back decoded frame number to PHY. However, this is not really FAPI procedure and should be done differently
laurent's avatar
fixes  
laurent committed
69
    UE_nr_rxtx_proc_t * proc;
70 71 72

    /// NR UE FAPI-like P7 message, direction: L1 to L2
    /// data reception indication structure
73
    fapi_nr_rx_indication_t *rx_ind;
74 75

    /// dci reception indication structure
76
    fapi_nr_dci_indication_t *dci_ind;
77 78 79

} nr_downlink_indication_t;

80 81 82 83 84 85 86 87 88 89 90 91

typedef struct {
    /// module id
    module_id_t module_id;
    /// gNB index
    uint32_t gNB_index;
    /// component carrier id
    int cc_id;
    /// frame 
    frame_t frame;
    /// slot
    uint32_t slot;
92
    /// ssb_index, if ssb is not present in current TTI, thie value set to -1
93
    int ssb_index;
94 95
} nr_uplink_indication_t;

96 97 98 99 100 101 102
// Downlink subframe P7


typedef struct {
    /// module id
    module_id_t module_id; 
    /// component carrier id
103
    int CC_id;
104 105 106 107 108
    /// frame
    frame_t frame;
    /// subframe
    sub_frame_t subframe;
    /// slot
109
    int slot;
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130

    /// NR UE FAPI-like P7 message, direction: L2 to L1
    /// downlink transmission configuration request structure
    fapi_nr_dl_config_request_t *dl_config;

    /// uplink transmission configuration request structure
    fapi_nr_ul_config_request_t *ul_config;

    /// data transmission request structure
    fapi_nr_tx_request_t *tx_request;

} nr_scheduled_response_t;

typedef struct {
    /// module id
    uint8_t Mod_id;
    /// component carrier id
    uint8_t CC_id;
    
    /// NR UE FAPI-like P5 message
    /// physical layer configuration request structure
131
    fapi_nr_config_request_t config_req;
132 133 134 135 136 137 138 139 140 141 142

} nr_phy_config_t;


/*
 * Generic type of an application-defined callback to return various
 * types of data to the application.
 * EXPECTED RETURN VALUES:
 *  -1: Failed to consume bytes. Abort the mission.
 * Non-negative return values indicate success, and ignored.
 */
143
typedef int8_t (nr_ue_scheduled_response_f)(nr_scheduled_response_t *scheduled_response);
144 145 146 147 148 149 150 151 152


/*
 * Generic type of an application-defined callback to return various
 * types of data to the application.
 * EXPECTED RETURN VALUES:
 *  -1: Failed to consume bytes. Abort the mission.
 * Non-negative return values indicate success, and ignored.
 */
153
typedef int8_t (nr_ue_phy_config_request_f)(nr_phy_config_t *phy_config);
154 155 156 157 158 159 160 161 162


/*
 * Generic type of an application-defined callback to return various
 * types of data to the application.
 * EXPECTED RETURN VALUES:
 *  -1: Failed to consume bytes. Abort the mission.
 * Non-negative return values indicate success, and ignored.
 */
163
typedef int (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info);
164

165 166 167 168 169 170 171
/*
 * Generic type of an application-defined callback to return various
 * types of data to the application.
 * EXPECTED RETURN VALUES:
 *  -1: Failed to consume bytes. Abort the mission.
 * Non-negative return values indicate success, and ignored.
 */
172 173 174
typedef int (nr_ue_ul_indication_f)(nr_uplink_indication_t *ul_info);

typedef int (nr_ue_dcireq_f)(nr_dcireq_t *ul_info);
175 176

//  TODO check this stuff can be reuse of need modification
177
typedef struct nr_ue_if_module_s {
178 179 180 181
  nr_ue_scheduled_response_f *scheduled_response;
  nr_ue_phy_config_request_f *phy_config_request;
  nr_ue_dl_indication_f      *dl_indication;
  nr_ue_ul_indication_f      *ul_indication;
182
  //nr_ue_dcireq_f             *dcireq;
183 184 185 186
  uint32_t cc_mask;
  uint32_t current_frame;
  uint32_t current_slot;
  //pthread_mutex_t nr_if_mutex;
187 188 189 190 191 192 193 194 195 196
} nr_ue_if_module_t;


/**\brief reserved one of the interface(if) module instantce from pointer pool and done memory allocation by module_id.
   \param module_id module id*/
nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id);


/**\brief done free of memory allocation by module_id and release to pointer pool.
   \param module_id module id*/
197
int nr_ue_if_module_kill(uint32_t module_id);
198 199 200 201


/**\brief interface between L1/L2, indicating the downlink related information, like dci_ind and rx_req
   \param dl_info including dci_ind and rx_request messages*/
202 203 204
int nr_ue_dl_indication(nr_downlink_indication_t *dl_info);

int nr_ue_ul_indication(nr_uplink_indication_t *ul_info);
205

206
int nr_ue_dcireq(nr_dcireq_t *dcireq);
207

208
//  TODO check
209
/**\brief handle BCCH-BCH message from dl_indication
210 211 212
   \param pduP            pointer to bch pdu
   \param additional_bits corresponding to 38.212 ch.7
   \param ssb_index       SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i
213 214
   \param ssb_length      corresponding to L1 parameter L_ssb 
   \param cell_id         cell id */
laurent's avatar
fixes  
laurent committed
215
int handle_bcch_bch(UE_nr_rxtx_proc_t *proc, module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id);
216

217
//  TODO check
218 219 220
/**\brief handle BCCH-DL-SCH message from dl_indication
   \param pdu_len   length(bytes) of pdu
   \param pduP      pointer to pdu*/
221
int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint32_t sibs_mask, uint8_t *pduP, uint32_t pdu_len);
222

223
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, fapi_nr_dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_type);
224 225 226

#endif