Commit 0422bf8b authored by matzakos's avatar matzakos

Definition of the UE MAC interface: IF_Module_UE.h, IF_Module_UE.c,...

Definition of the UE MAC interface: IF_Module_UE.h, IF_Module_UE.c, UE_MAC_interface.h and the supporting functions.
parent ad98f5aa
......@@ -356,6 +356,8 @@ void phy_cleanup(void);
void phy_config_request(PHY_Config_t *phy_config);
void phy_config_request_ue(UE_PHY_Config_t* UE_config_INFO);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
......
......@@ -59,7 +59,6 @@ int l1_north_init_eNB() {
}
void phy_config_request(PHY_Config_t *phy_config) {
uint8_t Mod_id = phy_config->Mod_id;
......@@ -255,6 +254,18 @@ void phy_config_request(PHY_Config_t *phy_config) {
LOG_I(PHY,"eNB %d/%d configured\n",Mod_id,CC_id);
}
/* Panos: New function of the UE MAC interface: This function
should copy the values assigned to the interface parameters
(within MAC/config.c) to the PHY frame configuration. It should be called at the end of
config::rrc_mac_config_request_ue()*/
void phy_config_request_ue (UE_PHY_Config_t* UE_config_INFO)
{
}
void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
uint8_t eNB_id,
TDD_Config_t *tdd_Config,
......
......@@ -58,6 +58,7 @@
#include "msc.h"
#include "openair2/PHY_INTERFACE/IF_Module.h"
#include "openair2/PHY_INTERFACE/IF_Module_UE.h"
//#include <complex.h>
#include "assertions.h"
......
......@@ -503,6 +503,7 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id
{
int Mod_id = ue->Mod_id;
int CC_id = ue->CC_id;
// Panos: Substitute call to ue_get_SR() with the filled ue_SR_config->SR_payload (0, or 1).
SR_payload = ue_get_SR(Mod_id,
CC_id,
frame_tx,
......@@ -1338,6 +1339,8 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
// ask L2 for RACH transport
if ((mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) && (mode != no_L2_connect) ) {
LOG_D(PHY,"Getting PRACH resources\n");
// Panos: Substitute the call to ue_get_rach with ue->prach_resources[eNB_id] = ue_rach_config, assuming that
// ue_get_rach() will have been called from the MAC layer.
ue->prach_resources[eNB_id] = ue_get_rach(ue->Mod_id,
ue->CC_id,
frame_tx,
......@@ -1416,6 +1419,7 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
}
if (ue->mac_enabled==1){
// Panos: Substitute with fill_Tx_indication(ue->Mod_id, ue->CC_id, frame_tx, eNB_id, UE_MAC_Tx_IND_Msg1_TYPE)
Msg1_transmitted(ue->Mod_id,
ue->CC_id,
frame_tx,
......@@ -1684,6 +1688,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
if (ue->mac_enabled == 1) {
// signal MAC that Msg3 was sent
// Substitute call to this function by call to fill_Tx_indication (UE_MAC_Tx_IND_Msg3_TYPE)
Msg3_transmitted(Mod_id,
CC_id,
frame_tx,
......@@ -1699,6 +1704,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round==0) {
//if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->calibration_flag == 0) {
access_mode=SCHEDULED_ACCESS;
// Panos: Remove the call to ue_get_sdu here and use
// the corresponding Tx.request PDU, instead of ulsch_input_buffer, below.
ue_get_sdu(Mod_id,
CC_id,
frame_tx,
......@@ -2536,6 +2545,8 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
frame_tx += pbch_phase;
if (ue->mac_enabled==1) {
// Panos:Substitute this call with fill_bch_indication(sync=1)
dl_phy_sync_success(ue->Mod_id,frame_rx,eNB_id,
ue->UE_mode[eNB_id]==NOT_SYNCHED ? 1 : 0);
}
......@@ -2617,7 +2628,11 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
ue->pbch_vars[eNB_id]->pdu_errors_conseq++;
ue->pbch_vars[eNB_id]->pdu_errors++;
if (ue->mac_enabled == 1) rrc_out_of_sync_ind(ue->Mod_id,frame_rx,eNB_id);
if (ue->mac_enabled == 1) {
// Panos: Substitute call to rrc_out_of_sync_ind() with fill_bch_incication(sync=0).
rrc_out_of_sync_ind(ue->Mod_id,frame_rx,eNB_id);
}
else AssertFatal(ue->pbch_vars[eNB_id]->pdu_errors_conseq<100,
"More that 100 consecutive PBCH errors! Exiting!\n");
}
......@@ -2637,6 +2652,55 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT);
}
// Panos: New function supporting the MAC interface
void fill_bch_indication(module_id_t module_idP,
frame_t frameP,
unsigned char eNB_index,
uint8_t first_sync,
uint8_t sync)
{
}
// Panos: New function supporting the MAC interface
void fill_dlsch_indication(module_id_t module_idP,
uint8_t CC_id,
frame_t frameP,
sub_frame_t subframeP,
uint8_t* sdu,
uint16_t sdu_len,
uint8_t eNB_index)
{
}
// Panos: New function supporting the MAC interface
void fill_dlsch_rar_indication(module_id_t module_idP,
int CC_id,
frame_t frameP,
rnti_t ra_rnti,
uint8_t* dlsch_buffer,
rnti_t* t_crnti,
uint8_t preamble_index,
uint8_t* selected_rar_buffer)
{
}
// PANOS: New function supporting the MAC interface
void fill_Tx_indication(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id, uint8_t Tx_ind_type)
{
switch (Tx_ind_type)
{
case UE_MAC_Tx_IND_Msg1_TYPE:
break;
case UE_MAC_Tx_IND_Msg3_TYPE:
break;
}
}
int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t abstraction_flag)
{
......@@ -3217,6 +3281,7 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo
subframe_rx,
ue->prach_resources[eNB_id]->ra_PreambleIndex);
// Panos: Substitute call to ue_process_rar() with call to fill_dlsch_rar_indication()
timing_advance = ue_process_rar(ue->Mod_id,
ue->CC_id,
frame_rx,
......@@ -3507,6 +3572,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
if (ue->mac_enabled == 1) {
switch (pdsch) {
case PDSCH:
// Panos: Substitute call to ue_send_sdu() with call to fill_dlsch_indication()
ue_send_sdu(ue->Mod_id,
CC_id,
frame_rx,
......@@ -3516,6 +3582,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
eNB_id);
break;
case SI_PDSCH:
// Panos: Substitute call with call to fill_dlsch_indication()
ue_decode_si(ue->Mod_id,
CC_id,
frame_rx,
......@@ -3524,6 +3591,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3);
break;
case P_PDSCH:
// Panos: Substitute call with call to fill_dlsch_indication()
ue_decode_p(ue->Mod_id,
CC_id,
frame_rx,
......@@ -3532,6 +3600,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
ue->dlsch_SI[eNB_id]->harq_processes[0]->TBS>>3);
break;
case RA_PDSCH:
// Panos: Substitute with call to fill_dlsch_rar_indication()
process_rar(ue,proc,eNB_id,mode,abstraction_flag);
break;
case PDSCH1:
......
......@@ -264,6 +264,7 @@ void config_sib1(int Mod_idP,
}
int power_off_dB[6] = {78,118,140,170,188,200};
void config_sib2(int Mod_idP,
......@@ -414,6 +415,10 @@ void config_sib2(int Mod_idP,
}
void config_dedicated(int Mod_idP,
int CC_idP,
uint16_t rnti,
......@@ -671,6 +676,47 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
return(0);
}
// P: New function supporting the MAC interface
void config_sib1_ue()
{
}
// P: New function supporting the MAC interface
void config_sib2_ue()
{
}
// P: New function supporting the MAC interface
void config_meas_ue()
{
}
// P: New function supporting the MAC interface
// to substitute call to phy_config_afterHO_ue().
void config_afterHO_ue()
{
}
// P: New function supporting the MAC interface
void config_sib13_ue()
{
}
// P: New function supporting the MAC interface
void config_dedicated_ue()
{
}
int
rrc_mac_config_req_ue(
module_id_t Mod_idP,
......@@ -1021,6 +1067,9 @@ rrc_mac_config_req_ue(
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
// Panos: Call to the phy_config_request_ue() function of the interface to copy the UE_PHY_Config_t interface
// configuration to the PHY common and dedicated configuration originating from RRC.
return(0);
}
......@@ -1781,6 +1781,8 @@ for (lcid=DCCH; (lcid < MAX_NUM_LCID) && (is_all_lcid_processed == FALSE) ; lcid
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT);
stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
// Panos: Tx_request should be filled from the ulsch_buffer here.
if (opt_enabled) {
trace_pdu(0, ulsch_buffer, buflen, module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, 0);
LOG_D(OPT,"[UE %d][ULSCH] Frame %d subframe %d trace pdu for rnti %x with size %d\n",
......
#include "openair1/PHY/defs.h"
#include "openair2/PHY_INTERFACE/IF_Module_UE.h"
#include "openair2/PHY_INTERFACE/UE_MAC_interface.h"
#include "openair1/PHY/extern.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/proto.h"
#include "common/ran_context.h"
void handle_bch(UE_DL_IND_t *UE_DL_INFO)
{
}
void handle_dlsch(UE_DL_IND_t *UE_DL_INFO)
{
int i;
UE_MAC_dlsch_indication_pdu_t *dlsch_pdu_ind;
for (i=0; i<UE_DL_INFO->UE_DLSCH_ind.number_of_pdus; i++)
{
dlsch_pdu_ind = UE_DL_INFO->UE_DLSCH_ind.dlsch_ind_list[i];
switch (dlsch_pdu_ind->pdu_type) {
case UE_MAC_DL_IND_PDSCH_PDU_TYPE:
// Call ue_send_sdu()
break;
case UE_MAC_DL_IND_SI_PDSCH_PDU_TYPE:
// Call ue_decode_si()
break;
case UE_MAC_DL_IND_P_PDSCH_PDU_TYPE:
// Call ue_decode_p()
break;
case UE_MAC_DL_IND_DLSCH_RAR_PDU_TYPE:
// Call ue_process_rar()
break;
}
}
}
void UE_DL_indication(UE_DL_IND_t *UE_DL_INFO)
{
/*Call handle functions to forward PDUs or control indications to the upper layers.
handle_bch(UE_DL_INFO);
handle_dlsch (UE_DL_INFO);
*/
}
/* Indicate the Txon of Msg1 or Msg3 to the MAC layer of the transmitter side and trigger associated
* MAC layer operations */
void UE_Tx_indication(UE_Tx_IND_t *UE_Tx_INFO)
{
switch (UE_Tx_INFO->ind_type) {
case UE_MAC_Tx_IND_Msg1_TYPE:
//Call Msg1_transmitted()
break;
case UE_MAC_Tx_IND_Msg3_TYPE:
//Call Msg3_transmitted()
break;
}
}
/*This is the interface module between PHY
*Provided the FAPI style interface structures for P7.
*
*
*
*//*
* 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.0 (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 openair2/PHY_INTERFACE/IF_Module.h
* \brief data structures for PHY/MAC interface modules
* \author EURECOM/NTUST
* \date 2017
* \version 0.1
* \company Eurecom
* \email: raymond.knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __IF_MODULE_UE__H__
#define __IF_MODULE_UE__H__
#include <stdint.h>
#include "openair1/PHY/LTE_TRANSPORT/defs.h"
#include "UE_MAC_interface.h"
#define MAX_NUM_DL_PDU 100
#define MAX_NUM_UL_PDU 100
#define MAX_NUM_HI_DCI0_PDU 100
#define MAX_NUM_TX_REQUEST_PDU 100
#define MAX_NUM_HARQ_IND 100
#define MAX_NUM_CRC_IND 100
#define MAX_NUM_SR_IND 100
#define MAX_NUM_CQI_IND 100
#define MAX_NUM_RACH_IND 100
#define MAX_NUM_SRS_IND 100
typedef struct{
/// Module ID
module_id_t module_id;
/// CC ID
int CC_id;
// / frame
frame_t frame;
/// subframe
sub_frame_t subframe;
/// harq ACKs indication list
//UE_MAC_hi_indication_body_t UE_hi_ind;
/// crc indication list
//UE_MAC_crc_indication_body_t UE_crc_ind;
/// RX BCH indication
UE_MAC_BCH_indication_body_t UE_BCH_ind;
/// RX DLSCH indication
UE_MAC_DLSCH_indication_body_t UE_DLSCH_ind;
} UE_DL_IND_t;
typedef struct{
/// Module ID
module_id_t module_id;
/// CC ID
int CC_id;
/// frame
frame_t frame;
/// subframe
sub_frame_t subframe;
/// Txon Indication type (Msg1 or Msg3)
uint8_t ind_type;
}UE_Tx_IND_t;
typedef struct{
/// Module ID
module_id_t module_id;
/// CC ID
int CC_id;
/// frame
frame_t frame;
/// subframe
sub_frame_t subframe;
/// Sidelink Control Information indication
ue_sci_indication_body_t UE_SCI_ind;
/// RX SLSCH indication
ue_SLSCH_indication_body_t UE_SLSCH_ind;
/// RX SLDCH indication
ue_SLDCH_indication_body_t UE_SLDCH_ind;
/// RX SLBCH indication
ue_SLBCH_indication_body_t UE_SLBCH_ind;
} UE_SL_IND_t;
// Downlink subframe P7
typedef struct{
/// Module ID
module_id_t module_id;
/// CC ID
uint8_t CC_id;
/// frame
frame_t frame;
/// subframe
sub_frame_t subframe;
/// MAC IFace UL Config Request
UE_MAC_ul_config_request_t *UE_UL_req;
/// MAC IFace SL Transmission Config Request
UE_MAC_sl_config_request_Tx_t *SL_Tx_req;
/// MAC IFace SL Reception Config Request
UE_MAC_sl_config_request_Rx_t *SL_Rx_req;
/// Pointers to UL SDUs
UE_MAC_tx_request_t *UE_TX_req;
/// Pointers to SL SDUs
UE_MAC_sl_tx_request_t *TX_SL_req;
}UE_Sched_Rsp_t;
typedef struct {
uint8_t Mod_id;
int CC_id;
UE_PHY_config_common_request_t *cfg_common;
UE_PHY_config_dedicated_request_t *cfg_dedicated;
}UE_PHY_Config_t;
typedef struct IF_Module_UE_s{
//define the function pointer
void (*UE_DL_indication)(UE_DL_IND_t *UE_DL_INFO);
void (*UE_SL_indication)(UE_SL_IND_t *UE_SL_INFO);
void (*UE_Tx1_indication)(UE_Tx_IND_t *UE_Tx_INFO);
void (*UE_sched_response)(UE_Sched_Rsp_t *UE_Sched_INFO);
void (*UE_config_req)(UE_PHY_Config_t* UE_config_INFO);
//P: Perhaps an additional separate function for dedicated PHY configuration is needed.
uint32_t CC_mask;
uint16_t current_frame;
uint8_t current_subframe;
pthread_mutex_t if_mutex;
}IF_Module_UE_t;
IF_Module_UE_t *IF_Module_UE_init(int Mod_id);
void IF_Module_UE_kill(int Mod_id);
void UE_DL_indication(UE_DL_IND_t *UE_DL_INFO);
void UE_Tx_indication(UE_Tx_IND_t *UE_Tx_INFO);
/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/
void UE_schedule_response(UE_Sched_Rsp_t *UE_Sched_INFO);
#endif
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment