Commit afcc9aab authored by Mongazon's avatar Mongazon
Browse files

Fix #582, USER_MODE flag removed

parent a2d16b34
......@@ -22,11 +22,7 @@
#ifndef __openair_TYPES_H__
#define __openair_TYPES_H__
#ifdef USER_MODE
#include <stdint.h>
#else
#include <linux/types.h>
#endif
#endif /*__openair_TYPES_H__ */
......@@ -24,40 +24,6 @@
#ifndef __SCHED_EXTERN_H__
#define __SCHED_EXTERN_H__
#ifndef USER_MODE
#define __NO_VERSION__
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/types.h>
#include <asm/io.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include <asm/segment.h>
#include <asm/page.h>
#ifdef RTAI_ENABLED
#include <rtai.h>
//#include <rtai_posix.h>
#include <rtai_fifos.h>
#include <rtai_sched.h>
#include <rtai_sem.h>
//#include "rt_compat.h"
#else
#include <unistd.h>
#endif
#endif /* USER_MODE */
#include "defs.h"
//#include "dlc_engine.h"
......
......@@ -68,6 +68,8 @@ fifo_dump_emos_UE emos_dump_UE;
#include "T.h"
#include "PHY/TOOLS/defs.h"
#define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs)
#define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs)
......
......@@ -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)
......
......@@ -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__
......
......@@ -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
......
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"
......
......@@ -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
......
......@@ -22,12 +22,6 @@
#ifndef __openair_DEFS_H__
#define __openair_DEFS_H__
#ifndef USER_MODE
#include <linux/kernel.h>
#endif //USER_MODE
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
#if !defined (msg)
......@@ -49,44 +43,7 @@
#define PAGE_MASK 0xfffff000
#define virt_to_phys(x) (x)
#else // USER_MODE
#include <rtai.h>
#define msg rt_printk
#ifdef BIGPHYSAREA
#define bigmalloc(x) (bigphys_malloc(x))
#define bigmalloc16(x) (bigphys_malloc(x))
#define malloc16(x) (bigphys_malloc(x))
#define free16(y,x)
#define bigfree(y,x)
#else // BIGPHYSAREA
#define bigmalloc(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0))
#define bigmalloc16(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0))
#define bigfree(y,x) (dma_free_coherent(pdev[0],(x),(void *)(y),dummy_dma_ptr))
#define malloc16(x) (kmalloc(x,GFP_KERNEL))
#define free16(y,x) (kfree(y))
#endif // BIGPHYSAREA
#ifdef CBMIMO1
#define openair_get_mbox() (*(unsigned int *)mbox)
#else //CBMIMO1
#define openair_get_mbox() (*(unsigned int *)PHY_vars->mbox>>1)
#endif //CBMIMO1
#endif // USERMODE
// #define bzero(s,n) (memset((s),0,(n)))
#define cmax(a,b) ((a>b) ? (a) : (b))
#define cmin(a,b) ((a<b) ? (a) : (b))
#endif // /*__openair_DEFS_H__ */
......@@ -22,18 +22,4 @@
#ifndef __openair_TYPES_H__
#define __openair_TYPES_H__
//#ifdef USER_MODE
//#include <stdint.h>
//typedef int8_t s8; /* 8 bit signed integer */
//typedef int16_t s16; /* 16 bit signed integer */
//typedef int32_t s32; /* 32 bit signed integer */
//typedef int64_t s64; /* 64 bit signed integer */
//typedef uint8_t u8; /* 8 bit unsigned integer */
//typedef uint16_t u16; /* 16 bit unsigned integer */
//typedef uint32_t u32; /* 32 bit unsigned integer */
//typedef uint64_t u64; /* 64 bit unsigned integer */
//#else
//#include <linux/types.h>
//#endif
#endif /*__openair_TYPES_H__ */
......@@ -43,7 +43,6 @@
#define NL_MAX_PAYLOAD 9000 /* this should cover the max mtu size*/
#endif
#ifdef USER_MODE
#ifdef LARGE_SCALE
# define NB_MODULES_MAX 128
# define NB_NODE_MAX 128
......@@ -51,11 +50,6 @@
# define NB_MODULES_MAX 32
# define NB_NODE_MAX 32
#endif
#else
# define NB_MODULES_MAX 1
# define NB_NODE_MAX 1
#endif //PHY_EMUL
#ifdef JUMBO_FRAME
# define MAX_IP_PACKET_SIZE 10000 // 9000
......@@ -132,9 +126,7 @@
#define UNUSED_PARAM_MBMS_SESSION_ID 0
#define UNUSED_PARAM_MBMS_SERVICE_ID 0
#ifdef USER_MODE
#define printk printf
#endif
#define UNUSED_VARIABLE(vARIABLE) (void)(vARIABLE)
......
......@@ -30,9 +30,7 @@
#ifndef __PLATFORM_TYPES_H__
# define __PLATFORM_TYPES_H__
#ifdef USER_MODE
#include <stdint.h>
#endif
#if defined(ENABLE_ITTI)
#include "itti_types.h"
......
......@@ -21,44 +21,12 @@
#ifndef _RTOS_HEADER_H_
# define _RTOS_HEADER_H_
# if defined(RTAI) && !defined(USER_MODE)
// CONVERSION BETWEEN POSIX PTHREAD AND RTAI FUNCTIONS
/*
# define pthread_mutex_init pthread_mutex_init_rt
# define pthread_mutexattr_init pthread_mutexattr_init_rt
# define pthread_mutex_lock pthread_mutex_lock_rt
# define pthread_mutex_unlock pthread_mutex_unlock_rt
# define pthread_mutex_destroy pthread_mutex_destroy_rt
# define pthread_cond_init pthread_cond_init_rt
# define pthread_cond_wait pthread_cond_wait_rt
# define pthread_cond_signal pthread_cond_signal_rt
# define pthread_cond_destroy pthread_cond_destroy_rt
# define pthread_attr_init pthread_attr_init_rt
# define pthread_attr_setschedparam pthread_attr_setschedparam_rt
# define pthread_create pthread_create_rt
# define pthread_cancel pthread_cancel_rt
# define pthread_delete_np pthread_cancel_rt
# define pthread_attr_setstacksize pthread_attr_setstacksize_rt
# define pthread_self rt_whoami
*/
# include <asm/rtai.h>
# include <rtai.h>
# include <rtai_posix.h>
# include <rtai_fifos.h>
# include <rtai_sched.h>
# ifdef CONFIG_PROC_FS
# include <rtai_proc_fs.h>
# endif
# else
# ifdef USER_MODE
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <math.h>
# include <pthread.h>
# include <assert.h>
# define rtf_get read
# define rtf_put write
# endif
# endif
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <math.h>
# include <pthread.h>
# include <assert.h>
# define rtf_get read
# define rtf_put write
#endif
......@@ -39,15 +39,9 @@
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
//#include "COMMON/openair_defs.h"
#include "PHY/defs.h"
#include "PHY/LTE_TRANSPORT/defs.h"
......@@ -109,9 +103,7 @@
//#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high
#endif
#ifdef USER_MODE
#define printk printf
#endif //USER_MODE
/*!\brief Maximum number of logical channl group IDs */
#define MAX_NUM_LCGID 4
......
......@@ -32,10 +32,6 @@
#ifndef __MAC_EXTERN_H__
#define __MAC_EXTERN_H__
#ifdef USER_MODE
//#include "stdio.h"
#endif //USER_MODE
#include "PHY/defs.h"
#include "defs.h"
......
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