Fix #582, USER_MODE flag removed

This commit is contained in:
bruno mongazon
2018-01-11 16:50:50 +01:00
parent a2d16b34dd
commit afcc9aabd8
125 changed files with 69 additions and 1074 deletions
@@ -38,10 +38,8 @@
#include "UTIL/OCG/OCG_extern.h"
#include "UTIL/LOG/log.h"
#ifdef USER_MODE
# include "multicast_link.h"
# include "pgm_link.h"
#endif
#include "multicast_link.h"
#include "pgm_link.h"
char rx_bufferP[BYPASS_RX_BUFFER_SIZE];
unsigned int num_bytesP = 0;
@@ -90,10 +88,8 @@ void init_bypass (void)
void bypass_init (tx_handler_t tx_handlerP, rx_handler_t rx_handlerP)
{
/***************************************************************************/
#if defined(USER_MODE)
multicast_link_start (bypass_rx_handler, oai_emulation.info.multicast_group,
oai_emulation.info.multicast_ifname);
#endif //USER_MODE
tx_handler = tx_handlerP;
rx_handler = rx_handlerP;
Master_list_rx=0;
@@ -448,35 +444,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
return bytes_read;
}
/******************************************************************************************************/
#ifndef USER_MODE
int bypass_rx_handler(unsigned int fifo, int rw)
{
/******************************************************************************************************/
int bytes_read;
int bytes_processed=0;
int header_bytes; //, elapsed_time;
//printk("[BYPASS] BYPASS_RX_HANDLER IN...\n");
header_bytes= rtf_get(fifo_bypass_phy_user2kern, rx_bufferP,
sizeof(bypass_proto2multicast_header_t) );
if (header_bytes> 0) {
bytes_read = rtf_get(fifo_bypass_phy_user2kern, &rx_bufferP[header_bytes],
((bypass_proto2multicast_header_t *) (&rx_bufferP[0]))->size);
// printk("BYTES_READ=%d\n",bytes_read);
if (bytes_read > 0) {
num_bytesP=header_bytes+bytes_read;
emul_low_mutex_var=0;
//printk("BYPASS_PHY SIGNAL MAC_LOW...\n");
pthread_cond_signal(&emul_low_cond);
}
}
// }
return 0;
}
#else //USER_MODE
/******************************************************************************************************/
void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer)
{
@@ -503,7 +470,6 @@ void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer)
#endif
}
}
#endif //USER_MODE
/******************************************************************************************************/
void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
@@ -511,50 +477,12 @@ void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
{
/******************************************************************************************************/
if (Master_list_rx != oai_emulation.info.master_list) {
#ifndef USER_MODE
rtf_put(fifo_mac_bypass, &tt, 1);
/* the Rx window is still opened (Re)signal bypass_phy (emulate MAC signal) */
#endif
bypass_rx_data(frame, last_slot, next_slot, is_master);
} else {
Master_list_rx = 0;
}
}
#ifndef USER_MODE
/***************************************************************************/
int multicast_link_write_sock (int groupP, char *dataP, unsigned int sizeP)
{
/***************************************************************************/
int tx_bytes=0;
pthread_mutex_lock(&Tx_mutex);
while(!Tx_mutex_var) {
pthread_cond_wait(&Tx_cond,&Tx_mutex);
}
Tx_mutex_var=0;
N_P=(int)((sizeP-sizeof (bypass_proto2multicast_header_t))/1000)+2;
tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes],
sizeof (bypass_proto2multicast_header_t));
while(tx_bytes<sizeP) {
if(sizeP-tx_bytes<=1000) {
tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes],
sizeP-tx_bytes);
} else {
tx_bytes += rtf_put (fifo_bypass_phy_kern2user, &dataP[tx_bytes],1000);
}
}
//RG_tx_mutex_var=0;
pthread_mutex_unlock(&Tx_mutex);
return tx_bytes;
}
#endif
#if defined(ENABLE_PGM_TRANSPORT)
void bypass_tx_nack(unsigned int frame, unsigned int next_slot)
{
@@ -715,19 +643,3 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
messg->master_id, messg->seq_num);
}
#ifndef USER_MODE
/*********************************************************************************************************************/
int bypass_tx_handler(unsigned int fifo, int rw)
{
/***************************************************************************/
if(++N_R==N_P) {
rtf_reset(fifo_bypass_phy_kern2user);
Tx_mutex_var=1;
N_R=0;
pthread_cond_signal(&Tx_cond);
}
}
#endif
@@ -31,11 +31,7 @@
#ifndef __BYPASS_SESSION_LAYER_EXTERN_H__
# define __BYPASS_SESSION_LAYER_EXTERN_H__
#ifndef USER_MODE
#include <rtai_posix.h>
#else
#include <pthread.h>
#endif //RTAI_ENABLED
extern unsigned char Emulation_status;
extern unsigned char emu_tx_status;
@@ -54,9 +54,7 @@
#include "socket.h"
#include "multicast_link.h"
#ifdef USER_MODE
# include "UTIL/LOG/log.h"
#endif //USER_MODE
#include "UTIL/LOG/log.h"
extern unsigned short Master_id;
@@ -39,14 +39,6 @@ int bypass_rx_data(unsigned int frame, unsigned int last_slot,
unsigned int next_slot, uint8_t is_master);
void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
unsigned int next_slot, uint8_t is_master);
#ifndef USER_MODE
int multicast_link_write_sock (int groupP, char *dataP, unsigned int sizeP);
int bypass_tx_handler(unsigned int fifo, int rw);
int bypass_rx_handler(unsigned int fifo, int rw);
#else
void bypass_rx_handler(unsigned int Num_bytes,char *Rx_buffer);
#endif
void bypass_tx_data (emu_transport_info_t Type, unsigned int frame, unsigned int next_slot);
void emulation_tx_rx(void);
@@ -41,9 +41,7 @@
//#include "openair_defs.h"
#include "socket.h"
#ifdef USER_MODE
#define msg printf
#endif
//------------------------------------------------------------------------------
void
socket_setnonblocking (int sockP)
-4
View File
@@ -28,11 +28,7 @@
* \email: navid.nikaein@eurecom.fr
*/
#ifndef USER_MODE
#include <rtai_posix.h>
#else
#include <pthread.h>
#endif
#include "defs.h"
#ifndef __BYPASS_SESSION_LAYER_VARS_H__
+1 -1
View File
@@ -6,7 +6,7 @@ OPENAIR1_TOP = $(OPENAIR1_DIR)
OPENAIR2_TOP = $(OPENAIR2_DIR)
OPENAIR3 = $(OPENAIR3_DIR)
CFLAGS += -DMAX_NUM_CCs=1 -Wall -DPHYSIM -DNODE_RG -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO -DLOG_NO_THREAD # -Wno-packed-bitfield-compat
CFLAGS += -DMAX_NUM_CCs=1 -Wall -DPHYSIM -DNODE_RG -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO -DLOG_NO_THREAD # -Wno-packed-bitfield-compat
# enable C99 mode
CFLAGS += -std=gnu99
+1 -1
View File
@@ -1,6 +1,6 @@
include $(OPENAIR_DIR)/common/utils/Makefile.inc
OBJS = rf.o ../../PHY/TOOLS/file_output.o ../TOOLS/rangen_double.o
CFLAGS += -DRF_MAIN -DUSER_MODE -DDEBUG_PHY
CFLAGS += -DRF_MAIN -DDEBUG_PHY
all: $(OBJS)
gcc -o rf $(OBJS) -lm
@@ -19,12 +19,10 @@
* contact@openairinterface.org
*/
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#endif
#include "defs.h"
-21
View File
@@ -19,13 +19,8 @@
* contact@openairinterface.org
*/
#ifdef USER_MODE
#include <time.h>
#include <stdlib.h>
#else
#include <asm/io.h>
#include <asm/rtai.h>
#endif
#ifdef RTAI_ENABLED
#include <rtai.h>
#include <rtai_sched.h>
@@ -55,21 +50,14 @@ unsigned int taus(void)
void set_taus_seed(unsigned int seed_init)
{
#ifdef USER_MODE
struct drand48_data buffer;
unsigned long result = 0;
#endif
if (seed_init == 0) {
s0 = (unsigned int)time(NULL);
s1 = (unsigned int)time(NULL);
s2 = (unsigned int)time(NULL);
} else {
#ifndef USER_MODE
s0 = (unsigned int)0x1e23d852;
s1 = (unsigned int)0x81f38a1c;
s2 = (unsigned int)0xfe1a133e;
#else
/* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
srand48_r((long int)seed_init, &buffer);
mrand48_r(&buffer, (long int *)&result);
@@ -78,7 +66,6 @@ void set_taus_seed(unsigned int seed_init)
s1 = result;
mrand48_r(&buffer, (long int *)&result);
s2 = result;
#endif
}
}
#endif
@@ -87,10 +74,8 @@ void set_taus_seed(unsigned int seed_init)
void set_taus_seed(unsigned int seed_init)
{
#ifdef USER_MODE
struct drand48_data buffer;
unsigned long result = 0;
#endif
s0 = (unsigned int)0x1e23d852;
s1 = (unsigned int)0x81f38a1c;
s2 = (unsigned int)0xfe1a133e;
@@ -102,11 +87,6 @@ void set_taus_seed(unsigned int seed_init)
s1 = (unsigned int)time(NULL);
s2 = (unsigned int)time(NULL);
} else {
#ifndef USER_MODE
s0 = (unsigned int)0x1e23d852;
s1 = (unsigned int)0x81f38a1c;
s2 = (unsigned int)0xfe1a133e;
#else
// Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
srand48_r((long int)seed_init, &buffer);
mrand48_r(&buffer, (long int *)&result);
@@ -115,7 +95,6 @@ void set_taus_seed(unsigned int seed_init)
s1 = result;
mrand48_r(&buffer, (long int *)&result);
s2 = result;
#endif
}
}
#endif