Commit ca790b59 authored by Aikaterini's avatar Aikaterini

resolve errors after merging with develop / add configuration file for RRH with USRP

parent 8fc747ac
...@@ -749,56 +749,6 @@ include_directories("${OPENAIR_DIR}") ...@@ -749,56 +749,6 @@ include_directories("${OPENAIR_DIR}")
# Utilities Library # Utilities Library
################ ################
if (ENB_AGENT)
# set the version of protobuf messages, V3 not supported yet
add_list1_option(PRPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3)
if (${PRPT_VERSION} STREQUAL "V2")
set (PRPTDIR V2)
elseif (${PRPT_VERSION} STREQUAL "V3")
set (PRPTDIR V3)
endif(${PRPT_VERSION} STREQUAL "V2")
set(PRPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${PRPTDIR} )
set(PRPT_MSG_FILES
${PRPT_MSG_DIR}/header.proto
${PRPT_MSG_DIR}/progran.proto
${PRPT_MSG_DIR}/stats_common.proto
${PRPT_MSG_DIR}/stats_messages.proto
)
set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR})
message("calling ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}")
execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES})
file(GLOB PRPT_source ${PRPT_C_DIR}/*.c)
set(PRPT_OAI_generated
${PRPT_C_DIR}/header.pb-c.c
${PRPT_C_DIR}/progran.pb-c.c
${PRPT_C_DIR}/stats_common.pb-c.c
${PRPT_C_DIR}/stats_messages.pb-c.c
)
file(GLOB prpt_h ${PRPT_C_DIR}/*.h)
set(prpt_h ${prpt_h} )
add_library(PRPT_MSG
${PRPT_OAI_generated}
${PRPT_source}
)
include_directories ("${PRPT_C_DIR}")
add_library(ASYNC_IF
${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
)
set(ASYNC_IF_LIB ASYNC_IF)
include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)
endif()
add_library(HASHTABLE add_library(HASHTABLE
${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c ${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c
${OPENAIR_DIR}/common/utils/collection/hashtable/obj_hashtable.c ${OPENAIR_DIR}/common/utils/collection/hashtable/obj_hashtable.c
...@@ -955,6 +905,7 @@ set(PHY_SRC ...@@ -955,6 +905,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
${OPENAIR1_DIR}/PHY/INIT/lte_init.c ${OPENAIR1_DIR}/PHY/INIT/lte_init.c
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
...@@ -1706,7 +1657,7 @@ add_executable(oaisim_nos1 ...@@ -1706,7 +1657,7 @@ add_executable(oaisim_nos1
target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim_nos1 target_link_libraries (oaisim_nos1
-Wl,--start-group -Wl,--start-group
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${ASYNC_IF_LIB} RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group ) -Wl,--end-group )
target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
......
...@@ -51,8 +51,11 @@ int set_device(openair0_device *device) { ...@@ -51,8 +51,11 @@ int set_device(openair0_device *device) {
case EXMIMO_DEV: case EXMIMO_DEV:
printf("[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH")); printf("[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break; break;
case USRP_DEV: case USRP_B200_DEV:
printf("[%s] has loaded USRP device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH")); printf("[%s] has loaded USRP B200 device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break;
case USRP_X300_DEV:
printf("[%s] has loaded USRP X300 device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
break; break;
case BLADERF_DEV: case BLADERF_DEV:
printf("[%s] has loaded BLADERF device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH")); printf("[%s] has loaded BLADERF device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
......
...@@ -72,17 +72,17 @@ int eth_socket_init_raw(openair0_device *device) { ...@@ -72,17 +72,17 @@ int eth_socket_init_raw(openair0_device *device) {
int sock_proto=0; int sock_proto=0;
if (device->host_type == RRH_HOST ) { /* RRH doesn't know remote MAC(will be retrieved from first packet send from BBU) and remote port(don't care) */ if (device->host_type == RRH_HOST ) { /* RRH doesn't know remote MAC(will be retrieved from first packet send from BBU) and remote port(don't care) */
local_mac = device->openair0_cfg.my_addr; local_mac = device->openair0_cfg->my_addr;
local_port = device->openair0_cfg.my_port; local_port = device->openair0_cfg->my_port;
remote_mac = malloc(ETH_ALEN); remote_mac = malloc(ETH_ALEN);
memset(remote_mac,0,ETH_ALEN); memset(remote_mac,0,ETH_ALEN);
remote_port = 0; remote_port = 0;
printf("[%s] local MAC addr %s remote MAC addr %s\n","RRH", local_mac,remote_mac); printf("[%s] local MAC addr %s remote MAC addr %s\n","RRH", local_mac,remote_mac);
} else { } else {
local_mac = device->openair0_cfg.my_addr; local_mac = device->openair0_cfg->my_addr;
local_port = device->openair0_cfg.my_port; local_port = device->openair0_cfg->my_port;
remote_mac = device->openair0_cfg.remote_addr; remote_mac = device->openair0_cfg->remote_addr;
remote_port = device->openair0_cfg.remote_port; remote_port = device->openair0_cfg->remote_port;
printf("[%s] local MAC addr %s remote MAC addr %s\n","BBU", local_mac,remote_mac); printf("[%s] local MAC addr %s remote MAC addr %s\n","BBU", local_mac,remote_mac);
} }
...@@ -109,7 +109,7 @@ int eth_socket_init_raw(openair0_device *device) { ...@@ -109,7 +109,7 @@ int eth_socket_init_raw(openair0_device *device) {
local_addr[Mod_id].sll_family = AF_PACKET; local_addr[Mod_id].sll_family = AF_PACKET;
local_addr[Mod_id].sll_ifindex = if_index[Mod_id].ifr_ifindex; local_addr[Mod_id].sll_ifindex = if_index[Mod_id].ifr_ifindex;
/* hear traffic from specific protocol*/ /* hear traffic from specific protocol*/
local_addr[Mod_id].sll_protocol = htons((short)device->openair0_cfg.my_port); local_addr[Mod_id].sll_protocol = htons((short)device->openair0_cfg->my_port);
local_addr[Mod_id].sll_halen = ETH_ALEN; local_addr[Mod_id].sll_halen = ETH_ALEN;
local_addr[Mod_id].sll_pkttype = PACKET_OTHERHOST; local_addr[Mod_id].sll_pkttype = PACKET_OTHERHOST;
addr_len[Mod_id] = sizeof(struct sockaddr_ll); addr_len[Mod_id] = sizeof(struct sockaddr_ll);
...@@ -122,7 +122,7 @@ int eth_socket_init_raw(openair0_device *device) { ...@@ -122,7 +122,7 @@ int eth_socket_init_raw(openair0_device *device) {
/* Construct the Ethernet header */ /* Construct the Ethernet header */
ether_aton_r(local_mac, (struct ether_addr *)(&(eh.ether_shost))); ether_aton_r(local_mac, (struct ether_addr *)(&(eh.ether_shost)));
ether_aton_r(remote_mac, (struct ether_addr *)(&(eh.ether_dhost))); ether_aton_r(remote_mac, (struct ether_addr *)(&(eh.ether_dhost)));
eh.ether_type = htons((short)device->openair0_cfg.my_port); eh.ether_type = htons((short)device->openair0_cfg->my_port);
printf("[%s] binding mod_%d to hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"),Mod_id,eh.ether_shost[0],eh.ether_shost[1],eh.ether_shost[2],eh.ether_shost[3],eh.ether_shost[4],eh.ether_shost[5]); printf("[%s] binding mod_%d to hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"),Mod_id,eh.ether_shost[0],eh.ether_shost[1],eh.ether_shost[2],eh.ether_shost[3],eh.ether_shost[4],eh.ether_shost[5]);
......
...@@ -71,18 +71,18 @@ int addr_len[MAX_INST]; ...@@ -71,18 +71,18 @@ int addr_len[MAX_INST];
int sock_type=0; int sock_type=0;
int sock_proto=0; int sock_proto=0;
int enable=1; int enable=1;
if (device->host_type == RRH_HOST ) { if (device->host_type == RRH_HOST ) {
local_ip = device->openair0_cfg.my_addr; local_ip = device->openair0_cfg->my_addr;
local_port = device->openair0_cfg.my_port; local_port = device->openair0_cfg->my_port;
remote_ip = "0.0.0.0"; remote_ip = "0.0.0.0";
remote_port = 0; remote_port = 0;
printf("[%s] local ip addr %s port %d\n", "RRH", local_ip, local_port); printf("[%s] local ip addr %s port %d\n", "RRH", local_ip, local_port);
} else { } else {
local_ip = device->openair0_cfg.my_addr; local_ip = device->openair0_cfg->my_addr;
local_port = device->openair0_cfg.my_port; local_port = device->openair0_cfg->my_port;
remote_ip = device->openair0_cfg.remote_addr; remote_ip = device->openair0_cfg->remote_addr;
remote_port = device->openair0_cfg.remote_port; remote_port = device->openair0_cfg->remote_port;
printf("[%s] local ip addr %s port %d\n","BBU", local_ip, local_port); printf("[%s] local ip addr %s port %d\n","BBU", local_ip, local_port);
} }
...@@ -123,22 +123,17 @@ int addr_len[MAX_INST]; ...@@ -123,22 +123,17 @@ int addr_len[MAX_INST];
} }
/* apply additional configuration */ /* apply additional configuration */
//ethernet_tune (device,MTU_SIZE,UDP_PACKET_SIZE_BYTES(device->openair0_cfg.samples_per_packet)); //ethernet_tune (device,MTU_SIZE,UDP_PACKET_SIZE_BYTES(device->openair0_cfg->samples_per_packet));
/* if RRH, then I am the server, so bind */ /* want to receive -> so bind */
if (device->host_type == RRH_HOST) {
if (bind(eth->sockfd[Mod_id],(struct sockaddr *)&local_addr[Mod_id],addr_len[Mod_id])<0) { if (bind(eth->sockfd[Mod_id],(struct sockaddr *)&local_addr[Mod_id],addr_len[Mod_id])<0) {
perror("ETHERNET: Cannot bind to socket"); perror("ETHERNET: Cannot bind to socket");
exit(0); exit(0);
} else { } else {
printf("[%s] binding mod_%d to %s:%d\n","RRH",Mod_id,str_local,ntohs(local_addr[Mod_id].sin_port)); printf("[%s] binding mod_%d to %s:%d\n","RRH",Mod_id,str_local,ntohs(local_addr[Mod_id].sin_port));
} }
/* if BBU, then I am a client, so connect */
} else { printf("ssssssssssssssss\n");
printf("[%s] Connecting to %s:%d\n","BBU",str_remote,ntohs(dest_addr[Mod_id].sin_port));
}
return 0; return 0;
} }
...@@ -359,14 +354,14 @@ int eth_get_dev_conf_udp(openair0_device *device) { ...@@ -359,14 +354,14 @@ int eth_get_dev_conf_udp(openair0_device *device) {
/* get remote ip address and port */ /* get remote ip address and port */
/* inet_ntop(AF_INET, &(dest_addr[Mod_id].sin_addr), str1, INET_ADDRSTRLEN); */ /* inet_ntop(AF_INET, &(dest_addr[Mod_id].sin_addr), str1, INET_ADDRSTRLEN); */
/* device->openair0_cfg.remote_port =ntohs(dest_addr[Mod_id].sin_port); */ /* device->openair0_cfg->remote_port =ntohs(dest_addr[Mod_id].sin_port); */
/* device->openair0_cfg.remote_addr =str1; */ /* device->openair0_cfg->remote_addr =str1; */
/* /\* restore local ip address and port *\/ */ /* /\* restore local ip address and port *\/ */
/* inet_ntop(AF_INET, &(local_addr[Mod_id].sin_addr), str, INET_ADDRSTRLEN); */ /* inet_ntop(AF_INET, &(local_addr[Mod_id].sin_addr), str, INET_ADDRSTRLEN); */
/* device->openair0_cfg.my_port =ntohs(local_addr[Mod_id].sin_port); */ /* device->openair0_cfg->my_port =ntohs(local_addr[Mod_id].sin_port); */
/* device->openair0_cfg.my_addr =str; */ /* device->openair0_cfg->my_addr =str; */
/* printf("[RRH] mod_%d socket %d connected to BBU %s:%d %s:%d\n", Mod_id, eth->sockfd[Mod_id],str1, device->openair0_cfg.remote_port, str, device->openair0_cfg.my_port); */ /* printf("[RRH] mod_%d socket %d connected to BBU %s:%d %s:%d\n", Mod_id, eth->sockfd[Mod_id],str1, device->openair0_cfg->remote_port, str, device->openair0_cfg->my_port); */
return 0; return 0;
} }
...@@ -72,7 +72,7 @@ int trx_eth_start(openair0_device *device) { ...@@ -72,7 +72,7 @@ int trx_eth_start(openair0_device *device) {
if(eth_get_dev_conf_raw(device)!=0) return -1; if(eth_get_dev_conf_raw(device)!=0) return -1;
} }
/* adjust MTU wrt number of samples per packet */ /* adjust MTU wrt number of samples per packet */
if(ethernet_tune (device,MTU_SIZE,RAW_PACKET_SIZE_BYTES(device->openair0_cfg.samples_per_packet))!=0) return -1; if(ethernet_tune (device,MTU_SIZE,RAW_PACKET_SIZE_BYTES(device->openair0_cfg->samples_per_packet))!=0) return -1;
} else { } else {
if (eth_socket_init_udp(device)!=0) return -1; if (eth_socket_init_udp(device)!=0) return -1;
/* RRH gets openair0 device configuration - BBU sets openair0 device configuration*/ /* RRH gets openair0 device configuration - BBU sets openair0 device configuration*/
...@@ -82,7 +82,7 @@ int trx_eth_start(openair0_device *device) { ...@@ -82,7 +82,7 @@ int trx_eth_start(openair0_device *device) {
if(eth_get_dev_conf_udp(device)!=0) return -1; if(eth_get_dev_conf_udp(device)!=0) return -1;
} }
/* adjust MTU wrt number of samples per packet */ /* adjust MTU wrt number of samples per packet */
if(ethernet_tune (device,MTU_SIZE,UDP_PACKET_SIZE_BYTES(device->openair0_cfg.samples_per_packet))!=0) return -1; if(ethernet_tune (device,MTU_SIZE,UDP_PACKET_SIZE_BYTES(device->openair0_cfg->samples_per_packet))!=0) return -1;
} }
return 0; return 0;
...@@ -93,7 +93,7 @@ void trx_eth_end(openair0_device *device) { ...@@ -93,7 +93,7 @@ void trx_eth_end(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id; int Mod_id = device->Mod_id;
/*destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */ /* destroys socket only for the processes that call the eth_end fuction-- shutdown() for beaking the pipe */
if ( close(eth->sockfd[Mod_id]) <0 ) { if ( close(eth->sockfd[Mod_id]) <0 ) {
perror("ETHERNET: Failed to close socket"); perror("ETHERNET: Failed to close socket");
exit(0); exit(0);
...@@ -177,7 +177,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -177,7 +177,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
if (1==0) { if (1==0) {
/***************** get working interface name ***************************/ /***************** get working interface name ***************************/
/* convert ascii ip address from config file to network binary format */ /* convert ascii ip address from config file to network binary format */
inet_aton(device->openair0_cfg.my_addr, &ia); inet_aton(device->openair0_cfg->my_addr, &ia);
/* look for the interface used, we have its ip address get info on all our network interfaces*/ /* look for the interface used, we have its ip address get info on all our network interfaces*/
ids = if_nameindex(); ids = if_nameindex();
/* loop on these network interfaces */ /* loop on these network interfaces */
...@@ -201,7 +201,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) { ...@@ -201,7 +201,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value) {
} }
if_freenameindex(ids); if_freenameindex(ids);
if( if_name == NULL) { if( if_name == NULL) {
printf("Unable to find interface name for %s\n",device->openair0_cfg.my_addr); printf("Unable to find interface name for %s\n",device->openair0_cfg->my_addr);
return -1; return -1;
} }
eth->if_name[Mod_id]=if_name; eth->if_name[Mod_id]=if_name;
...@@ -339,12 +339,9 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, cha ...@@ -339,12 +339,9 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, cha
eth_state_t *eth = (eth_state_t*)malloc(sizeof(eth_state_t)); eth_state_t *eth = (eth_state_t*)malloc(sizeof(eth_state_t));
memset(eth, 0, sizeof(eth_state_t)); memset(eth, 0, sizeof(eth_state_t));
int card = 0;
/*hardcoded!!!!*/
eth->flags = ETH_RAW_MODE; eth->flags = ETH_RAW_MODE;
eth->buffer_size = (unsigned int)openair0_cfg[card].samples_per_packet*sizeof(int32_t);
printf("[ETHERNET]: Initializing openair0_device for %s ...\n", ((device->host_type == BBU_HOST) ? "BBU": "RRH")); printf("[ETHERNET]: Initializing openair0_device for %s ...\n", ((device->host_type == BBU_HOST) ? "BBU": "RRH"));
device->Mod_id = num_devices_eth++; device->Mod_id = num_devices_eth++;
device->transp_type = ETHERNET_TP; device->transp_type = ETHERNET_TP;
...@@ -370,7 +367,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, cha ...@@ -370,7 +367,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, cha
device->priv = eth; device->priv = eth;
openair0_cfg->iq_txshift = 5; openair0_cfg->iq_txshift = 5;
openair0_cfg->iq_rxrescale = 15; openair0_cfg->iq_rxrescale = 15;
memcpy((void*)&device->openair0_cfg,(void*)openair0_cfg,sizeof(openair0_config_t)); memcpy((void*)device->openair0_cfg,(void*)openair0_cfg,sizeof(openair0_config_t));
return 0; return 0;
} }
...@@ -407,14 +404,14 @@ void dump_dev(openair0_device *device) { ...@@ -407,14 +404,14 @@ void dump_dev(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
printf("Ethernet device interface %i configuration:\n" ,device->openair0_cfg.Mod_id); printf("Ethernet device interface %i configuration:\n" ,device->openair0_cfg->Mod_id);
printf(" Log level is %i :\n" ,device->openair0_cfg.log_level); printf(" Log level is %i :\n" ,device->openair0_cfg->log_level);
printf(" RB number: %i, sample rate: %lf \n" , printf(" RB number: %i, sample rate: %lf \n" ,
device->openair0_cfg.num_rb_dl, device->openair0_cfg.sample_rate); device->openair0_cfg->num_rb_dl, device->openair0_cfg->sample_rate);
printf(" Delay: %i, Forward samples: %u \n" , printf(" Scheduling_advance: %i, Sample_advance: %u \n" ,
device->openair0_cfg.tx_delay, device->openair0_cfg.tx_forward_nsamps); device->openair0_cfg->tx_scheduling_advance, device->openair0_cfg->tx_sample_advance);
printf(" BBU configured for %i tx/%i rx channels)\n", printf(" BBU configured for %i tx/%i rx channels)\n",
device->openair0_cfg.tx_num_channels,device->openair0_cfg.rx_num_channels); device->openair0_cfg->tx_num_channels,device->openair0_cfg->rx_num_channels);
printf(" Running flags: %s %s %s\n", printf(" Running flags: %s %s %s\n",
((eth->flags & ETH_RAW_MODE) ? "RAW socket mode - ":""), ((eth->flags & ETH_RAW_MODE) ? "RAW socket mode - ":""),
((eth->flags & ETH_UDP_MODE) ? "UDP socket mode - ":""), ((eth->flags & ETH_UDP_MODE) ? "UDP socket mode - ":""),
...@@ -425,14 +422,14 @@ void dump_dev(openair0_device *device) { ...@@ -425,14 +422,14 @@ void dump_dev(openair0_device *device) {
void inline dump_txcounters(openair0_device *device) { void inline dump_txcounters(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
printf(" Ethernet device interface %i, tx counters:\n" ,device->openair0_cfg.Mod_id); printf(" Ethernet device interface %i, tx counters:\n" ,device->openair0_cfg->Mod_id);
printf(" Sent packets: %llu send errors: %i\n", eth->tx_count, eth->num_tx_errors); printf(" Sent packets: %llu send errors: %i\n", eth->tx_count, eth->num_tx_errors);
} }
void inline dump_rxcounters(openair0_device *device) { void inline dump_rxcounters(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
printf(" Ethernet device interface %i rx counters:\n" ,device->openair0_cfg.Mod_id); printf(" Ethernet device interface %i rx counters:\n" ,device->openair0_cfg->Mod_id);
printf(" Received packets: %llu missed packets errors: %i\n", eth->rx_count, eth->num_underflows); printf(" Received packets: %llu missed packets errors: %i\n", eth->rx_count, eth->num_underflows);
} }
......
...@@ -172,7 +172,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp ...@@ -172,7 +172,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif #endif
if (device->type == USRP_B200_IF) { if (device->type == USRP_B200_DEV) {
if (cc>1) { if (cc>1) {
// receive multiple channels (e.g. RF A and RF B) // receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs; std::vector<void *> buff_ptrs;
...@@ -198,7 +198,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp ...@@ -198,7 +198,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif #endif
} }
} }
} else if (device->type == USRP_X300_IF) { } else if (device->type == USRP_X300_DEV) {
if (cc>1) { if (cc>1) {
// receive multiple channels (e.g. RF A and RF B) // receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs; std::vector<void *> buff_ptrs;
...@@ -395,15 +395,9 @@ extern "C" { ...@@ -395,15 +395,9 @@ extern "C" {
// Initialize USRP device // Initialize USRP device
<<<<<<< HEAD std::string args = "type=b200";
std::string args = "type=b200";
uhd::device_addrs_t device_adds = uhd::device::find(args);
size_t i;
printf("Checking for USRPs\n");
=======
uhd::device_addrs_t device_adds = uhd::device::find(args); uhd::device_addrs_t device_adds = uhd::device::find(args);
size_t i; size_t i;
...@@ -413,29 +407,19 @@ extern "C" { ...@@ -413,29 +407,19 @@ extern "C" {
sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers); sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers);
printf("Checking for USRPs : UHD %s (%d.%d.%d)\n",uhd::get_version_string().c_str(),vers,subvers,subsubvers); printf("Checking for USRPs : UHD %s (%d.%d.%d)\n",uhd::get_version_string().c_str(),vers,subvers,subsubvers);
>>>>>>> acd607fa359709ba16a83437f483c230cee1d9b0
if(device_adds.size() == 0) if(device_adds.size() == 0)
{ {
double usrp_master_clock = 184.32e6; double usrp_master_clock = 184.32e6;
std::string args = "type=x300"; std::string args = "type=x300";
// workaround for an api problem, master clock has to be set with the constructor not via set_master_clock_rate // workaround for an api problem, master clock has to be set with the constructor not via set_master_clock_rate
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
uhd::device_addrs_t device_adds = uhd::device::find(args); uhd::device_addrs_t device_adds = uhd::device::find(args);
if(device_adds.size() == 0) if(device_adds.size() == 0)
<<<<<<< HEAD
{
std::cerr<<"No USRP Device Found. " << std::endl;
free(s);
return -1;
}
=======
{ {
std::cerr<<"No USRP Device Found. " << std::endl; std::cerr<<"No USRP Device Found. " << std::endl;
free(s); free(s);
...@@ -444,17 +428,16 @@ extern "C" { ...@@ -444,17 +428,16 @@ extern "C" {
} }
>>>>>>> acd607fa359709ba16a83437f483c230cee1d9b0
printf("Found USRP X300\n"); printf("Found USRP X300\n");
s->usrp = uhd::usrp::multi_usrp::make(args); s->usrp = uhd::usrp::multi_usrp::make(args);
// s->usrp->set_rx_subdev_spec(rx_subdev); // s->usrp->set_rx_subdev_spec(rx_subdev);
// s->usrp->set_tx_subdev_spec(tx_subdev); // s->usrp->set_tx_subdev_spec(tx_subdev);
// lock mboard clocks // lock mboard clocks
s->usrp->set_clock_source("internal"); s->usrp->set_clock_source("internal");
//Setting device type to USRP X300/X310 //Setting device type to USRP X300/X310
device->type=USRP_X300_IF; device->type=USRP_X300_DEV;
// this is not working yet, master clock has to be set via constructor // this is not working yet, master clock has to be set via constructor
// set master clock rate and sample rate for tx & rx for streaming // set master clock rate and sample rate for tx & rx for streaming
...@@ -511,11 +494,8 @@ extern "C" { ...@@ -511,11 +494,8 @@ extern "C" {
// s->usrp->set_clock_source("internal"); // s->usrp->set_clock_source("internal");
// set master clock rate and sample rate for tx & rx for streaming // set master clock rate and sample rate for tx & rx for streaming
device->type = USRP_B200_IF; device->type = USRP_B200_DEV;
<<<<<<< HEAD
=======
if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) { if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
openair0_cfg[0].rx_gain_calib_table = calib_table_b210; openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
...@@ -574,20 +554,14 @@ extern "C" { ...@@ -574,20 +554,14 @@ extern "C" {
} }
} }
>>>>>>> acd607fa359709ba16a83437f483c230cee1d9b0
for(i=0;i<s->usrp->get_rx_num_channels();i++) { for(i=0;i<s->usrp->get_rx_num_channels();i++) {
if (i<openair0_cfg[0].rx_num_channels) { if (i<openair0_cfg[0].rx_num_channels) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i); s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i); s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i);
printf("Setting rx freq/gain on channel %lu/%lu : BW %f (readback %f)\n",i,s->usrp->get_rx_num_channels(),openair0_cfg[0].rx_bw/1e6,s->usrp->get_rx_bandwidth(i)/1e6); printf("Setting rx freq/gain on channel %lu/%lu : BW %f (readback %f)\n",i,s->usrp->get_rx_num_channels(),openair0_cfg[0].rx_bw/1e6,s->usrp->get_rx_bandwidth(i)/1e6);
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i); s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
<<<<<<< HEAD
set_rx_gain_offset(&openair0_cfg[0],i);
=======
set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust); set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
>>>>>>> acd607fa359709ba16a83437f483c230cee1d9b0
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i); ::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
// limit to maximum gain // limit to maximum gain
if (openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] > gain_range.stop()) { if (openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] > gain_range.stop()) {
...@@ -610,11 +584,11 @@ extern "C" { ...@@ -610,11 +584,11 @@ extern "C" {
s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[i],i); s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[i],i);
} }
} }
// display USRP settings // display USRP settings
std::cout << boost::format("Actual master clock: %fMHz...") % (s->usrp->get_master_clock_rate()/1e6) << std::endl; std::cout << boost::format("Actual master clock: %fMHz...") % (s->usrp->get_master_clock_rate()/1e6) << std::endl;
// create tx & rx streamer // create tx & rx streamer
uhd::stream_args_t stream_args_rx("sc16", "sc16"); uhd::stream_args_t stream_args_rx("sc16", "sc16");
//stream_args_rx.args["spp"] = str(boost::format("%d") % 2048);//(openair0_cfg[0].rx_num_channels*openair0_cfg[0].samples_per_packet)); //stream_args_rx.args["spp"] = str(boost::format("%d") % 2048);//(openair0_cfg[0].rx_num_channels*openair0_cfg[0].samples_per_packet));
...@@ -623,17 +597,18 @@ extern "C" { ...@@ -623,17 +597,18 @@ extern "C" {
s->rx_stream = s->usrp->get_rx_stream(stream_args_rx); s->rx_stream = s->usrp->get_rx_stream(stream_args_rx);
std::cout << boost::format("rx_max_num_samps %u") % (s->rx_stream->get_max_num_samps()) << std::endl; std::cout << boost::format("rx_max_num_samps %u") % (s->rx_stream->get_max_num_samps()) << std::endl;
//openair0_cfg[0].samples_per_packet = s->rx_stream->get_max_num_samps(); //openair0_cfg[0].samples_per_packet = s->rx_stream->get_max_num_samps();
uhd::stream_args_t stream_args_tx("sc16", "sc16"); uhd::stream_args_t stream_args_tx("sc16", "sc16");
//stream_args_tx.args["spp"] = str(boost::format("%d") % 2048);//(openair0_cfg[0].tx_num_channels*openair0_cfg[0].samples_per_packet)); //stream_args_tx.args["spp"] = str(boost::format("%d") % 2048);//(openair0_cfg[0].tx_num_channels*openair0_cfg[0].samples_per_packet));
for (i = 0; i<openair0_cfg[0].tx_num_channels; i++) for (i = 0; i<openair0_cfg[0].tx_num_channels; i++)
stream_args_tx.channels.push_back(i); stream_args_tx.channels.push_back(i);
s->tx_stream = s->usrp->get_tx_stream(stream_args_tx); s->tx_stream = s->usrp->get_tx_stream(stream_args_tx);
std::cout << boost::format("tx_max_num_samps %u") % (s->tx_stream->get_max_num_samps()) << std::endl; std::cout << boost::format("tx_max_num_samps %u") % (s->tx_stream->get_max_num_samps()) << std::endl;
s->usrp->set_time_now(uhd::time_spec_t(0.0)); s->usrp->set_time_now(uhd::time_spec_t(0.0));
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) { for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
if (i<openair0_cfg[0].rx_num_channels) { if (i<openair0_cfg[0].rx_num_channels) {
printf("RX Channel %lu\n",i); printf("RX Channel %lu\n",i);
...@@ -644,8 +619,9 @@ extern "C" { ...@@ -644,8 +619,9 @@ extern "C" {
std::cout << boost::format("Actual RX antenna: %s...") % (s->usrp->get_rx_antenna(i)) << std::endl; std::cout << boost::format("Actual RX antenna: %s...") % (s->usrp->get_rx_antenna(i)) << std::endl;
} }
} }
for (i=0;i<openair0_cfg[0].tx_num_channels;i++) { for (i=0;i<openair0_cfg[0].tx_num_channels;i++) {
if (i<openair0_cfg[0].tx_num_channels) { if (i<openair0_cfg[0].tx_num_channels) {
printf("TX Channel %lu\n",i); printf("TX Channel %lu\n",i);
std::cout << std::endl<<boost::format("Actual TX sample rate: %fMSps...") % (s->usrp->get_tx_rate(i)/1e6) << std::endl; std::cout << std::endl<<boost::format("Actual TX sample rate: %fMSps...") % (s->usrp->get_tx_rate(i)/1e6) << std::endl;
...@@ -655,11 +631,10 @@ extern "C" { ...@@ -655,11 +631,10 @@ extern "C" {
std::cout << boost::format("Actual TX antenna: %s...") % (s->usrp->get_tx_antenna(i)) << std::endl; std::cout << boost::format("Actual TX antenna: %s...") % (s->usrp->get_tx_antenna(i)) << std::endl;
} }
} }
std::cout << boost::format("Device timestamp: %f...") % (s->usrp->get_time_now().get_real_secs()) << std::endl; std::cout << boost::format("Device timestamp: %f...") % (s->usrp->get_time_now().get_real_secs()) << std::endl;
device->priv = s; device->priv = s;
device->type = USRP_DEV;
device->trx_start_func = trx_usrp_start; device->trx_start_func = trx_usrp_start;
device->trx_write_func = trx_usrp_write; device->trx_write_func = trx_usrp_write;
device->trx_read_func = trx_usrp_read; device->trx_read_func = trx_usrp_read;
...@@ -673,37 +648,12 @@ extern "C" { ...@@ -673,37 +648,12 @@ extern "C" {
s->sample_rate = openair0_cfg[0].sample_rate; s->sample_rate = openair0_cfg[0].sample_rate;
// TODO: // TODO:
// init tx_forward_nsamps based usrp_time_offset ex // init tx_forward_nsamps based usrp_time_offset ex
/*if(is_equal(s->sample_rate, (double)30.72e6)) if(is_equal(s->sample_rate, (double)30.72e6))
s->tx_forward_nsamps = 176; s->tx_forward_nsamps = 176;
if(is_equal(s->sample_rate, (double)15.36e6)) if(is_equal(s->sample_rate, (double)15.36e6))
s->tx_forward_nsamps = 90; s->tx_forward_nsamps = 90;
if(is_equal(s->sample_rate, (double)7.68e6)) if(is_equal(s->sample_rate, (double)7.68e6))
s->tx_forward_nsamps = 50;*/ s->tx_forward_nsamps = 50;
/* move device specific parameters from lte-softmodem.c here */
if(is_equal(s->sample_rate, (double)30.72e6)) {
openair0_cfg->tx_delay = 8;
s->tx_forward_nsamps = 175;
openair0_cfg->tx_forward_nsamps = 175;
}
if(is_equal(s->sample_rate, (double)15.36e6)) {
openair0_cfg->tx_delay = 5;
s->tx_forward_nsamps = 95;
openair0_cfg->tx_forward_nsamps = 95;
}
if(is_equal(s->sample_rate, (double)7.68e6)) {
openair0_cfg->tx_delay = 5;
s->tx_forward_nsamps = 70;
openair0_cfg->tx_forward_nsamps = 70;
}
if(is_equal(s->sample_rate, (double)1.92e6)) {
openair0_cfg->tx_delay = 8;
s->tx_forward_nsamps = 40;
openair0_cfg->tx_forward_nsamps = 40;
}
openair0_cfg->iq_txshift= 5;
openair0_cfg->iq_rxrescale = 15;
printf("check params %d:%d",openair0_cfg->tx_forward_nsamps, openair0_cfg->tx_delay);
return 0; return 0;
} }
} }
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "92";
////////// Physical parameters:
component_carriers = (
{
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2680000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 120;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -29;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -90;
pusch_alpha = "AL1";
pucch_p0_Nominal = -96;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -108;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.170";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
rrh_gw_config = (
{
udp = 1;
raw = 0;
active = 1;
#remote_addr = "169.254.8.28";
#remote_addr = "127.0.0.1";
#remote_addr = "74:d4:35:cc:88:45";
#local_addr = "169.254.7.91";
#local_addr = "127.0.0.1";
#local_addr = "d4:be:d9:22:0a:ac";
local_address = "192.168.12.242" ;
remote_address = "192.168.12.31" ;
local_port = 50000;
remote_port = 50001;
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.216/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.216/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
...@@ -148,7 +148,7 @@ void *rrh_proc_UE_thread(void * arg) { ...@@ -148,7 +148,7 @@ void *rrh_proc_UE_thread(void * arg) {
unsigned int samples_per_frame=0; unsigned int samples_per_frame=0;
rrh_module_t *dev=(rrh_module_t *)arg; rrh_module_t *dev=(rrh_module_t *)arg;
samples_per_frame= dev->eth_dev.openair0_cfg.samples_per_frame; samples_per_frame= dev->eth_dev.openair0_cfg->samples_per_frame;
AssertFatal(samples_per_frame <=0, "invalide samples_per_frame !%u\n",samples_per_frame); AssertFatal(samples_per_frame <=0, "invalide samples_per_frame !%u\n",samples_per_frame);
time_req.tv_sec = 0; time_req.tv_sec = 0;
...@@ -260,7 +260,7 @@ void *rrh_UE_thread(void *arg) { ...@@ -260,7 +260,7 @@ void *rrh_UE_thread(void *arg) {
void *tmp; void *tmp;
unsigned int samples_per_frame=0; unsigned int samples_per_frame=0;
samples_per_frame= dev->eth_dev.openair0_cfg.samples_per_frame; samples_per_frame= dev->eth_dev.openair0_cfg->samples_per_frame;
time_req_1us.tv_sec = 0; time_req_1us.tv_sec = 0;
time_req_1us.tv_nsec = 1000; time_req_1us.tv_nsec = 1000;
...@@ -269,26 +269,26 @@ void *rrh_UE_thread(void *arg) { ...@@ -269,26 +269,26 @@ void *rrh_UE_thread(void *arg) {
cmd=dev->eth_dev.trx_start_func(&dev->eth_dev); cmd=dev->eth_dev.trx_start_func(&dev->eth_dev);
/* allocate memory for TX/RX buffers */ /* allocate memory for TX/RX buffers */
rx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg.rx_num_channels*sizeof(int32_t*)); rx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*));
tx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg.tx_num_channels*sizeof(int32_t*)); tx_buffer_UE = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*));
for (i=0; i<dev->eth_dev.openair0_cfg.rx_num_channels; i++) { for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4)); tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4));
memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4)); memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4));
rx_buffer_UE[i]=(tmp+4*sizeof(int32_t)); rx_buffer_UE[i]=(tmp+4*sizeof(int32_t));
} }
for (i=0; i<dev->eth_dev.openair0_cfg.tx_num_channels; i++) { for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4)); tmp=(void *)malloc(sizeof(int32_t)*(samples_per_frame+4));
memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4)); memset(tmp,0,sizeof(int32_t)*(samples_per_frame+4));
tx_buffer_UE[i]=(tmp+4*sizeof(int32_t)); tx_buffer_UE[i]=(tmp+4*sizeof(int32_t));
} }
printf("Client %s:%d is connected (DL_RB=%d) rt=%d|%d. \n" , dev->eth_dev.openair0_cfg.remote_addr, printf("Client %s:%d is connected (DL_RB=%d) rt=%d|%d. \n" , dev->eth_dev.openair0_cfg->remote_addr,
dev->eth_dev.openair0_cfg.remote_port, dev->eth_dev.openair0_cfg->remote_port,
dev->eth_dev.openair0_cfg.num_rb_dl, dev->eth_dev.openair0_cfg->num_rb_dl,
dev->eth_dev.openair0_cfg.rx_num_channels, dev->eth_dev.openair0_cfg->rx_num_channels,
dev->eth_dev.openair0_cfg.tx_num_channels); dev->eth_dev.openair0_cfg->tx_num_channels);
if (cmd==START_CMD) { if (cmd==START_CMD) {
...@@ -348,8 +348,8 @@ void *rrh_UE_rx_thread(void *arg) { ...@@ -348,8 +348,8 @@ void *rrh_UE_rx_thread(void *arg) {
openair0_timestamp temp, last_hw_counter=0; openair0_timestamp temp, last_hw_counter=0;
antenna_index = 0; antenna_index = 0;
nsamps = dev->eth_dev.openair0_cfg.samples_per_packet; nsamps = dev->eth_dev.openair0_cfg->samples_per_packet;
samples_per_frame = dev->eth_dev.openair0_cfg.samples_per_frame; samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
while (rrh_exit == 0) { while (rrh_exit == 0) {
if (!UE_rx_started) { if (!UE_rx_started) {
...@@ -492,8 +492,8 @@ void *rrh_UE_tx_thread(void *arg) { ...@@ -492,8 +492,8 @@ void *rrh_UE_tx_thread(void *arg) {
unsigned int samples_per_frame=0; unsigned int samples_per_frame=0;
antenna_index = 0; antenna_index = 0;
nsamps = dev->eth_dev.openair0_cfg.samples_per_packet; nsamps = dev->eth_dev.openair0_cfg->samples_per_packet;
samples_per_frame = dev->eth_dev.openair0_cfg.samples_per_frame; samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
while (rrh_exit == 0) { while (rrh_exit == 0) {
......
...@@ -127,7 +127,7 @@ static void check_dev_config( rrh_module_t *mod_enb); ...@@ -127,7 +127,7 @@ static void check_dev_config( rrh_module_t *mod_enb);
* \note * \note
* @ingroup _oai * @ingroup _oai
*/ */
static void calc_rt_period_ns( openair0_config_t openair0_cfg); static void calc_rt_period_ns( openair0_config_t *openair0_cfg);
...@@ -140,122 +140,34 @@ void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag) { ...@@ -140,122 +140,34 @@ void config_BBU_mod( rrh_module_t *mod_enb, uint8_t RT_flag, uint8_t NRT_flag) {
RT_flag_eNB=RT_flag; RT_flag_eNB=RT_flag;
NRT_flag_eNB=NRT_flag; NRT_flag_eNB=NRT_flag;
/* init socket and have handshake-like msg with client to exchange parameters */ /* init socket and have handshake-like msg with client to exchange parameters */
mod_enb->eth_dev.trx_start_func(&mod_enb->eth_dev);//change port make it plus_id mod_enb->eth_dev.trx_start_func(&mod_enb->eth_dev);//change port make it plus_id
if (1==0) { printf("sdfs\n");
/* if a RF iterface is added to RRH module get the configuration parameters sent from eNB */
if (mod_enb->devs->type != NONE_DEV ) {
memcpy((void*)&mod_enb->devs->openair0_cfg,(void *)&mod_enb->eth_dev.openair0_cfg,sizeof(openair0_config_t)); memcpy((void*)mod_enb->devs->openair0_cfg,(void *)mod_enb->eth_dev.openair0_cfg,sizeof(openair0_config_t));
printf("sdfs\n");
/* certain parameters have to be updated (calibration related)*/ /* check sanity of configuration parameters and print */
if ( mod_enb->devs->type == EXMIMO_DEV ) { check_dev_config(mod_enb);
if ( mod_enb->devs->openair0_cfg.num_rb_dl == 100 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 2048; /* initialize and configure the RF device */
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 175; if (openair0_device_load(mod_enb->devs, mod_enb->devs->openair0_cfg)<0) {
mod_enb->devs->openair0_cfg.tx_delay = 8; LOG_E(RRH,"Exiting, cannot initialize RF device.\n");
} exit(-1);
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 50 ) { } else {
mod_enb->devs->openair0_cfg.samples_per_packet = 2048; if (mod_enb->devs->type != NONE_DEV) {
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 95; /* start RF device */
mod_enb->devs->openair0_cfg.tx_delay = 5; if (mod_enb->devs->type == EXMIMO_DEV) {
} //call start function for exmino
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 25 ) { } else {
mod_enb->devs->openair0_cfg.samples_per_packet = 1024; if (mod_enb->devs->trx_start_func(mod_enb->devs)!=0)
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 70; LOG_E(RRH,"Unable to initiate RF device.\n");
mod_enb->devs->openair0_cfg.tx_delay = 6; else
} LOG_I(RRH,"RF device has been initiated.\n");
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 6 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 256;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 40;
mod_enb->devs->openair0_cfg.tx_delay = 8;
}
}
else if ((mod_enb->devs->type == USRP_B200_IF )||(mod_enb->devs->type == USRP_X300_IF )) {
if ( mod_enb->devs->openair0_cfg.num_rb_dl == 100 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 2048;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 175;
mod_enb->devs->openair0_cfg.tx_delay = 8;
}
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 50 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 2048;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 95;
mod_enb->devs->openair0_cfg.tx_delay = 5;
}
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 25 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 1024;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 70;
mod_enb->devs->openair0_cfg.tx_delay = 6;
}
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 6 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 256;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 40;
mod_enb->devs->openair0_cfg.tx_delay = 8;
} }
} }
else if(mod_enb->devs->type == BLADERF_DEV) { }
if ( mod_enb->devs->openair0_cfg.num_rb_dl == 100 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 2048;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 175;
mod_enb->devs->openair0_cfg.tx_delay = 8;
}
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 50 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 2048;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 95;
mod_enb->devs->openair0_cfg.tx_delay = 5;
}
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 25 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 1024;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 70;
mod_enb->devs->openair0_cfg.tx_delay = 6;
}
else if ( mod_enb->devs->openair0_cfg.num_rb_dl == 6 ) {
mod_enb->devs->openair0_cfg.samples_per_packet = 256;
mod_enb->devs->openair0_cfg.tx_forward_nsamps = 40;
mod_enb->devs->openair0_cfg.tx_delay = 8;
}
}
/* check sanity of configuration parameters and print */
check_dev_config(mod_enb);
/* initialize and configure the RF device */
if (openair0_device_load(mod_enb->devs, &mod_enb->devs->openair0_cfg)<0) {
LOG_E(RRH,"Exiting, cannot initialize RF device.\n");
exit(-1);
} else {
LOG_I(RRH,"RF device has been successfully initialized.\n");
}
}
} else {
memcpy((void*)&mod_enb->devs->openair0_cfg,(void *)&mod_enb->eth_dev.openair0_cfg,sizeof(openair0_config_t));
/* check sanity of configuration parameters and print */
check_dev_config(mod_enb);
/* initialize and configure the RF device */
if (openair0_device_load(mod_enb->devs, &mod_enb->devs->openair0_cfg)<0){
LOG_E(RRH,"Exiting, cannot initialize RF device.\n");
exit(-1);
} else {
if (mod_enb->devs->type != NONE_DEV) {
/* start RF device */
if (mod_enb->devs->type == EXMIMO_DEV) {
//call start function for exmino
} else {
if (mod_enb->devs->trx_start_func(mod_enb->devs)!=0)
LOG_E(RRH,"Unable to initiate RF device.\n");
else
LOG_I(RRH,"RF device has been initiated.\n");
}
}
}
}
/* create main eNB module thread /* create main eNB module thread
main_rrh_eNB_thread allocates memory main_rrh_eNB_thread allocates memory
...@@ -284,7 +196,7 @@ void *rrh_eNB_thread(void *arg) { ...@@ -284,7 +196,7 @@ void *rrh_eNB_thread(void *arg) {
void *tmp; void *tmp;
unsigned int samples_per_frame=0; unsigned int samples_per_frame=0;
samples_per_frame = dev->eth_dev.openair0_cfg.samples_per_frame; samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
while (rrh_exit==0) { while (rrh_exit==0) {
...@@ -296,42 +208,42 @@ void *rrh_eNB_thread(void *arg) { ...@@ -296,42 +208,42 @@ void *rrh_eNB_thread(void *arg) {
/* allocate memory for TX/RX buffers /* allocate memory for TX/RX buffers
each antenna port has a TX and a RX buffer each antenna port has a TX and a RX buffer
each TX and RX buffer is of (samples_per_frame + HEADER_SIZE) samples (size of samples is 4 bytes) */ each TX and RX buffer is of (samples_per_frame + HEADER_SIZE) samples (size of samples is 4 bytes) */
rx_buffer_eNB = (int32_t**)malloc16(dev->eth_dev.openair0_cfg.rx_num_channels*sizeof(int32_t*)); rx_buffer_eNB = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*));
tx_buffer_eNB = (int32_t**)malloc16(dev->eth_dev.openair0_cfg.tx_num_channels*sizeof(int32_t*)); tx_buffer_eNB = (int32_t**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*));
LOG_D(RRH,"rx_buffer_eNB address =%p tx_buffer_eNB address =%p \n",rx_buffer_eNB,tx_buffer_eNB); LOG_D(RRH,"rx_buffer_eNB address =%p tx_buffer_eNB address =%p \n",rx_buffer_eNB,tx_buffer_eNB);
/* rx_buffer_eNB points to the beginning of data */ /* rx_buffer_eNB points to the beginning of data */
for (i=0; i<dev->eth_dev.openair0_cfg.rx_num_channels; i++) { for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
tmp=(void *)malloc16(sizeof(int32_t)*(samples_per_frame + 32)); tmp=(void *)malloc16(sizeof(int32_t)*(samples_per_frame + 32));
memset(tmp,0,sizeof(int32_t)*(samples_per_frame + 32)); memset(tmp,0,sizeof(int32_t)*(samples_per_frame + 32));
rx_buffer_eNB[i]=( tmp + (32*sizeof(int32_t)) ); rx_buffer_eNB[i]=( tmp + (32*sizeof(int32_t)) );
LOG_D(RRH,"i=%d rx_buffer_eNB[i]=%p tmp= %p\n",i,rx_buffer_eNB[i],tmp); LOG_D(RRH,"i=%d rx_buffer_eNB[i]=%p tmp= %p\n",i,rx_buffer_eNB[i],tmp);
} }
/* tx_buffer_eNB points to the beginning of data */ /* tx_buffer_eNB points to the beginning of data */
for (i=0; i<dev->eth_dev.openair0_cfg.tx_num_channels; i++) { for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
tmp=(void *)malloc16(sizeof(int32_t)*(samples_per_frame + 32)); tmp=(void *)malloc16(sizeof(int32_t)*(samples_per_frame + 32));
memset(tmp,0,sizeof(int32_t)*(samples_per_frame + 32)); memset(tmp,0,sizeof(int32_t)*(samples_per_frame + 32));
tx_buffer_eNB[i]=( tmp + (32*sizeof(int32_t)) ); tx_buffer_eNB[i]=( tmp + (32*sizeof(int32_t)) );
LOG_D(RRH,"i= %d tx_buffer_eNB[i]=%p tmp= %p \n",i,tx_buffer_eNB[i],tmp); LOG_D(RRH,"i= %d tx_buffer_eNB[i]=%p tmp= %p \n",i,tx_buffer_eNB[i],tmp);
} }
/* dummy initialization for TX/RX buffers */ /* dummy initialization for TX/RX buffers */
for (i=0; i<dev->eth_dev.openair0_cfg.rx_num_channels; i++) { for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
for (j=0; j<samples_per_frame; j++) { for (j=0; j<samples_per_frame; j++) {
rx_buffer_eNB[i][j]=32+i; rx_buffer_eNB[i][j]=32+i;
} }
} }
/* dummy initialization for TX/RX buffers */ /* dummy initialization for TX/RX buffers */
for (i=0; i<dev->eth_dev.openair0_cfg.tx_num_channels; i++) { for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
for (j=0; j<samples_per_frame; j++) { for (j=0; j<samples_per_frame; j++) {
tx_buffer_eNB[i][j]=12+i; tx_buffer_eNB[i][j]=12+i;
} }
} }
/* allocate TX/RX buffers pointers used in write/read operations */ /* allocate TX/RX buffers pointers used in write/read operations */
rx_eNB = (void**)malloc16(dev->eth_dev.openair0_cfg.rx_num_channels*sizeof(int32_t*)); rx_eNB = (void**)malloc16(dev->eth_dev.openair0_cfg->rx_num_channels*sizeof(int32_t*));
tx_eNB = (void**)malloc16(dev->eth_dev.openair0_cfg.tx_num_channels*sizeof(int32_t*)); tx_eNB = (void**)malloc16(dev->eth_dev.openair0_cfg->tx_num_channels*sizeof(int32_t*));
/* init mutexes */ /* init mutexes */
for (i=0; i<dev->eth_dev.openair0_cfg.tx_num_channels; i++) { for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) {
pthread_mutex_init(&sync_eNB_mutex[i],NULL); pthread_mutex_init(&sync_eNB_mutex[i],NULL);
pthread_cond_init(&sync_eNB_cond[i],NULL); pthread_cond_init(&sync_eNB_cond[i],NULL);
} }
...@@ -444,10 +356,10 @@ void *rrh_eNB_rx_thread(void *arg) { ...@@ -444,10 +356,10 @@ void *rrh_eNB_rx_thread(void *arg) {
time_req_1us.tv_sec = 0; time_req_1us.tv_sec = 0;
time_req_1us.tv_nsec =1000; //time_req_1us.tv_nsec = (int)rt_period/2;--->granularity issue time_req_1us.tv_nsec =1000; //time_req_1us.tv_nsec = (int)rt_period/2;--->granularity issue
spp_eth = dev->eth_dev.openair0_cfg.samples_per_packet; spp_eth = dev->eth_dev.openair0_cfg->samples_per_packet;
spp_rf = dev->devs->openair0_cfg.samples_per_packet; spp_rf = dev->devs->openair0_cfg->samples_per_packet;
samples_per_frame = dev->eth_dev.openair0_cfg.samples_per_frame; samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
samples_per_subframe = (unsigned int)samples_per_frame/10; samples_per_subframe = (unsigned int)samples_per_frame/10;
loopback = dev->loopback; loopback = dev->loopback;
measurements = dev->measurements; measurements = dev->measurements;
...@@ -520,7 +432,7 @@ void *rrh_eNB_rx_thread(void *arg) { ...@@ -520,7 +432,7 @@ void *rrh_eNB_rx_thread(void *arg) {
} }
} }
for (i=0; i<dev->eth_dev.openair0_cfg.rx_num_channels; i++) { for (i=0; i<dev->eth_dev.openair0_cfg->rx_num_channels; i++) {
rx_eNB[i] = (void*)&rx_buffer_eNB[i][rx_pos]; rx_eNB[i] = (void*)&rx_buffer_eNB[i][rx_pos];
LOG_D(RRH," rx_eNB[i]=%p rx_buffer_eNB[i][rx_pos]=%p ,rx_pos=%d, i=%d ts=%d\n",rx_eNB[i],&rx_buffer_eNB[i][rx_pos],rx_pos,i,timestamp_rx); LOG_D(RRH," rx_eNB[i]=%p rx_buffer_eNB[i][rx_pos]=%p ,rx_pos=%d, i=%d ts=%d\n",rx_eNB[i],&rx_buffer_eNB[i][rx_pos],rx_pos,i,timestamp_rx);
} }
...@@ -532,7 +444,7 @@ void *rrh_eNB_rx_thread(void *arg) { ...@@ -532,7 +444,7 @@ void *rrh_eNB_rx_thread(void *arg) {
&timestamp_rx, &timestamp_rx,
rx_eNB, rx_eNB,
spp_rf, spp_rf,
dev->devs->openair0_cfg.rx_num_channels dev->devs->openair0_cfg->rx_num_channels
)<0) { )<0) {
perror("RRH eNB : USRP read"); perror("RRH eNB : USRP read");
} }
...@@ -545,7 +457,7 @@ void *rrh_eNB_rx_thread(void *arg) { ...@@ -545,7 +457,7 @@ void *rrh_eNB_rx_thread(void *arg) {
timestamp_rx, timestamp_rx,
rx_eNB, rx_eNB,
spp_eth, spp_eth,
dev->eth_dev.openair0_cfg.rx_num_channels, dev->eth_dev.openair0_cfg->rx_num_channels,
0))<0) { 0))<0) {
perror("RRH eNB : ETHERNET write"); perror("RRH eNB : ETHERNET write");
} }
...@@ -667,13 +579,12 @@ void *rrh_eNB_tx_thread(void *arg) { ...@@ -667,13 +579,12 @@ void *rrh_eNB_tx_thread(void *arg) {
time_req_1us.tv_sec = 1; time_req_1us.tv_sec = 1;
time_req_1us.tv_nsec = 0; time_req_1us.tv_nsec = 0;
spp_eth = dev->eth_dev.openair0_cfg.samples_per_packet; spp_eth = dev->eth_dev.openair0_cfg->samples_per_packet;
spp_rf = dev->devs->openair0_cfg.samples_per_packet; spp_rf = dev->devs->openair0_cfg->samples_per_packet;
samples_per_frame = dev->eth_dev.openair0_cfg.samples_per_frame; samples_per_frame = dev->eth_dev.openair0_cfg->samples_per_frame;
samples_per_subframe = (unsigned int)samples_per_frame/10; samples_per_subframe = (unsigned int)samples_per_frame/10;
tx_pos=0; tx_pos=0;
//tx_pos_rf=spp_rf*dev->devs->openair0_cfg.tx_delay;
loopback = dev->loopback; loopback = dev->loopback;
measurements = dev->measurements; measurements = dev->measurements;
...@@ -695,7 +606,7 @@ void *rrh_eNB_tx_thread(void *arg) { ...@@ -695,7 +606,7 @@ void *rrh_eNB_tx_thread(void *arg) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_PCK, pck_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TX_PCK, pck_tx );
if (measurements == 1 ) clock_gettime(CLOCK_MONOTONIC,&time1); if (measurements == 1 ) clock_gettime(CLOCK_MONOTONIC,&time1);
for (i=0; i<dev->eth_dev.openair0_cfg.tx_num_channels; i++) tx_eNB[i] = (void*)&tx_buffer_eNB[i][tx_pos]; //RF!!!!! for (i=0; i<dev->eth_dev.openair0_cfg->tx_num_channels; i++) tx_eNB[i] = (void*)&tx_buffer_eNB[i][tx_pos];
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TXCNT, tx_pos ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TXCNT, tx_pos );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 );
...@@ -705,7 +616,7 @@ void *rrh_eNB_tx_thread(void *arg) { ...@@ -705,7 +616,7 @@ void *rrh_eNB_tx_thread(void *arg) {
&timestamp_tx, &timestamp_tx,
tx_eNB, tx_eNB,
spp_eth, spp_eth,
dev->eth_dev.openair0_cfg.tx_num_channels))<0) { dev->eth_dev.openair0_cfg->tx_num_channels))<0) {
perror("RRH eNB : ETHERNET read"); perror("RRH eNB : ETHERNET read");
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 );
...@@ -718,7 +629,7 @@ void *rrh_eNB_tx_thread(void *arg) { ...@@ -718,7 +629,7 @@ void *rrh_eNB_tx_thread(void *arg) {
timestamp_tx, timestamp_tx,
tx_eNB, tx_eNB,
spp_rf, spp_rf,
dev->devs->openair0_cfg.tx_num_channels, dev->devs->openair0_cfg->tx_num_channels,
1)<0){ 1)<0){
perror("RRH eNB : USRP write"); perror("RRH eNB : USRP write");
} }
...@@ -770,9 +681,9 @@ void *rrh_eNB_tx_thread(void *arg) { ...@@ -770,9 +681,9 @@ void *rrh_eNB_tx_thread(void *arg) {
} }
static void calc_rt_period_ns( openair0_config_t openair0_cfg) { static void calc_rt_period_ns( openair0_config_t *openair0_cfg) {
rt_period= (double)(openair0_cfg.samples_per_packet/(openair0_cfg.samples_per_frame/10.0)*1000000); rt_period= (double)(openair0_cfg->samples_per_packet/(openair0_cfg->samples_per_frame/10.0)*1000000);
AssertFatal(rt_period > 0, "Invalid rt period !%u\n", rt_period); AssertFatal(rt_period > 0, "Invalid rt period !%u\n", rt_period);
LOG_I(RRH,"[eNB] Real time period is set to %u ns\n", rt_period); LOG_I(RRH,"[eNB] Real time period is set to %u ns\n", rt_period);
} }
...@@ -780,57 +691,57 @@ static void calc_rt_period_ns( openair0_config_t openair0_cfg) { ...@@ -780,57 +691,57 @@ static void calc_rt_period_ns( openair0_config_t openair0_cfg) {
static void check_dev_config( rrh_module_t *mod_enb) { static void check_dev_config( rrh_module_t *mod_enb) {
AssertFatal( (mod_enb->devs->openair0_cfg.num_rb_dl==100 || mod_enb->devs->openair0_cfg.num_rb_dl==50 || mod_enb->devs->openair0_cfg.num_rb_dl==25 || mod_enb->devs->openair0_cfg.num_rb_dl==6) , "Invalid number of resource blocks! %d\n", mod_enb->devs->openair0_cfg.num_rb_dl); AssertFatal( (mod_enb->devs->openair0_cfg->num_rb_dl==100 || mod_enb->devs->openair0_cfg->num_rb_dl==50 || mod_enb->devs->openair0_cfg->num_rb_dl==25 || mod_enb->devs->openair0_cfg->num_rb_dl==6) , "Invalid number of resource blocks! %d\n", mod_enb->devs->openair0_cfg->num_rb_dl);
AssertFatal( mod_enb->devs->openair0_cfg.samples_per_frame > 0 , "Invalid number of samples per frame! %d\n",mod_enb->devs->openair0_cfg.samples_per_frame); AssertFatal( mod_enb->devs->openair0_cfg->samples_per_frame > 0 , "Invalid number of samples per frame! %d\n",mod_enb->devs->openair0_cfg->samples_per_frame);
AssertFatal( mod_enb->devs->openair0_cfg.sample_rate > 0.0, "Invalid sample rate! %f\n", mod_enb->devs->openair0_cfg.sample_rate); AssertFatal( mod_enb->devs->openair0_cfg->sample_rate > 0.0, "Invalid sample rate! %f\n", mod_enb->devs->openair0_cfg->sample_rate);
AssertFatal( mod_enb->devs->openair0_cfg.samples_per_packet > 0 , "Invalid number of samples per packet! %d\n",mod_enb->devs->openair0_cfg.samples_per_packet); AssertFatal( mod_enb->devs->openair0_cfg->samples_per_packet > 0 , "Invalid number of samples per packet! %d\n",mod_enb->devs->openair0_cfg->samples_per_packet);
AssertFatal( mod_enb->devs->openair0_cfg.rx_num_channels > 0 , "Invalid number of RX antennas! %d\n", mod_enb->devs->openair0_cfg.rx_num_channels); AssertFatal( mod_enb->devs->openair0_cfg->rx_num_channels > 0 , "Invalid number of RX antennas! %d\n", mod_enb->devs->openair0_cfg->rx_num_channels);
AssertFatal( mod_enb->devs->openair0_cfg.tx_num_channels > 0 , "Invalid number of TX antennas! %d\n", mod_enb->devs->openair0_cfg.tx_num_channels); AssertFatal( mod_enb->devs->openair0_cfg->tx_num_channels > 0 , "Invalid number of TX antennas! %d\n", mod_enb->devs->openair0_cfg->tx_num_channels);
AssertFatal( mod_enb->devs->openair0_cfg.rx_freq[0] > 0.0 ,"Invalid RX frequency! %f\n", mod_enb->devs->openair0_cfg.rx_freq[0]); AssertFatal( mod_enb->devs->openair0_cfg->rx_freq[0] > 0.0 ,"Invalid RX frequency! %f\n", mod_enb->devs->openair0_cfg->rx_freq[0]);
AssertFatal( mod_enb->devs->openair0_cfg.tx_freq[0] > 0.0 ,"Invalid TX frequency! %f\n", mod_enb->devs->openair0_cfg.tx_freq[0]); AssertFatal( mod_enb->devs->openair0_cfg->tx_freq[0] > 0.0 ,"Invalid TX frequency! %f\n", mod_enb->devs->openair0_cfg->tx_freq[0]);
AssertFatal( mod_enb->devs->openair0_cfg.rx_gain[0] > 0.0 ,"Invalid RX gain! %f\n", mod_enb->devs->openair0_cfg.rx_gain[0]); AssertFatal( mod_enb->devs->openair0_cfg->rx_gain[0] > 0.0 ,"Invalid RX gain! %f\n", mod_enb->devs->openair0_cfg->rx_gain[0]);
AssertFatal( mod_enb->devs->openair0_cfg.tx_gain[0] > 0.0 ,"Invalid TX gain! %f\n", mod_enb->devs->openair0_cfg.tx_gain[0]); AssertFatal( mod_enb->devs->openair0_cfg->tx_gain[0] > 0.0 ,"Invalid TX gain! %f\n", mod_enb->devs->openair0_cfg->tx_gain[0]);
AssertFatal( mod_enb->devs->openair0_cfg.rx_bw > 0.0 ,"Invalid RX bw! %f\n", mod_enb->devs->openair0_cfg.rx_bw); AssertFatal( mod_enb->devs->openair0_cfg->rx_bw > 0.0 ,"Invalid RX bw! %f\n", mod_enb->devs->openair0_cfg->rx_bw);
AssertFatal( mod_enb->devs->openair0_cfg.tx_bw > 0.0 ,"Invalid RX bw! %f\n", mod_enb->devs->openair0_cfg.tx_bw); AssertFatal( mod_enb->devs->openair0_cfg->tx_bw > 0.0 ,"Invalid RX bw! %f\n", mod_enb->devs->openair0_cfg->tx_bw);
AssertFatal( mod_enb->devs->openair0_cfg.autocal[0] > 0 , "Invalid auto calibration choice! %d\n", mod_enb->devs->openair0_cfg.autocal[0]); AssertFatal( mod_enb->devs->openair0_cfg->autocal[0] > 0 , "Invalid auto calibration choice! %d\n", mod_enb->devs->openair0_cfg->autocal[0]);
printf("\n---------------------RF device configuration parameters---------------------\n"); printf("\n---------------------RF device configuration parameters---------------------\n");
printf("\tMod_id=%d\n \tlog level=%d\n \tDL_RB=%d\n \tsamples_per_frame=%d\n \tsample_rate=%f\n \tsamples_per_packet=%d\n \ttx_delay=%d\n \ttx_forward_nsamps=%d\n \trx_num_channels=%d\n \ttx_num_channels=%d\n \trx_freq_0=%f\n \ttx_freq_0=%f\n \trx_freq_1=%f\n \ttx_freq_1=%f\n \trx_freq_2=%f\n \ttx_freq_2=%f\n \trx_freq_3=%f\n \ttx_freq_3=%f\n \trxg_mode=%d\n \trx_gain_0=%f\n \ttx_gain_0=%f\n \trx_gain_1=%f\n \ttx_gain_1=%f\n \trx_gain_2=%f\n \ttx_gain_2=%f\n \trx_gain_3=%f\n \ttx_gain_3=%f\n \trx_gain_offset_2=%f\n \ttx_gain_offset_3=%f\n \trx_bw=%f\n \ttx_bw=%f\n \tautocal=%d\n", printf("\tMod_id=%d\n \tlog level=%d\n \tDL_RB=%d\n \tsamples_per_frame=%d\n \tsample_rate=%f\n \tsamples_per_packet=%d\n \ttx_scheduling_advance=%d\n \ttx_sample_advance=%d\n \trx_num_channels=%d\n \ttx_num_channels=%d\n \trx_freq_0=%f\n \ttx_freq_0=%f\n \trx_freq_1=%f\n \ttx_freq_1=%f\n \trx_freq_2=%f\n \ttx_freq_2=%f\n \trx_freq_3=%f\n \ttx_freq_3=%f\n \trxg_mode=%d\n \trx_gain_0=%f\n \ttx_gain_0=%f\n \trx_gain_1=%f\n \ttx_gain_1=%f\n \trx_gain_2=%f\n \ttx_gain_2=%f\n \trx_gain_3=%f\n \ttx_gain_3=%f\n \trx_gain_offset_2=%f\n \ttx_gain_offset_3=%f\n \trx_bw=%f\n \ttx_bw=%f\n \tautocal=%d\n",
mod_enb->devs->openair0_cfg.Mod_id, mod_enb->devs->openair0_cfg->Mod_id,
mod_enb->devs->openair0_cfg.log_level, mod_enb->devs->openair0_cfg->log_level,
mod_enb->devs->openair0_cfg.num_rb_dl, mod_enb->devs->openair0_cfg->num_rb_dl,
mod_enb->devs->openair0_cfg.samples_per_frame, mod_enb->devs->openair0_cfg->samples_per_frame,
mod_enb->devs->openair0_cfg.sample_rate, mod_enb->devs->openair0_cfg->sample_rate,
mod_enb->devs->openair0_cfg.samples_per_packet, mod_enb->devs->openair0_cfg->samples_per_packet,
mod_enb->devs->openair0_cfg.tx_delay, mod_enb->devs->openair0_cfg->tx_scheduling_advance,
mod_enb->devs->openair0_cfg.tx_forward_nsamps, mod_enb->devs->openair0_cfg->tx_sample_advance,
mod_enb->devs->openair0_cfg.rx_num_channels, mod_enb->devs->openair0_cfg->rx_num_channels,
mod_enb->devs->openair0_cfg.tx_num_channels, mod_enb->devs->openair0_cfg->tx_num_channels,
mod_enb->devs->openair0_cfg.rx_freq[0], mod_enb->devs->openair0_cfg->rx_freq[0],
mod_enb->devs->openair0_cfg.tx_freq[0], mod_enb->devs->openair0_cfg->tx_freq[0],
mod_enb->devs->openair0_cfg.rx_freq[1], mod_enb->devs->openair0_cfg->rx_freq[1],
mod_enb->devs->openair0_cfg.tx_freq[1], mod_enb->devs->openair0_cfg->tx_freq[1],
mod_enb->devs->openair0_cfg.rx_freq[2], mod_enb->devs->openair0_cfg->rx_freq[2],
mod_enb->devs->openair0_cfg.tx_freq[2], mod_enb->devs->openair0_cfg->tx_freq[2],
mod_enb->devs->openair0_cfg.rx_freq[3], mod_enb->devs->openair0_cfg->rx_freq[3],
mod_enb->devs->openair0_cfg.tx_freq[3], mod_enb->devs->openair0_cfg->tx_freq[3],
mod_enb->devs->openair0_cfg.rxg_mode[0], mod_enb->devs->openair0_cfg->rxg_mode[0],
mod_enb->devs->openair0_cfg.rx_gain[0], mod_enb->devs->openair0_cfg->tx_gain[0],
mod_enb->devs->openair0_cfg.tx_gain[0], mod_enb->devs->openair0_cfg->tx_gain[0],
mod_enb->devs->openair0_cfg.rx_gain[1], mod_enb->devs->openair0_cfg->rx_gain[1],
mod_enb->devs->openair0_cfg.tx_gain[1], mod_enb->devs->openair0_cfg->tx_gain[1],
mod_enb->devs->openair0_cfg.rx_gain[2], mod_enb->devs->openair0_cfg->rx_gain[2],
mod_enb->devs->openair0_cfg.tx_gain[2], mod_enb->devs->openair0_cfg->tx_gain[2],
mod_enb->devs->openair0_cfg.rx_gain[3], mod_enb->devs->openair0_cfg->rx_gain[3],
mod_enb->devs->openair0_cfg.tx_gain[3], mod_enb->devs->openair0_cfg->tx_gain[3],
//mod_enb->devs->openair0_cfg.rx_gain_offset[0], //mod_enb->devs->openair0_cfg->rx_gain_offset[0],
//mod_enb->devs->openair0_cfg.rx_gain_offset[1], //mod_enb->devs->openair0_cfg->rx_gain_offset[1],
mod_enb->devs->openair0_cfg.rx_gain_offset[2], mod_enb->devs->openair0_cfg->rx_gain_offset[2],
mod_enb->devs->openair0_cfg.rx_gain_offset[3], mod_enb->devs->openair0_cfg->rx_gain_offset[3],
mod_enb->devs->openair0_cfg.rx_bw, mod_enb->devs->openair0_cfg->rx_bw,
mod_enb->devs->openair0_cfg.tx_bw, mod_enb->devs->openair0_cfg->tx_bw,
mod_enb->devs->openair0_cfg.autocal[0] mod_enb->devs->openair0_cfg->autocal[0]
); );
printf("----------------------------------------------------------------------------\n"); printf("----------------------------------------------------------------------------\n");
......
...@@ -194,7 +194,10 @@ static rrh_module_t new_module (unsigned int id) { ...@@ -194,7 +194,10 @@ static rrh_module_t new_module (unsigned int id) {
rrh_mod.eth_dev.type=NONE_DEV; rrh_mod.eth_dev.type=NONE_DEV;
rrh_mod.eth_dev.transp_type=NONE_TP; rrh_mod.eth_dev.transp_type=NONE_TP;
/* ethernet device is functioning within RRH */ /* ethernet device is functioning within RRH */
rrh_mod.eth_dev.host_type=RRH_HOST; rrh_mod.eth_dev.host_type=RRH_HOST;
/* */
rrh_mod.eth_dev.openair0_cfg = (openair0_config_t*)malloc(sizeof(openair0_config_t));
memset(rrh_mod.eth_dev.openair0_cfg,0,sizeof(openair0_config_t));
/* get IP and MAC address */ /* get IP and MAC address */
get_address(if_name,eth_mode); get_address(if_name,eth_mode);
...@@ -219,12 +222,12 @@ static rrh_module_t new_module (unsigned int id) { ...@@ -219,12 +222,12 @@ static rrh_module_t new_module (unsigned int id) {
/* allocate space and specify associated RF device */ /* allocate space and specify associated RF device */
openair0_device *oai_dv = (openair0_device *)malloc(sizeof(openair0_device)); openair0_device *oai_dv = (openair0_device *)malloc(sizeof(openair0_device));
memset(oai_dv,0,sizeof(openair0_device)); memset(oai_dv,0,sizeof(openair0_device));
rrh_mod.devs=oai_dv; rrh_mod.devs=oai_dv;
rrh_mod.devs->type=NONE_DEV; rrh_mod.devs->type=NONE_DEV;
rrh_mod.devs->transp_type=NONE_TP; rrh_mod.devs->transp_type=NONE_TP;
rrh_mod.devs->host_type=RRH_HOST; rrh_mod.devs->host_type=RRH_HOST;
return rrh_mod; return rrh_mod;
} }
......
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