Commit 7a92f587 authored by Bilel's avatar Bilel

Merge branch 'ue-tdd_fix_issueOai1B_45' into develop_integration_w50

parents 595db57a 495e357a
......@@ -56,6 +56,7 @@ fifo_dump_emos_UE emos_dump_UE;
#endif
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
......@@ -2318,6 +2319,17 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
if ((pbch_tx_ant>0) && (pbch_tx_ant<=4)) {
if (opt_enabled) {
static uint8_t dummy[3];
dummy[0] = ue->pbch_vars[eNB_id]->decoded_output[2];
dummy[1] = ue->pbch_vars[eNB_id]->decoded_output[1];
dummy[2] = ue->pbch_vars[eNB_id]->decoded_output[0];
trace_pdu(1, dummy, 3, ue->Mod_id, 0, 0,
frame_rx, subframe_rx, 0, 0);
LOG_D(OPT,"[UE %d][PBCH] Frame %d trace pdu for PBCH\n",
ue->Mod_id, subframe_rx);
}
if (pbch_tx_ant>2) {
LOG_W(PHY,"[openair][SCHED][SYNCH] PBCH decoding: pbch_tx_ant>2 not supported\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT);
......@@ -2996,6 +3008,7 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo
timing_advance = mac_xface->ue_process_rar(ue->Mod_id,
ue->CC_id,
frame_rx,
ue->prach_resources[eNB_id]->ra_RNTI,
dlsch0->harq_processes[0]->b,
&ue->pdcch_vars[eNB_id]->crnti,
ue->prach_resources[eNB_id]->ra_PreambleIndex);
......@@ -3713,12 +3726,14 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u
if (ue->mac_enabled==1) {
if (slot==0) {
ret = mac_xface->ue_scheduler(ue->Mod_id,
frame_tx,
subframe_rx,
subframe_select(&ue->frame_parms,subframe_tx),
eNB_id,
0/*FIXME CC_id*/);
ret = mac_xface->ue_scheduler(ue->Mod_id,
frame_rx,
subframe_rx,
frame_tx,
subframe_tx,
subframe_select(&ue->frame_parms,subframe_tx),
eNB_id,
0/*FIXME CC_id*/);
if (ret == CONNECTION_LOST) {
LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id,
......
......@@ -1031,10 +1031,14 @@ typedef struct {
/*!\brief Top level UE MAC structure */
typedef struct {
uint16_t Node_id;
/// frame counter
frame_t frame;
/// subframe counter
sub_frame_t subframe;
/// RX frame counter
frame_t rxFrame;
/// RX subframe counter
sub_frame_t rxSubframe;
/// TX frame counter
frame_t txFrame;
/// TX subframe counter
sub_frame_t txSubframe;
/// C-RNTI of UE
uint16_t crnti;
/// C-RNTI of UE before HO
......
......@@ -82,7 +82,7 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length)
// mod_id used for PDCP and RLC
Mod_id = NB_eNB_INST + ue_id ;
len+=sprintf(&buffer[len],"UE TTI: %d\n",UE_mac_inst[ue_id].frame);
len+=sprintf(&buffer[len],"UE RX TTI: %d\n",UE_mac_inst[ue_id].rxFrame);
for (enb_id= 0; enb_id <NB_SIG_CNX_UE; enb_id++) {
......
......@@ -447,6 +447,9 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,u
/* \brief Function called by PHY to process the received RAR. It checks that the preamble matches what was sent by the eNB and provides the timing advance and t-CRNTI.
@param Mod_id Index of UE instance
@param CC_id Index to a component carrier
@param frame Frame index
@param ra_rnti RA_RNTI value
@param dlsch_buffer Pointer to dlsch_buffer containing RAR PDU
@param t_crnti Pointer to PHY variable containing the T_CRNTI
@param preamble_index Preamble Index used by PHY to transmit the PRACH. This should match the received RAR to trigger the rest of
......@@ -458,6 +461,7 @@ ue_process_rar(
const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const rnti_t ra_rnti,
uint8_t * const dlsch_buffer,
rnti_t * const t_crnti,
const uint8_t preamble_index
......@@ -536,15 +540,20 @@ void adjust_bsr_info(int buffer_occupancy, uint16_t TBS, UE_TEMPLATE *UE_templat
/*! \fn UE_L2_state_t ue_scheduler(const module_id_t module_idP,const frame_t frameP, const sub_frame_t subframe, const lte_subframe_t direction,const uint8_t eNB_index)
\brief UE scheduler where all the ue background tasks are done. This function performs the following: 1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures.
\param[in] module_idP instance of the UE
\param[in] subframe t the subframe number
\param[in] rxFrame the RX frame number
\param[in] rxSubframe the RX subframe number
\param[in] txFrame the TX frame number
\param[in] txSubframe the TX subframe number
\param[in] direction subframe direction
\param[in] eNB_index instance of eNB
@returns L2 state (CONNETION_OK or CONNECTION_LOST or PHY_RESYNCH)
*/
UE_L2_STATE_t ue_scheduler(
const module_id_t module_idP,
const frame_t frameP,
const sub_frame_t subframe,
const frame_t rxFrameP,
const sub_frame_t rxSubframe,
const frame_t txFrameP,
const sub_frame_t txSubframe,
const lte_subframe_t direction,
const uint8_t eNB_index,
const int CC_id);
......
......@@ -271,8 +271,8 @@ void Msg1_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id
UE_mac_inst[module_idP].RA_attempt_number++;
if (opt_enabled) {
trace_pdu(0, NULL, 0, module_idP, 2, UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex,
UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, UE_mac_inst[module_idP].RA_attempt_number);
trace_pdu(0, NULL, 0, module_idP, 0 , UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex,
UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, UE_mac_inst[module_idP].RA_attempt_number);
LOG_D(OPT,"[UE %d][RAPROC] TX MSG1 Frame %d trace pdu for rnti %x with size %d\n",
module_idP, frameP, 1, UE_mac_inst[module_idP].RA_Msg3_size);
}
......@@ -296,7 +296,7 @@ void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id
if (opt_enabled) { // msg3
trace_pdu(0, &UE_mac_inst[module_idP].CCCH_pdu.payload[0], UE_mac_inst[module_idP].RA_Msg3_size,
module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, 0);
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][RAPROC] MSG3 Frame %d trace pdu Preamble %d with size %d\n",
module_idP, frameP, UE_mac_inst[module_idP].crnti /*UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex*/, UE_mac_inst[module_idP].RA_Msg3_size);
}
......
......@@ -133,6 +133,7 @@ ue_process_rar(
const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const rnti_t ra_rnti,
uint8_t* const dlsch_buffer,
rnti_t* const t_crnti,
const uint8_t preamble_index
......@@ -168,6 +169,12 @@ ue_process_rar(
LOG_D(MAC,"[UE %d][RAPROC] rar->t_crnti %x\n",module_idP,(uint16_t)rar[5]+(rar[4]<<8));
#endif
if (opt_enabled) {
LOG_D(OPT,"[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n",
module_idP, CC_id, frameP, ra_rnti);
trace_pdu(1, (uint8_t*)rarh, 7, module_idP, 2, ra_rnti,
UE_mac_inst[module_idP].rxFrame, UE_mac_inst[module_idP].rxSubframe, 0, 0);
}
if (preamble_index == rarh->RAPID) {
*t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti;
......
......@@ -352,7 +352,7 @@ ue_send_sdu(
if (opt_enabled) {
trace_pdu(1, sdu, sdu_len, module_idP, 3, UE_mac_inst[module_idP].crnti,
UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, 0);
UE_mac_inst[module_idP].rxFrame, UE_mac_inst[module_idP].rxSubframe, 0, 0);
LOG_D(OPT,"[UE %d][DLSCH] Frame %d trace pdu for rnti %x with size %d\n",
module_idP, frameP, UE_mac_inst[module_idP].crnti, sdu_len);
}
......@@ -533,8 +533,8 @@ void ue_decode_si(module_id_t module_idP,int CC_id,frame_t frameP, uint8_t eNB_i
module_idP,
4,
0xffff,
UE_mac_inst[module_idP].frame,
UE_mac_inst[module_idP].subframe,
UE_mac_inst[module_idP].rxFrame,
UE_mac_inst[module_idP].rxSubframe,
0,
0);
LOG_D(OPT,"[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
......@@ -569,8 +569,8 @@ void ue_decode_p(module_id_t module_idP,int CC_id,frame_t frameP, uint8_t eNB_in
module_idP,
4,
P_RNTI,
UE_mac_inst[module_idP].frame,
UE_mac_inst[module_idP].subframe,
UE_mac_inst[module_idP].rxFrame,
UE_mac_inst[module_idP].rxSubframe,
0,
0);
LOG_D(OPT,"[UE %d][BCH] Frame %d trace pdu for CC_id %d rnti %x with size %d\n",
......@@ -1921,9 +1921,9 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY)
stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
if (opt_enabled) {
trace_pdu(0, ulsch_buffer, buflen, module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, 0);
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 trace pdu for rnti %x with size %d\n",
module_idP, UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, UE_mac_inst[module_idP].crnti, buflen);
module_idP, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, UE_mac_inst[module_idP].crnti, buflen);
}
}
......@@ -1938,8 +1938,10 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY)
UE_L2_STATE_t
ue_scheduler(
const module_id_t module_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const frame_t rxFrameP,
const sub_frame_t rxSubframeP,
const frame_t txFrameP,
const sub_frame_t txSubframeP,
const lte_subframe_t directionP,
const uint8_t eNB_indexP,
const int CC_id)
......@@ -1963,7 +1965,7 @@ ue_scheduler(
start_meas(&UE_mac_inst[module_idP].ue_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_IN);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_NO, UE_mac_inst[module_idP].crnti, frameP, subframeP,eNB_indexP);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_NO, UE_mac_inst[module_idP].crnti, txFrameP, txSubframeP,eNB_indexP);
#if defined(ENABLE_ITTI)
do {
......@@ -2002,11 +2004,13 @@ ue_scheduler(
//LG#ifdef EXMIMO
pdcp_run(&ctxt);
//#endif
UE_mac_inst[module_idP].frame = frameP;
UE_mac_inst[module_idP].subframe = subframeP;
UE_mac_inst[module_idP].txFrame = txFrameP;
UE_mac_inst[module_idP].txSubframe = txSubframeP;
UE_mac_inst[module_idP].rxFrame = rxFrameP;
UE_mac_inst[module_idP].rxSubframe = rxSubframeP;
#ifdef CELLULAR
rrc_rx_tx(module_idP, frameP, 0, eNB_indexP);
rrc_rx_tx(module_idP, txFrameP, 0, eNB_indexP);
#else
switch (rrc_rx_tx(&ctxt,
......@@ -2060,7 +2064,7 @@ ue_scheduler(
//return(RRC_OK);
}
LOG_I(MAC,"Frame %d: Contention resolution timer %d/%d\n",frameP,UE_mac_inst[module_idP].RA_contention_resolution_cnt,
LOG_I(MAC,"Frame %d: Contention resolution timer %d/%d\n",txFrameP,UE_mac_inst[module_idP].RA_contention_resolution_cnt,
((1+rach_ConfigCommon->ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3));
UE_mac_inst[module_idP].RA_contention_resolution_cnt++;
......@@ -2096,11 +2100,12 @@ ue_scheduler(
}
}
/*
if (lcid == DCCH) {
LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d Pending data for SRB1=%d for LCGID %d \n",
module_idP, frameP,subframeP,UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]],
UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]);
// UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]);
}
*/
}
......
......@@ -170,7 +170,7 @@ typedef struct {
PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe);
/// Process Random-Access Response
uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t *t_crnti,uint8_t preamble_index);
uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP, uint16_t ra_rnti, uint8_t *dlsch_buffer, uint16_t *t_crnti,uint8_t preamble_index);
/// Get SR payload (0,1) from UE MAC
uint32_t (*ue_get_SR)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe);
......@@ -179,7 +179,7 @@ typedef struct {
void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync);
/// Only calls the PDCP for now
UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t frameP,sub_frame_t subframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id);
UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t rxFrameP,sub_frame_t rxSubframe, frame_t txFrameP,sub_frame_t txSubframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id);
/// PHY-Config-Dedicated UE
void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index,
......
......@@ -304,19 +304,25 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
frameBuffer[frameOffset++] = retx;
}
#ifdef WIRESHARK_DEV
//#ifdef WIRESHARK_DEV
/* Relating to out-of-band events */
/* N.B. dissector will only look to these fields if length is 0... */
if (pdu_buffer_size==0) {
switch (oob_event) {
case ltemac_send_preamble :
LOG_D(OPT,"oob event %d %d\n",ltemac_send_preamble );
LOG_D(OPT,"oob ltemac_send_preamble event %02x."
//"%02x."
"%02x.%02x\n",
MAC_LTE_OOB_EVENT_TAG,
//ltemac_send_preamble,
rnti,
oob_event_value);
//frameBuffer[frameOffset++]=0;
//frameBuffer[frameOffset++]=0;
//frameBuffer[frameOffset++]=0;
frameBuffer[frameOffset++] = MAC_LTE_OOB_EVENT_TAG;
frameBuffer[frameOffset++]=ltemac_send_preamble;
//frameBuffer[frameOffset++]=ltemac_send_preamble;
frameBuffer[frameOffset++]=rnti; // is the preamble
frameBuffer[frameOffset++]=oob_event_value;
break;
......@@ -329,12 +335,12 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType,
case ltemac_sr_failure:
default:
LOG_D(OPT,"not implemeneted yet\n");
LOG_W(OPT,"not implemeneted yet\n");
break;
}
}
#endif
//#endif
/***************************************/
/* Now write the MAC PDU */
frameBuffer[frameOffset++] = MAC_LTE_PAYLOAD_TAG;
......
......@@ -786,11 +786,13 @@ static void *UE_thread_rxn_txnp4(void *arg)
if (UE->mac_enabled==1) {
ret = mac_xface->ue_scheduler(UE->Mod_id,
proc->frame_tx,
proc->subframe_rx,
subframe_select(&UE->frame_parms,proc->subframe_tx),
0,
0/*FIXME CC_id*/);
proc->frame_rx,
proc->subframe_rx,
proc->frame_tx,
proc->subframe_tx,
subframe_select(&UE->frame_parms,proc->subframe_tx),
0,
0/*FIXME CC_id*/);
if (ret == CONNECTION_LOST) {
LOG_E( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u RRC Connection lost, returning to PRACH\n",
......
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