Commit 899c178d authored by gauthier's avatar gauthier

Now virtualization should be OK.

TO DO :test RF and ethernet emulation.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5086 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 791d449b
......@@ -144,6 +144,7 @@
#include "PHY/TOOLS/time_meas.h"
#include "PHY/CODING/defs.h"
#include "PHY/TOOLS/defs.h"
#include "platform_types.h"
#ifdef OPENAIR_LTE
......@@ -180,30 +181,30 @@ enum transmission_access_mode{
/// Top-level PHY Data Structure for eNB
typedef struct {
/// Module ID indicator for this instance
u8 Mod_id;
u8 local_flag;
unsigned int rx_total_gain_eNB_dB;
u32 frame;
LTE_DL_FRAME_PARMS lte_frame_parms;
module_id_t Mod_id;
u8 local_flag;
unsigned int rx_total_gain_eNB_dB;
frame_t frame;
LTE_DL_FRAME_PARMS lte_frame_parms;
PHY_MEASUREMENTS_eNB PHY_measurements_eNB[NUMBER_OF_eNB_SECTORS_MAX]; /// Measurement variables
LTE_eNB_COMMON lte_eNB_common_vars;
LTE_eNB_SRS lte_eNB_srs_vars[NUMBER_OF_UE_MAX];
LTE_eNB_PBCH lte_eNB_pbch;
LTE_eNB_PUSCH *lte_eNB_pusch_vars[NUMBER_OF_UE_MAX];
LTE_eNB_PRACH lte_eNB_prach_vars;
LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams
LTE_eNB_COMMON lte_eNB_common_vars;
LTE_eNB_SRS lte_eNB_srs_vars[NUMBER_OF_UE_MAX];
LTE_eNB_PBCH lte_eNB_pbch;
LTE_eNB_PUSCH *lte_eNB_pusch_vars[NUMBER_OF_UE_MAX];
LTE_eNB_PRACH lte_eNB_prach_vars;
LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams
// old: LTE_eNB_DLSCH_t **dlsch_eNB[2]; // Nusers times two spatial streams
LTE_eNB_ULSCH_t *ulsch_eNB[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
LTE_eNB_DLSCH_t *dlsch_eNB_SI,*dlsch_eNB_ra;
LTE_eNB_DLSCH_t *dlsch_eNB_MCH;
LTE_eNB_UE_stats eNB_UE_stats[NUMBER_OF_UE_MAX];
LTE_eNB_UE_stats *eNB_UE_stats_ptr[NUMBER_OF_UE_MAX];
LTE_eNB_ULSCH_t *ulsch_eNB[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
LTE_eNB_DLSCH_t *dlsch_eNB_SI,*dlsch_eNB_ra;
LTE_eNB_DLSCH_t *dlsch_eNB_MCH;
LTE_eNB_UE_stats eNB_UE_stats[NUMBER_OF_UE_MAX];
LTE_eNB_UE_stats *eNB_UE_stats_ptr[NUMBER_OF_UE_MAX];
/// cell-specific reference symbols
unsigned int lte_gold_table[20][2][14];
unsigned int lte_gold_table[20][2][14];
/// mbsfn reference symbols
unsigned int lte_gold_mbsfn_table[10][3][42];
unsigned int lte_gold_mbsfn_table[10][3][42];
u32 X_u[64][839];
......
......@@ -1010,7 +1010,7 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
// Check for SR and do ACK/NACK accordingly
if (is_SR_TXOp(phy_vars_ue,eNB_id,next_slot>>1)==1) {
LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d: got SR_TXOp, Checking for SR for PUSCH from MAC\n",
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d: got SR_TXOp, Checking for SR for PUSCH from MAC\n",
phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame,next_slot>>1);
#ifdef OPENAIR2
SR_payload = mac_xface->ue_get_SR(phy_vars_ue->Mod_id,
......@@ -1024,7 +1024,7 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
if (SR_payload>0) {
generate_ul_signal = 1;
LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d got the SR for PUSCH is %d\n",
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d got the SR for PUSCH is %d\n",
phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame,next_slot>>1,SR_payload);
}
else {
......
......@@ -333,8 +333,8 @@ typedef struct{ //RRC_INTERFACE_FUNCTIONS
char (*openair_rrc_eNB_init)(u8 );
char (*openair_rrc_UE_init)(u8, u8);
RRC_status_t (*rrc_rx_tx)(u8,u32,u8,u8);
u8 (*mac_rrc_data_ind)(u8,u32,u16,u8 *,u16,u8 eNB_flag, u8 eNB_index);
u8 (*mac_rrc_data_req)(u8,u32,u16,u8,u8 *,u8 eNB_flag, u8 eNB_index);
u8 (*mac_rrc_data_ind)(u8,u32,u16,u8 *,u16,eNB_flag_t eNB_flag, u8 eNB_index);
u8 (*mac_rrc_data_req)(u8,u32,u16,u8,u8 *,eNB_flag_t eNB_flag, u8 eNB_index);
void (*mac_rrc_meas_ind)(u8,MAC_MEAS_REQ_ENTRY*);
void (*def_meas_ind)(u8, u8);
void (*rrc_data_indP) (module_id_t , rb_id_t , sdu_size_t , char*);
......@@ -352,12 +352,7 @@ typedef struct{
unsigned short (*mac_config_req)(u8,u8,MAC_CONFIG_REQ*);
MAC_MEAS_REQ_ENTRY* (*mac_meas_req)(u8 , MAC_MEAS_REQ*);
void (*mac_out_of_sync_ind)(u8,u32,unsigned short);
//u8 (*mac_rrc_data_ind)(u8,unsigned short,char *,u8);
//u8 (*mac_rrc_data_req)( u8, unsigned short, u8,char *);
//void (*mac_switch_node_function)(u8);
// void (*mac_rlc_exit)(void);
//RLC_INTERFACE_FUNCTIONS
// void (*pdcp_run)(unsigned int);
void (*pdcp_run)(void);
void (*pdcp_data_req)(module_id_t, rb_id_t, sdu_size_t, char*);
signed int (*rrc_rlc_config_req)(unsigned int, unsigned int, unsigned int, unsigned int, rlc_info_t );
......@@ -373,21 +368,18 @@ typedef struct{
u16 *SIperiod
#ifdef Rel10
,
u8 MBMS_Flag,
MBMS_flag_t MBMS_Flag,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList,
MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
struct PMCH_InfoList_r9 *pmch_InfoList
#endif
);
unsigned int (*mac_rlc_data_req)(module_id_t, unsigned int, char*);
void (*mac_rlc_data_ind)(module_id_t, chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );
mac_rlc_status_resp_t (*mac_rlc_status_ind) (module_id_t, chan_id_t, tb_size_t, num_tb_t);
void (*mac_rlc_data_ind)(module_id_t, logical_chan_id_t, char*, tb_size_t, num_tb_t, crc_t* );
mac_rlc_status_resp_t (*mac_rlc_status_ind) (module_id_t, logical_chan_id_t, tb_size_t, num_tb_t);
signed int (*rrc_rlc_data_req)(module_id_t, rb_id_t, mui_t, confirm_t, sdu_size_t, char *);
void (*rrc_rlc_register_rrc) (void (*rrc_data_indP)(module_id_t , rb_id_t , sdu_size_t , char* ),
void (*rrc_data_confP) (module_id_t , rb_id_t , mui_t ) ) ;
//rlc_op_status_t rrc_rlc_config_req (module_id_t, rb_id_t, rb_type_t, rlc_info_t );
//rlc_op_status_t rrc_rlc_data_req (module_id_t, rb_id_t, mui_t, confirm_t, sdu_size_t, mem_block_t*);
//void rrc_rlc_register_rrc ( void(*rrc_data_indP) (module_id_t , rb_id_t , sdu_size_t , mem_block_t*),void(*rrc_data_conf) (module_id_t , rb_id_t , mui_t) );
void (*mrbch_phy_sync_failure) (u8 Mod_id, u32 frame, u8 Free_ch_index);
void (*dl_phy_sync_success) (u8 Mod_id, u32 frame, u8 eNB_index);
}MAC_RLC_XFACE;
......
......@@ -55,8 +55,8 @@
#define MAX_MANAGED_RG_PER_MOBILE 2
#define DEFAULT_RAB_ID 3
#define NB_RB_MAX 11
#define NB_RAB_MAX 8
#define NB_RB_MAX (maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */
#define NB_RAB_MAX maxDRB /* was 8, now 11 */
#define RAB_SHIFT1 9
#define RAB_SHIFT2 3
#define RAB_OFFSET 0x0007
......@@ -69,36 +69,36 @@
#ifdef MESH
# define MAX_RB_MOBILE NB_RB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
# define MAX_RAB_MOBILE NB_RAB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
# define MAX_RB_RG MAX_RB_MOBILE //NB_RB_MAX * MAX_MOBILES_PER_RG
# define MAX_RAB_RG (NB_RB_MAX+1) * (MAX_MOBILES_PER_RG + 1)
# define MAX_RAB MAX_RAB_RG
# define MAX_RB MAX_RB_RG
//# define MAX_RB_MOBILE NB_RB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
//# define MAX_RAB_MOBILE NB_RAB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
//# define MAX_RB_RG MAX_RB_MOBILE //NB_RB_MAX * MAX_MOBILES_PER_RG
//# define MAX_RAB_RG (NB_RB_MAX+1) * (MAX_MOBILES_PER_RG + 1)
//# define MAX_RAB MAX_RAB_RG
//# define MAX_RB MAX_RB_RG
#else
# define MAX_RB_MOBILE NB_RB_MAX * MAX_MANAGED_RG_PER_MOBILE
# define MAX_RAB_MOBILE NB_RAB_MAX * MAX_MANAGED_RG_PER_MOBILE
# define MAX_RB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
# define MAX_RAB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
# //ifdef NODE_RG
# define MAX_RAB MAX_RAB_RG
# define MAX_RB MAX_RB_RG
# //else
# // ifdef NODE_MT
# // define MAX_RAB MAX_RAB_MOBILE
# // define MAX_RB MAX_RB_MOBILE
# //else
# //error NODE_RG or NODE_MT must be defined
# //endif
//# define MAX_RB_MOBILE NB_RB_MAX * MAX_MANAGED_RG_PER_MOBILE
//# define MAX_RAB_MOBILE NB_RAB_MAX * MAX_MANAGED_RG_PER_MOBILE
//# define MAX_RB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
//# define MAX_RAB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
//# ifdef NODE_RG
//# define MAX_RAB MAX_RAB_RG
//# define MAX_RB MAX_RB_RG
//# else
//# // ifdef NODE_MT
//# // define MAX_RAB MAX_RAB_MOBILE
//# // define MAX_RB MAX_RB_MOBILE
//# //else
//# //error NODE_RG or NODE_MT must be defined
//# //endif
//# endif
#endif //MESH
// RLC_MODE
# define RLC_NONE 0
# define RLC_MODE_AM 1
# define RLC_MODE_TM 2
# define RLC_MODE_UM 3
# define RLC_NONE (rlc_mode_t)0
# define RLC_MODE_AM (rlc_mode_t)1
# define RLC_MODE_TM (rlc_mode_t)2
# define RLC_MODE_UM (rlc_mode_t)3
//E_R
# define E_R_RLC_ER_RELEASE 1
......
......@@ -25,19 +25,29 @@ typedef signed long int s64_t;
typedef unsigned int config_action_t;
typedef unsigned int sdu_size_t;
typedef u16_t sdu_size_t;
typedef s16_t sdu_ssize_t;
typedef unsigned int tbs_size_t;
typedef unsigned int tb_size_t;
typedef unsigned int rb_id_t;
typedef unsigned int module_id_t;
typedef u16_t rb_id_t;
typedef u16_t srb_id_t;
typedef u32_t frame_t;
typedef u32_t sub_frame_t;
typedef u8_t module_id_t;
typedef unsigned int mui_t;
typedef unsigned int confirm_t;
typedef unsigned int rb_type_t;
typedef rb_id_t chan_id_t;
typedef unsigned int logical_chan_id_t;
typedef unsigned int num_tb_t;
typedef unsigned int crc_t;
typedef unsigned int rlc_tx_status_t;
typedef unsigned int rlc_mode_t;
typedef s16_t rlc_sn_t;
typedef u16_t rlc_usn_t;
typedef int traffic_type_t;
typedef u32_t mbms_session_id_t;
typedef u16_t mbms_service_id_t;
typedef u16_t rnti_t;
typedef signed int rlc_op_status_t;
......@@ -47,8 +57,17 @@ typedef unsigned int crc32_t;
typedef signed char boolean_t;
typedef enum MBMS_flag_e {
MBMS_FLAG_NO = 0,
MBMS_FLAG_YES = 1,
} MBMS_flag_t;
typedef enum eNB_flag_e {
ENB_FLAG_NO = 0,
ENB_FLAG_YES = 1,
} eNB_flag_t;
// just for integration
extern unsigned int frame;
extern frame_t frame;
#endif
......@@ -10,7 +10,7 @@
***************************************************************************/
#ifdef OLD_RRC_CELLULAR
# ifndef __RRM_CONFIG_STRUCTS_H__
# define __RRM_CONFIG_STRUCTS_H__
......@@ -171,4 +171,4 @@ typedef volatile struct {
//typedef RG_CONFIG MAIN_RADIO_GATEWAY;
# endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -39,23 +39,23 @@
#include "extern.h"
#include "UTIL/LOG/log.h"
s8 get_Po_NOMINAL_PUSCH(u8 Mod_id) {
s8 get_Po_NOMINAL_PUSCH(module_id_t module_idP) {
RACH_ConfigCommon_t *rach_ConfigCommon = NULL;
if (UE_mac_inst[Mod_id].radioResourceConfigCommon)
rach_ConfigCommon = &UE_mac_inst[Mod_id].radioResourceConfigCommon->rach_ConfigCommon;
if (UE_mac_inst[module_idP].radioResourceConfigCommon)
rach_ConfigCommon = &UE_mac_inst[module_idP].radioResourceConfigCommon->rach_ConfigCommon;
else {
LOG_E(MAC,"[UE %d] FATAL radioResourceConfigCommon is NULL !!!\n",Mod_id);
LOG_E(MAC,"[UE %d] FATAL radioResourceConfigCommon is NULL !!!\n",module_idP);
mac_xface->macphy_exit("");
}
return(-120 + (rach_ConfigCommon->powerRampingParameters.preambleInitialReceivedTargetPower<<1) +
get_DELTA_PREAMBLE(Mod_id));
get_DELTA_PREAMBLE(module_idP));
}
s8 get_deltaP_rampup(u8 Mod_id) {
s8 get_deltaP_rampup(module_id_t module_idP) {
LOG_D(MAC,"[PUSCH]%d dB\n",UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER<<1);
return((s8)(UE_mac_inst[Mod_id].RA_PREAMBLE_TRANSMISSION_COUNTER<<1));
LOG_D(MAC,"[PUSCH]%d dB\n",UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER<<1);
return((s8)(UE_mac_inst[module_idP].RA_PREAMBLE_TRANSMISSION_COUNTER<<1));
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -25,15 +25,15 @@
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
*******************************************************************************/
/*! \file rar_tools.c
* \brief random access tools
* \author Raymond Knopp
* \date 2011
* \version 0.5
* @ingroup _mac
* \brief random access tools
* \author Raymond Knopp
* \date 2011
* \version 0.5
* @ingroup _mac
*/
*/
#include "defs.h"
#include "extern.h"
......@@ -54,11 +54,11 @@ extern unsigned short RIV2first_rb_LUT25[512];
extern inline unsigned int taus(void);
unsigned short fill_rar(u8 Mod_id,
u32 frame,
u8 *dlsch_buffer,
u16 N_RB_UL,
u8 input_buffer_length) {
unsigned short fill_rar(module_id_t module_idP,
frame_t frameP,
u8 *dlsch_buffer,
u16 N_RB_UL,
u8 input_buffer_length) {
RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)dlsch_buffer;
// RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
......@@ -68,34 +68,34 @@ unsigned short fill_rar(u8 Mod_id,
uint8_t mcs,TPC,ULdelay,cqireq;
for (i=0;i<NB_RA_PROC_MAX;i++) {
if (eNB_mac_inst[Mod_id].RA_template[i].generate_rar == 1) {
ra_idx=i;
eNB_mac_inst[Mod_id].RA_template[i].generate_rar = 0;
break;
}
if (eNB_mac_inst[module_idP].RA_template[i].generate_rar == 1) {
ra_idx=i;
eNB_mac_inst[module_idP].RA_template[i].generate_rar = 0;
break;
}
}
// subheader fixed
rarh->E = 0; // First and last RAR
rarh->T = 1; // 0 for E/T/R/R/BI subheader, 1 for E/T/RAPID subheader
rarh->RAPID = eNB_mac_inst[Mod_id].RA_template[ra_idx].preamble_index; // Respond to Preamble 0 only for the moment
rarh->RAPID = eNB_mac_inst[module_idP].RA_template[ra_idx].preamble_index; // Respond to Preamble 0 only for the moment
/*
rar->R = 0;
rar->Timing_Advance_Command = eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset/4;
rar->Timing_Advance_Command = eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset/4;
rar->hopping_flag = 0;
rar->rb_alloc = mac_xface->computeRIV(N_RB_UL,12,2); // 2 RB
rar->mcs = 2; // mcs 2
rar->TPC = 4; // 2 dB power adjustment
rar->UL_delay = 0;
rar->cqi_req = 1;
rar->t_crnti = eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti;
*/
rar[4] = (uint8_t)(eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti>>8);
rar[5] = (uint8_t)(eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti&0xff);
eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset = 0;
//eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset /= 16;
rar[0] = (uint8_t)(eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset>>(2+4)); // 7 MSBs of timing advance + divide by 4
rar[1] = (uint8_t)(eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset<<(4-2))&0xf0; // 4 LSBs of timing advance + divide by 4
rar->t_crnti = eNB_mac_inst[module_idP].RA_template[ra_idx].rnti;
*/
rar[4] = (uint8_t)(eNB_mac_inst[module_idP].RA_template[ra_idx].rnti>>8);
rar[5] = (uint8_t)(eNB_mac_inst[module_idP].RA_template[ra_idx].rnti&0xff);
eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset = 0;
//eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset /= 16;
rar[0] = (uint8_t)(eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset>>(2+4)); // 7 MSBs of timing advance + divide by 4
rar[1] = (uint8_t)(eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset<<(4-2))&0xf0; // 4 LSBs of timing advance + divide by 4
rballoc = mac_xface->computeRIV(N_RB_UL,1,1); // first PRB only for UL Grant
rar[1] |= (rballoc>>7)&7; // Hopping = 0 (bit 3), 3 MSBs of rballoc
rar[2] = ((uint8_t)(rballoc&0xff))<<1; // 7 LSBs of rballoc
......@@ -106,59 +106,59 @@ unsigned short fill_rar(u8 Mod_id,
rar[2] |= ((mcs&0x8)>>3); // mcs 10
rar[3] = (((mcs&0x7)<<5)) | ((TPC&7)<<2) | ((ULdelay&1)<<1) | (cqireq&1);
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Generating RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ra_idx %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",Mod_id,frame,
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
ra_idx,
eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti,
rarh->RAPID,eNB_mac_inst[Mod_id].RA_template[0].preamble_index,
eNB_mac_inst[Mod_id].RA_template[ra_idx].timing_offset);
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Generating RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for ra_idx %d, CRNTI %x,preamble %d/%d,TIMING OFFSET %d\n",module_idP,frame,
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
ra_idx,
eNB_mac_inst[module_idP].RA_template[ra_idx].rnti,
rarh->RAPID,eNB_mac_inst[module_idP].RA_template[0].preamble_index,
eNB_mac_inst[module_idP].RA_template[ra_idx].timing_offset);
#if defined(USER_MODE) && defined(OAI_EMU)
if (oai_emulation.info.opt_enabled){
trace_pdu(1, dlsch_buffer, input_buffer_length, Mod_id, 2, 1,
eNB_mac_inst[Mod_id].subframe, 0, 0);
LOG_I(OPT,"[eNB %d][RAPROC] RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n",
Mod_id, frame, eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti,
trace_pdu(1, dlsch_buffer, input_buffer_length, module_idP, 2, 1,
eNB_mac_inst[module_idP].subframe, 0, 0);
LOG_I(OPT,"[eNB %d][RAPROC] RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n",
module_idP, frame, eNB_mac_inst[module_idP].RA_template[ra_idx].rnti,
rarh->RAPID, input_buffer_length);
}
#endif
return(eNB_mac_inst[Mod_id].RA_template[ra_idx].rnti);
return(eNB_mac_inst[module_idP].RA_template[ra_idx].rnti);
}
uint16_t ue_process_rar(u8 Mod_id, u32 frame, u8 *dlsch_buffer,u16 *t_crnti,u8 preamble_index) {
uint16_t ue_process_rar(module_id_t module_idP, frame_t frameP, u8 *dlsch_buffer,rnti_t *t_crnti,u8 preamble_index) {
RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)dlsch_buffer;
// RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
uint8_t *rar = (uint8_t *)(dlsch_buffer+1);
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",Mod_id,frame,
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
rarh->RAPID,preamble_index);
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",module_idP,frame,
*(uint8_t*)rarh,rar[0],rar[1],rar[2],rar[3],rar[4],rar[5],
rarh->RAPID,preamble_index);
#ifdef DEBUG_RAR
LOG_D(MAC,"[UE %d][RAPROC] rarh->E %d\n",Mod_id,rarh->E);
LOG_D(MAC,"[UE %d][RAPROC] rarh->T %d\n",Mod_id,rarh->T);
LOG_D(MAC,"[UE %d][RAPROC] rarh->RAPID %d\n",Mod_id,rarh->RAPID);
// LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",Mod_id,rar->R);
LOG_I(MAC,"[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",Mod_id,(((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
// LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",Mod_id,rar->hopping_flag);
// LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",Mod_id,rar->rb_alloc);
// LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",Mod_id,rar->mcs);
// LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",Mod_id,rar->TPC);
// LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",Mod_id,rar->UL_delay);
// LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",Mod_id,rar->cqi_req);
LOG_I(MAC,"[UE %d][RAPROC] rar->t_crnti %x\n",Mod_id,(uint16_t)rar[5]+(rar[4]<<8));
LOG_D(MAC,"[UE %d][RAPROC] rarh->E %d\n",module_idP,rarh->E);
LOG_D(MAC,"[UE %d][RAPROC] rarh->T %d\n",module_idP,rarh->T);
LOG_D(MAC,"[UE %d][RAPROC] rarh->RAPID %d\n",module_idP,rarh->RAPID);
// LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R);
LOG_I(MAC,"[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",module_idP,(((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
// LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag);
// LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc);
// LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs);
// LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC);
// LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay);
// LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req);
LOG_I(MAC,"[UE %d][RAPROC] rar->t_crnti %x\n",module_idP,(uint16_t)rar[5]+(rar[4]<<8));
#endif
if (preamble_index == rarh->RAPID) {
*t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti;
UE_mac_inst[Mod_id].crnti = *t_crnti;//rar->t_crnti;
//return(rar->Timing_Advance_Command);
return((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
*t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti;
UE_mac_inst[module_idP].crnti = *t_crnti;//rar->t_crnti;
//return(rar->Timing_Advance_Command);
return((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
}
else {
UE_mac_inst[Mod_id].crnti=0;
return(0xffff);
UE_mac_inst[module_idP].crnti=0;
return(0xffff);
}
}
This diff is collapsed.
......@@ -259,9 +259,6 @@ pdcp_fifo_read_input_sdus_remaining_bytes ()
{
//-----------------------------------------------------------------------------
sdu_size_t bytes_read=0;
// if remaining bytes to read
if (pdcp_input_sdu_remaining_size_to_read > 0) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -153,11 +153,11 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu);
int pdcp_netlink_dequeue_element(uint8_t eNB_flag, uint8_t UE_index, uint8_t eNB_index,
struct pdcp_netlink_element_s **data);
int pdcp_netlink_dequeue_element(module_id_t enb_mod_idP, module_id_t ue_mod_idP, eNB_flag_t eNB_flagP,
struct pdcp_netlink_element_s **data_ppP);
void pdcp_config_set_security(pdcp_t *pdcp, u8 eNB_id, u8 UE_id, u32 frame, u8 eNB_flag, rb_id_t rb_id,
u16 lc_id, u8 security_mode, u8 *kRRCenc, u8 *kRRCint, u8 *kUPenc);
void pdcp_config_set_security(pdcp_t *pdcp_pP, module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t eNB_flagP, rb_id_t rb_idP,
u16 lc_idP, u8 security_modeP, u8 *kRRCenc_pP, u8 *kRRCint_pP, u8 *kUPenc_pP);
#if defined(ENABLE_SECURITY)
int pdcp_apply_security(pdcp_t *pdcp_entity, rb_id_t rb_id,
......
......@@ -87,12 +87,15 @@ void util_flush_hex_octets(comp_name_t component, unsigned char* data, unsigned
LOG_W(component, "Incoming buffer is NULL! Ignoring...\n");
return;
}
printf("[PDCP]");
unsigned long octet_index = 0;
for (octet_index = 0; octet_index < size; ++octet_index) {
LOG_T(component, "%02x.", data[octet_index]);
//LOG_T(component, "%02x.", data[octet_index]);
printf("%02x.", data[octet_index]);
}
LOG_T(component, " \n");
//LOG_T(component, " \n");
printf(" \n");
}
/*
......
This diff is collapsed.
......@@ -96,29 +96,29 @@ public_rlc_am(void rlc_am_release (rlc_am_entity_t *rlcP);)
* @{
*/
/*! \fn void config_req_rlc_am (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void config_req_rlc_am (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
* \brief Configure the UL and DL parameters of the RLC AM
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] module_idP Virtualized module identifier.
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] config_amP Configuration parameters for RLC AM instance.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
*/
public_rlc_am(void config_req_rlc_am (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
public_rlc_am(void config_req_rlc_am (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, rlc_am_info_t * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
/*! \fn void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
/*! \fn void config_req_rlc_am_asn1 (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP)
* \brief Configure the UL and DL parameters of the RLC AM with the asn1c autogenerated pameters structs
* \param[in] rlcP RLC AM protocol instance pointer.
* \param[in] frame Frame index.
* \param[in] eNB_flag Flag to indicate eNB (1) or UE (0)
* \param[in] module_idP Virtualized module identifier.
* \param[in] enb_module_idP eNB Virtualized module identifier.
* \param[in] ue_module_idP UE Virtualized module identifier.
* \param[in] config_amP Configuration parameters for RLC AM instance.
* \param[in] rb_idP Radio bearer identifier.
* \param[in] rb_typeP Radio bearer type (Signalling or Data).
*/
public_rlc_am(void config_req_rlc_am_asn1 (rlc_am_entity_t *rlcP, u32_t frame, u8_t eNB_flagP, module_id_t module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
public_rlc_am(void config_req_rlc_am_asn1 (u32_t frame, u8_t eNB_flagP, module_id_t enb_module_idP, module_id_t ue_module_idP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, rb_type_t rb_typeP);)
/** @} */
......
......@@ -55,19 +55,21 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis
* \brief Structure containing a RLC AM instance protocol variables, statistic variables, allocation variables, buffers and other miscellaneous variables.
*/
typedef struct rlc_am_entity {
module_id_t module_id; /*!< \brief Virtualization index for this protocol instance, means handset or eNB index. */
u16_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
boolean_t is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */
module_id_t enb_module_id; /*!< \brief eNB Virtualization index for this protocol instance, meaningful if is_enb is set. */
module_id_t ue_module_id; /*!< \brief UE Virtualization index for this protocol instance. */
rb_id_t rb_id; /*!< \brief Radio bearer identifier, for statistics and trace purpose. */
logical_chan_id_t channel_id; /*!< \brief Transport channel identifier. */
boolean_t is_data_plane; /*!< \brief To know if the RLC belongs to a data radio bearer or a signalling radio bearer, for statistics and trace purpose. */
boolean_t is_enb; /*!< \brief To know if the RLC belongs to a eNB or UE. */
signed int sdu_buffer_occupancy; /*!< \brief Number of bytes of unsegmented SDUs. */
signed int retransmission_buffer_occupancy; /*!< \brief Number of bytes of PDUs in retransmission buffer waiting for a ACK. */
signed int status_buffer_occupancy; /*!< \brief Number of bytes of control PDUs waiting for transmission. */
signed int sdu_buffer_occupancy; /*!< \brief Number of bytes of unsegmented SDUs. */
signed int retransmission_buffer_occupancy; /*!< \brief Number of bytes of PDUs in retransmission buffer waiting for a ACK. */
signed int status_buffer_occupancy; /*!< \brief Number of bytes of control PDUs waiting for transmission. */
//---------------------------------------------------------------------
// TX BUFFERS
//---------------------------------------------------------------------
mem_block_t* input_sdus_alloc; /*!< \brief Allocated memory for the input SDU buffer (for SDUs coming from upper layers). */
mem_block_t* input_sdus_alloc; /*!< \brief Allocated memory for the input SDU buffer (for SDUs coming from upper layers). */
rlc_am_tx_sdu_management_t *input_sdus; /*!< \brief Input SDU buffer (for SDUs coming from upper layers). */
signed int nb_sdu; /*!< \brief Total number of valid rlc_am_tx_sdu_management_t in input_sdus[]. */
signed int nb_sdu_no_segmented; /*!< \brief Total number of SDUs not segmented and partially segmented. */
......@@ -88,7 +90,7 @@ typedef struct rlc_am_entity {
//---------------------------------------------------------------------
list2_t receiver_buffer; /*!< \brief Receiver buffer implemented with a list. */
mem_block_t *output_sdu_in_construction; /*!< \brief Memory area where a complete SDU is reassemblied before being send to upper layers. */
s32_t output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */
sdu_size_t output_sdu_size_to_write; /*!< \brief Size of the reassemblied SDU. */
//---------------------------------------------------------------------
......@@ -98,19 +100,19 @@ typedef struct rlc_am_entity {
//-----------------------------
// TX STATE VARIABLES
//-----------------------------
u16_t vt_a; /*!< \brief Acknowledgement state variable. This state variable holds the value of the SN of the next AMD PDU for which a positive acknowledgment is to be received in-sequence, and it serves as the lower edge of the transmitting window. It is initially set to 0, and is updated whenever the AM RLC entity receives a positive acknowledgment for an AMD PDU with SN = VT(A).*/
u16_t vt_ms; /*!< \brief Maximum send state variable. This state variable equals VT(A) + AM_Window_Size, and it serves as the higher edge of the transmitting window. */
u16_t vt_s; /*!< \brief Send state variable. This state variable holds the value of the SN to be assigned for the next newly generated AMD PDU. It is initially set to 0, and is updated whenever the AM RLC entity delivers an AMD PDU with SN = VT(S).*/
u16_t poll_sn; /*!< \brief Poll send state variable. This state variable holds the value of VT(S)-1 upon the most recent transmission of a RLC data PDU with the poll bit set to “1”. It is initially set to 0.*/
rlc_usn_t vt_a; /*!< \brief Acknowledgement state variable. This state variable holds the value of the SN of the next AMD PDU for which a positive acknowledgment is to be received in-sequence, and it serves as the lower edge of the transmitting window. It is initially set to 0, and is updated whenever the AM RLC entity receives a positive acknowledgment for an AMD PDU with SN = VT(A).*/
rlc_usn_t vt_ms; /*!< \brief Maximum send state variable. This state variable equals VT(A) + AM_Window_Size, and it serves as the higher edge of the transmitting window. */
rlc_usn_t vt_s; /*!< \brief Send state variable. This state variable holds the value of the SN to be assigned for the next newly generated AMD PDU. It is initially set to 0, and is updated whenever the AM RLC entity delivers an AMD PDU with SN = VT(S).*/
rlc_usn_t poll_sn; /*!< \brief Poll send state variable. This state variable holds the value of VT(S)-1 upon the most recent transmission of a RLC data PDU with the poll bit set to “1”. It is initially set to 0.*/
//-----------------------------
// RX STATE VARIABLES
//-----------------------------
u16_t vr_r; /*!< \brief Receive state variable. This state variable holds the value of the SN following the last in-sequence completely received AMD PDU, and it serves as the lower edge of the receiving window. It is initially set to 0, and is updated whenever the AM RLC entity receives an AMD PDU with SN = VR(R). */
u16_t vr_mr; /*!< \brief Maximum acceptable receive state variable. This state variable equals VR(R) + AM_Window_Size, and it holds the value of the SN of the first AMD PDU that is beyond the receiving window and serves as the higher edge of the receiving window. */
u16_t vr_x; /*!< \brief t-Reordering state variable. This state variable holds the value of the SN following the SN of the RLC data PDU which triggered t-Reordering. */
u16_t vr_ms; /*!< \brief Maximum STATUS transmit state variable. This state variable holds the highest possible value of the SN which can be indicated by “ACK_SN” when a STATUS PDU needs to be constructed. It is initially set to 0. */
u16_t vr_h; /*!< \brief Highest received state variable. This state variable holds the value of the SN following the SN of the RLC data PDU with the highest SN among received RLC data PDUs. It is initially set to 0. */
rlc_usn_t vr_r; /*!< \brief Receive state variable. This state variable holds the value of the SN following the last in-sequence completely received AMD PDU, and it serves as the lower edge of the receiving window. It is initially set to 0, and is updated whenever the AM RLC entity receives an AMD PDU with SN = VR(R). */
rlc_usn_t vr_mr; /*!< \brief Maximum acceptable receive state variable. This state variable equals VR(R) + AM_Window_Size, and it holds the value of the SN of the first AMD PDU that is beyond the receiving window and serves as the higher edge of the receiving window. */
rlc_usn_t vr_x; /*!< \brief t-Reordering state variable. This state variable holds the value of the SN following the SN of the RLC data PDU which triggered t-Reordering. */
rlc_usn_t vr_ms; /*!< \brief Maximum STATUS transmit state variable. This state variable holds the highest possible value of the SN which can be indicated by “ACK_SN” when a STATUS PDU needs to be constructed. It is initially set to 0. */
rlc_usn_t vr_h; /*!< \brief Highest received state variable. This state variable holds the value of the SN following the SN of the RLC data PDU with the highest SN among received RLC data PDUs. It is initially set to 0. */
//-----------------------------
// TIMERS CONFIGURED BY RRC
......@@ -183,12 +185,7 @@ typedef struct rlc_am_entity {