Commit e0f00720 authored by Raymond Knopp's avatar Raymond Knopp

oaisim with interfaces for lte-ue/lte-enb threading compiles and runs.

parent b1e633bb
......@@ -59,6 +59,7 @@
#include "sctp_default_values.h"
#include "SystemInformationBlockType2.h"
#include "LAYER2/MAC/extern.h"
#include "PHY/extern.h"
#define ENB_CONFIG_STRING_ACTIVE_ENBS "Active_eNBs"
......@@ -321,8 +322,8 @@ void enb_config_display(void)
for (j=0; j< enb_properties.properties[i]->nb_cc; j++) {
// CC_ID node function/timing
printf( "\n\tnode_function for CC %d: \t%d:\n",j,enb_properties.properties[i]->cc_node_function[j]);
printf( "\tnode_timing for CC %d: \t%d:\n",j,enb_properties.properties[i]->cc_node_timing[j]);
printf( "\n\tnode_function for CC %d: \t%s:\n",j,eNB_functions[enb_properties.properties[i]->cc_node_function[j]]);
printf( "\tnode_timing for CC %d: \t%s:\n",j,eNB_timing[enb_properties.properties[i]->cc_node_timing[j]]);
printf( "\tnode_synch_ref for CC %d: \t%d:\n",j,enb_properties.properties[i]->cc_node_synch_ref[j]);
printf( "\teutra band for CC %d: \t%"PRId16":\n",j,enb_properties.properties[i]->eutra_band[j]);
......
......@@ -44,6 +44,7 @@
#ifndef __OCG_H__
#define __OCG_H__
#include "PHY/defs.h"
#include "PHY/impl_defs_top.h"
#include "platform_types.h"
......@@ -707,8 +708,8 @@ typedef struct {
// phy related params
unsigned int n_frames;
unsigned int n_frames_flag; // if set, then let the emulation goes to infinity
node_function_t node_function[MAX_NUM_CCs];
node_timing_t node_timing[MAX_NUM_CCS];
eNB_func_t node_function[MAX_NUM_CCs];
eNB_timing_t node_timing[MAX_NUM_CCs];
unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref lte_frame_type_t (header file reorganization needed)
char * frame_type_name[MAX_NUM_CCs];
unsigned char tdd_config[MAX_NUM_CCs];
......
......@@ -249,6 +249,9 @@ struct openair0_device_t {
/*!brief Module ID of this device */
int Mod_id;
/*!brief Component Carrier ID of this device */
int CC_id;
/*!brief Type of this device */
dev_type_t type;
......
......@@ -24,7 +24,8 @@ eNBs =
component_carriers = (
{
node_function = "eNodeB_3GPP";
node_timing = "SYNCH_TO_OTHER";
node_timing = "synch_to_other";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
......
......@@ -157,8 +157,8 @@ static struct {
void exit_fun(const char* s);
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[]);
void stop_eNB(void);
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst);
void stop_eNB(int nb_inst);
void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) {
......@@ -647,6 +647,8 @@ static void* eNB_thread_asynch_rx( void* param ) {
uint32_t symbol_number=0;
uint32_t symbol_mask, symbol_mask_full;
int prach_rx;
int dummy_rx[fp->nb_antennas_rx][fp->samples_per_tti];
int rxs;
#ifdef DEADLINE_SCHEDULER
struct sched_attr attr;
......@@ -739,7 +741,34 @@ static void* eNB_thread_asynch_rx( void* param ) {
#endif // DEADLINE_SCHEDULER
if (eNB->node_function == eNodeB_3GPP_BBU) { // acquisition from IF
mlockall(MCL_CURRENT | MCL_FUTURE);
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
printf( "waiting for sync (eNB_thread_asynch_rx)\n");
pthread_mutex_lock( &sync_mutex );
while (sync_var<0)
pthread_cond_wait( &sync_cond, &sync_mutex );
pthread_mutex_unlock(&sync_mutex);
printf( "got sync (eNB_thread_asynch_rx)\n" );
if (eNB->node_function == eNodeB_3GPP) { // acquisition from RF
if (eNB->rfdevice.trx_read_func)
rxs = eNB->rfdevice.trx_read_func(&eNB->rfdevice,
&proc->timestamp_rx,
(void**)dummy_rx,
fp->samples_per_tti,
fp->nb_antennas_rx);
else {
printf("eNB asynch RX\n");
sleep(1);
}
}
else if (eNB->node_function == eNodeB_3GPP_BBU) { // acquisition from IF
/// **** recv_IF5 of rxdata from RRH **** ///
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF5, 1 );
recv_IF5(eNB, &timestamp_rx, subframe_rx++, IF5_RRH_GW_UL);
......@@ -938,7 +967,7 @@ static void* eNB_thread_FH( void* param ) {
pthread_mutex_unlock(&sync_mutex);
printf( "got sync (eNB_thread)\n" );
printf( "got sync (eNB_thread FH)\n" );
#if defined(ENABLE_ITTI)
wait_system_ready ("Waiting for eNB application to be ready %s\r", &start_eNB);
......@@ -1394,16 +1423,14 @@ static void* eNB_thread_prach( void* param ) {
}
void init_eNB_proc(int nb_inst) {
void init_eNB_proc(int inst) {
int i;
int CC_id;
PHY_VARS_eNB *eNB;
eNB_proc_t *proc;
eNB_rxtx_proc_t *proc_rxtx;
int inst;
for (inst = 0; inst < nb_inst; inst++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
eNB = PHY_vars_eNB_g[inst][CC_id];
LOG_I(PHY,"Initializing eNB %d CC_id %d (%s,%s),\n",inst,CC_id,eNB_functions[eNB->node_function],eNB_timing[eNB->node_timing]);
......@@ -1481,21 +1508,21 @@ void init_eNB_proc(int nb_inst) {
pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL);
pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL);
sync_phy_proc.phy_proc_CC_id = 0;
}
}
/*!
* \brief Terminate eNB TX and RX threads.
*/
void kill_eNB_proc(void) {
void kill_eNB_proc(int inst) {
int *status;
PHY_VARS_eNB *eNB;
eNB_proc_t *proc;
eNB_rxtx_proc_t *proc_rxtx;
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
eNB=PHY_vars_eNB_g[0][CC_id];
eNB=PHY_vars_eNB_g[inst][CC_id];
proc = &eNB->proc;
proc_rxtx = &proc->proc_rxtx[0];
......@@ -1650,16 +1677,21 @@ void print_opp_meas(void) {
}
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[]) {
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst) {
int CC_id;
int inst;
for (inst=0;inst<nb_inst;inst++) {
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
PHY_vars_eNB_g[0][CC_id]->node_function = node_function[CC_id];
PHY_vars_eNB_g[0][CC_id]->node_timing = node_timing[CC_id];
PHY_vars_eNB_g[inst][CC_id]->node_function = node_function[CC_id];
PHY_vars_eNB_g[inst][CC_id]->node_timing = node_timing[CC_id];
LOG_I(PHY,"Initializing eNB %d CC_id %d : (%s,%s)\n",inst,CC_id,eNB_functions[node_function[CC_id]],eNB_timing[node_timing[CC_id]]);
}
init_eNB_proc(inst);
}
init_eNB_proc();
sleep(1);
LOG_D(HW,"[lte-softmodem.c] eNB threads created\n");
......@@ -1677,7 +1709,7 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[]) {
}
void stop_eNB() {
void stop_eNB(int nb_inst) {
/*
#ifdef DEBUG_THREADS
......@@ -1702,6 +1734,8 @@ void stop_eNB() {
#endif // DEBUG_THREADS
*/
printf("Killing eNB processing threads\n");
kill_eNB_proc();
for (int inst=0;inst<nb_inst;inst++) {
printf("Killing eNB %d processing threads\n",inst);
kill_eNB_proc(inst);
}
}
......@@ -119,8 +119,8 @@ unsigned short config_frames[4] = {2,9,11,13};
// In lte-enb.c
extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
extern void init_eNB(eNB_func_t *, eNB_timing_t *);
extern void stop_eNB(void);
extern void init_eNB(eNB_func_t *, eNB_timing_t *,int);
extern void stop_eNB(int);
extern void kill_eNB_proc(void);
// In lte-ue.c
......@@ -1843,7 +1843,7 @@ int main( int argc, char **argv )
// start the main thread
if (UE_flag == 1) init_UE(1);
else init_eNB(node_function,node_timing);
else init_eNB(node_function,node_timing,1);
// Sleep to allow all threads to setup
sleep(3);
......@@ -1902,7 +1902,7 @@ int main( int argc, char **argv )
// cleanup
if (UE_flag == 1) {
} else {
stop_eNB();
stop_eNB(1);
}
......
This diff is collapsed.
......@@ -179,7 +179,6 @@ extern uint16_t Nid_cell;
extern LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
extern Enb_properties_array_t enb_properties;
//#ifdef XFORMS
......@@ -759,8 +758,9 @@ l2l1_task (void *args_p)
proc->frame_rx = frame;
proc->subframe_rx = sf;
proc->timestamp_rx += PHY_vars_eNB_g[eNB_inst][CC_id]->frame_parms.samples_per_tti;
pthread_mutex_unlock( &proc->mutex_FH );
if (proc->instance_cnt_FH == 0) {
if (cnt_FH == 0) {
if (pthread_cond_signal(&proc->cond_FH) != 0) {
LOG_E(PHY,"ERROR pthread_cond_signal for eNB FH CCid %d\n",proc->CC_id);
exit_fun("ERROR pthread_cond_signal");
......
......@@ -50,11 +50,13 @@ eNB_MAC_INST* get_eNB_mac_inst(module_id_t module_idP);
OAI_Emulation* get_OAI_emulation(void);
void init_channel_vars(LTE_DL_FRAME_PARMS *frame_parms, double ***s_re,double ***s_im,double ***r_re,double ***r_im,double ***r_re0,double ***r_im0);
void do_UL_sig(double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint16_t next_slot,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms, uint32_t,uint8_t);
void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,int eNB_id,uint8_t CC_id);
void do_DL_sig(double **r_re0,double **r_im0,double **r_re,double **r_im,double **s_re,double **s_im,channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint16_t next_slot,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id);
void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id);
void init_ue(node_desc_t *ue_data, UE_Antenna ue_ant);//Abstraction changes
void init_enb(node_desc_t *enb_data, eNB_Antenna enb_ant);//Abstraction changes
......
......@@ -173,6 +173,12 @@ extern time_stats_t ul_chan_stats;
extern int xforms;
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst);
void stop_eNB(int nb_inst);
void get_simulation_options(int argc, char *argv[])
{
int option;
......@@ -779,6 +785,10 @@ void get_simulation_options(int argc, char *argv[])
oai_emulation.info.tdd_config_S[0] = enb_properties->properties[0]->tdd_config_s[0];
oai_emulation.info.extended_prefix_flag[0] = enb_properties->properties[0]->prefix_type[0];
oai_emulation.info.node_function[0] = enb_properties->properties[0]->cc_node_function[0];
oai_emulation.info.node_timing[0] = enb_properties->properties[0]->cc_node_timing[0];
downlink_frequency[0][0] = enb_properties->properties[0]->downlink_frequency[0];
uplink_frequency_offset[0][0] = enb_properties->properties[0]->uplink_frequency_offset[0];
}
free(conf_config_file_name);
......@@ -939,6 +949,119 @@ void init_seed(uint8_t set_seed)
}
}
int eNB_trx_start(openair0_device *device) {
return(0);
}
void eNB_trx_end(openair0_device *device) {
return;
}
int eNB_trx_stop(openair0_device *device) {
return(0);
}
int UE_trx_start(openair0_device *device) {
return(0);
}
int UE_trx_end(openair0_device *device) {
return(0);
}
int UE_trx_stop(openair0_device *device) {
return(0);
}
int eNB_trx_set_freq(openair0_device *device, openair0_config_t *openair0_cfg, int dummy) {
return(0);
}
int eNB_trx_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
return(0);
}
int UE_trx_set_freq(openair0_device *device, openair0_config_t *openair0_cfg, int dummy) {
return(0);
}
int UE_trx_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
return(0);
}
int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
return(0);
}
int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
return(0);
}
int eNB_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int eNB_id = device->Mod_id;
int CC_id = device->CC_id;
int UE_id;
int subframe = (timestamp/PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti)%10;
for (UE_id=0;UE_id<=NB_UE_INST;UE_id++) {
do_DL_sig(eNB2UE,
enb_data,
ue_data,
subframe,
0, //abstraction_flag,
&PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms,
UE_id,
CC_id);
}
return(0);
}
int UE_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int UE_id = device->Mod_id;
int CC_id = device->CC_id;
int eNB_id;
int subframe = (timestamp/PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti)%10;
for (eNB_id=0;eNB_id<=NB_eNB_INST;eNB_id++) {
do_UL_sig(UE2eNB,
enb_data,
ue_data,
subframe,
0, // abstraction_flag
&PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms,
0, // frame is only used for abstraction
eNB_id,
CC_id);
}
return(0);
}
void init_devices(void){
module_id_t UE_id, eNB_id;
uint8_t CC_id;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++) {
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.Mod_id = eNB_id;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.CC_id = CC_id;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_start_func = eNB_trx_start;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_read_func = eNB_trx_read;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_write_func = eNB_trx_write;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_end_func = eNB_trx_end;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_stop_func = eNB_trx_stop;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_set_freq_func = eNB_trx_set_freq;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_set_gains_func = eNB_trx_set_gains;
}
for (UE_id=0;UE_id<NB_eNB_INST;UE_id++) {
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.Mod_id = UE_id;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.CC_id = CC_id;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_start_func = UE_trx_start;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_read_func = UE_trx_read;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_write_func = UE_trx_write;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_end_func = UE_trx_end;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_stop_func = UE_trx_stop;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_freq_func = UE_trx_set_freq;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_gains_func = UE_trx_set_gains;
}
}
}
void init_openair1(void)
{
module_id_t UE_id, eNB_id;
......@@ -1029,7 +1152,9 @@ void init_openair1(void)
}
}
init_eNB(eNodeB_3GPP,NB_eNB_INST);
init_devices ();
init_eNB(oai_emulation.info.node_function,oai_emulation.info.node_timing,NB_eNB_INST);
// init_ue_status();
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
......
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