Commit 6b662a3e authored by laurent's avatar laurent

compiles

parent 24e01ea2
...@@ -2094,6 +2094,8 @@ target_link_libraries (lte-softmodem ...@@ -2094,6 +2094,8 @@ target_link_libraries (lte-softmodem
add_executable(ocp-softmodem add_executable(ocp-softmodem
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_DIR}/executables/main-ocp.c ${OPENAIR_DIR}/executables/main-ocp.c
${OPENAIR_DIR}/executables/dl_fs6.c
${OPENAIR_DIR}/executables/transport_split.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c ${OPENAIR_TARGETS}/RT/USER/lte-softmodem-common.c
${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c
......
#include <split_headers.h> #include <stdint.h>
#include <nfapi/oai_integration/vendor_ext.h>
#include <openair1/PHY/INIT/lte_init.c>
#include <executables/split_headers.h>
#define FS6_BUF_SIZE 100*1000
static int sockFS6;
#if 0
void pdsch_procedures(PHY_VARS_eNB *eNB, void pdsch_procedures(PHY_VARS_eNB *eNB,
L1_rxtx_proc_t *proc, L1_rxtx_proc_t *proc,
...@@ -61,14 +67,15 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, ...@@ -61,14 +67,15 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
dlsch_harq->round++; dlsch_harq->round++;
} }
phy_procedures_eNB_TX_fs6() { phy_procedures_eNB_TX_fs6(int sockFS6, uint64_t TS) {
receiveSubFrame(); uint8_t bufferZone[FS6_BUF_SIZE];
receiveSubFrame(sockFS6, TS, bufferZone, sizeof(bufferZone) );
// We got // We got
// subframe number // subframe number
// //
for (aa = 0; aa < fp->nb_antenna_ports_eNB; aa++) { for (int aa = 0; aa < fp->nb_antenna_ports_eNB; aa++) {
memset (&eNB->common_vars.txdataF[aa][subframe * fp->ofdm_symbol_size * fp->symbols_per_tti], memset (&eNB->common_vars.txdataF[aa][subframe * fp->ofdm_symbol_size * fp->symbols_per_tti],
0, 0,
fp->ofdm_symbol_size * (fp->symbols_per_tti) * sizeof (int32_t)); fp->ofdm_symbol_size * (fp->symbols_per_tti) * sizeof (int32_t));
...@@ -178,17 +185,141 @@ phy_procedures_eNB_TX_fs6() { ...@@ -178,17 +185,141 @@ phy_procedures_eNB_TX_fs6() {
proc, proc,
AMP); AMP);
} }
#endif
void prach_eNB_extract(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
}
void prach_eNB_process(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe) {
}
void phy_procedures_eNB_uespec_RX_extract(PHY_VARS_eNB *phy_vars_eNB,L1_rxtx_proc_t *proc) {
}
void phy_procedures_eNB_uespec_RX_process(PHY_VARS_eNB *phy_vars_eNB,L1_rxtx_proc_t *proc) {
}
void phy_procedures_eNB_TX_fs6() {
}
void DL_du_fs6(RU_t *ru, int frame, int subframe, uint64_t TS) {
RU_proc_t *ru_proc=&ru->proc;
for (int i=0; i<ru->num_eNB; i++) {
uint8_t bufferZone[FS6_BUF_SIZE];
receiveSubFrame(sockFS6, TS, bufferZone, sizeof(bufferZone) );
}
DL_thread_fs6() {
receiveSubFrame();
phy_procedures_eNB_TX_fs6(); phy_procedures_eNB_TX_fs6();
ru->feptx_prec(ru); /* Fixme: datamodel issue: a ru is supposed to be connected to several eNB
ru->feptx_ofdm(ru); L1_rxtx_proc_t * L1_proc = &proc->L1_proc;
ru->fh_south_out(ru); ru_proc->timestamp_tx = L1_proc->timestamp_tx;
ru_proc->subframe_tx = L1_proc->subframe_tx;
ru_proc->frame_tx = L1_proc->frame_tx;
*/
feptx_prec(ru);
feptx_ofdm(ru);
tx_rf(ru);
} }
void UL_du_fs6(RU_t *ru, int frame, int subframe) {
RU_proc_t *ru_proc=&ru->proc;
int tmpf=frame, tmpsf=subframe;
rx_rf(ru,&tmpf,&tmpsf);
AssertFatal(tmpf==frame && tmpsf==subframe, "lost synchronization\n");
ru_proc->frame_tx = (ru_proc->frame_tx+ru_proc->frame_offset)&1023;
// Fixme: datamodel issue
PHY_VARS_eNB *eNB = RC.eNB[0][0];
L1_proc_t *proc = &eNB->proc;
L1_rxtx_proc_t *L1_proc = &proc->L1_proc;
LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
proc->frame_rx = frame;
proc->subframe_rx = subframe;
if (NFAPI_MODE==NFAPI_MODE_PNF) {
// I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
//add_subframe(&frame, &subframe, 4);
//oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
}
uint8_t bufferZone[FS6_BUF_SIZE];
prach_eNB_extract(eNB,NULL,proc->frame_rx,proc->subframe_rx);
if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
phy_procedures_eNB_uespec_RX_extract(eNB, &proc->L1_proc);
}
DL_thread_frequency() { for (int i=0; i<ru->num_eNB; i++) {
frequency_t header; sendSubFrame(sockFS6,bufferZone, sizeof(bufferZone) );
full_read(&header, }
\ No newline at end of file }
void DL_cu_fs6(RU_t *ru,int frame, int subframe) {
// Fixme: datamodel issue
PHY_VARS_eNB *eNB = RC.eNB[0][0];
L1_proc_t *proc = &eNB->proc;
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.frame = proc->frame_rx;
eNB->UL_INFO.subframe = proc->subframe_rx;
eNB->UL_INFO.module_id = eNB->Mod_id;
eNB->UL_INFO.CC_id = eNB->CC_id;
eNB->if_inst->UL_indication(&eNB->UL_INFO);
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
uint8_t bufferZone[FS6_BUF_SIZE];
phy_procedures_eNB_TX(eNB, &proc->L1_proc, 1);
sendSubFrame(sockFS6, bufferZone, sizeof(bufferZone) );
}
void UL_cu_fs6(RU_t *ru,int frame, int subframe, uint64_t TS) {
uint8_t bufferZone[FS6_BUF_SIZE];
receiveSubFrame(sockFS6, TS, bufferZone, sizeof(bufferZone) );
// Fixme: datamodel issue
PHY_VARS_eNB *eNB = RC.eNB[0][0];
L1_proc_t *proc = &eNB->proc;
prach_eNB_process(eNB,NULL,proc->frame_rx,proc->subframe_rx);
release_UE_in_freeList(eNB->Mod_id);
if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
phy_procedures_eNB_uespec_RX_process(eNB, &proc->L1_proc);
}
}
void *cu_fs6(void *arg) {
RU_t *ru = (RU_t *)arg;
RU_proc_t *proc = &ru->proc;
int64_t AbsoluteSubframe=-1;
init_frame_parms(&ru->frame_parms,1);
wait_sync("ru_thread");
while(1) {
AbsoluteSubframe++;
int subframe=AbsoluteSubframe%10;
int frame=(AbsoluteSubframe/10)%1024;
UL_cu_fs6(ru, frame,subframe, AbsoluteSubframe);
DL_cu_fs6(ru, frame,subframe);
}
return NULL;
}
void *du_fs6(void *arg) {
RU_t *ru = (RU_t *)arg;
RU_proc_t *proc = &ru->proc;
int64_t AbsoluteSubframe=-1;
fill_rf_config(ru,ru->rf_config_file);
init_frame_parms(&ru->frame_parms,1);
phy_init_RU(ru);
openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);
wait_sync("ru_thread");
while(1) {
AbsoluteSubframe++;
int subframe=AbsoluteSubframe%10;
int frame=(AbsoluteSubframe/10)%1024;
UL_du_fs6(ru, frame,subframe);
DL_du_fs6(ru, frame,subframe, AbsoluteSubframe);
}
return NULL;
}
...@@ -26,6 +26,7 @@ static int DEFENBS[] = {0}; ...@@ -26,6 +26,7 @@ static int DEFENBS[] = {0};
#include <openair2/LAYER2/MAC/mac_extern.h> #include <openair2/LAYER2/MAC/mac_extern.h>
#include <openair1/PHY/LTE_REFSIG/lte_refsig.h> #include <openair1/PHY/LTE_REFSIG/lte_refsig.h>
#include <nfapi/oai_integration/nfapi_pnf.h> #include <nfapi/oai_integration/nfapi_pnf.h>
#include <executables/split_headers.h>
extern uint16_t sf_ahead; extern uint16_t sf_ahead;
extern void oai_subframe_ind(uint16_t sfn, uint16_t sf); extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
...@@ -103,6 +104,16 @@ void init_RU_proc(RU_t *ru) { ...@@ -103,6 +104,16 @@ void init_RU_proc(RU_t *ru) {
for (i=0; i<10; i++) proc->symbol_mask[i]=0; for (i=0; i<10; i++) proc->symbol_mask[i]=0;
pthread_t t; pthread_t t;
char *fs6=getenv("fs6");
if (fs6) {
if ( strncasecmp(fs6,"cu", 2) )
threadCreate(&t, cu_fs6, (void *)ru, "MainCu", -1, OAI_PRIORITY_RT_MAX);
else if ( strncasecmp(fs6,"du", 2) )
threadCreate(&t, du_fs6, (void *)ru, "MainDu", -1, OAI_PRIORITY_RT_MAX);
else
AssertFatal(false, "environement variable fs6 is not cu or du");
} else
threadCreate(&t, ru_thread, (void *)ru, "MainRu", -1, OAI_PRIORITY_RT_MAX); threadCreate(&t, ru_thread, (void *)ru, "MainRu", -1, OAI_PRIORITY_RT_MAX);
} }
...@@ -719,13 +730,10 @@ void tx_rf(RU_t *ru) { ...@@ -719,13 +730,10 @@ void tx_rf(RU_t *ru) {
} }
static void *ru_thread( void *param ) { static void *ru_thread( void *param ) {
static int ru_thread_status;
RU_t *ru = (RU_t *)param; RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
int subframe =9; int subframe =9;
int frame =1023; int frame =1023;
// set default return value
ru_thread_status = 0;
if (ru->if_south == LOCAL_RF) { // configure RF parameters only if (ru->if_south == LOCAL_RF) { // configure RF parameters only
fill_rf_config(ru,ru->rf_config_file); fill_rf_config(ru,ru->rf_config_file);
...@@ -800,8 +808,7 @@ static void *ru_thread( void *param ) { ...@@ -800,8 +808,7 @@ static void *ru_thread( void *param ) {
else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx); else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx);
} }
ru_thread_status = 0; return NULL;
return &ru_thread_status;
} }
int start_rf(RU_t *ru) { int start_rf(RU_t *ru) {
...@@ -816,18 +823,15 @@ int stop_rf(RU_t *ru) { ...@@ -816,18 +823,15 @@ int stop_rf(RU_t *ru) {
void set_function_spec_param(RU_t *ru) { void set_function_spec_param(RU_t *ru) {
switch (ru->if_south) { switch (ru->if_south) {
case LOCAL_RF: // this is an RU with integrated RF (RRU, eNB) case LOCAL_RF: // this is an RU with integrated RF (RRU, eNB)
ru->do_prach = 0; // no prach processing in RU
ru->feprx = fep_full; ru->feprx = fep_full;
ru->feptx_ofdm = feptx_ofdm; ru->feptx_ofdm = feptx_ofdm;
ru->feptx_prec = feptx_prec; // this is fep with idft and precoding ru->feptx_prec = feptx_prec; // this is fep with idft and precoding
ru->fh_north_in = NULL; // no incoming fronthaul from north
ru->start_if = NULL; // no if interface
ru->rfdevice.host_type = RAU_HOST; ru->rfdevice.host_type = RAU_HOST;
ru->fh_south_in = rx_rf; // local synchronous RF RX ru->fh_south_in = rx_rf; // local synchronous RF RX
ru->fh_south_out = tx_rf; // local synchronous RF TX ru->fh_south_out = tx_rf; // local synchronous RF TX
ru->start_rf = start_rf; // need to start the local RF interface ru->start_rf = start_rf; // need to start the local RF interface
ru->stop_rf = stop_rf; ru->stop_rf = stop_rf;
ru->eNB_top=eNB_top; ru->eNB_top = eNB_top;
break; break;
default: default:
......
#ifndef __SPLIT_HEADERS_H #ifndef __SPLIT_HEADERS_H
#define __SPLIT_HEADERS_H #define __SPLIT_HEADERS_H
#include <stdint.h>
#include <openair1/PHY/defs_eNB.h>
#define MTU 65536 #define MTU 65536
#define UDP_TIMEOUT 100000L // in nano second #define UDP_TIMEOUT 100000L // in nano second
#define MAX_BLOCKS 16 #define MAX_BLOCKS 16
...@@ -18,12 +20,27 @@ typedef struct frequency_s { ...@@ -18,12 +20,27 @@ typedef struct frequency_s {
int frame; int frame;
int subframe; int subframe;
int sampleSize; int sampleSize;
int nbAnt int nbAnt;
int nbSamples; int nbSamples;
} frequency_t; } frequency_t;
int createListner (port); int createListner (int port);
int receiveSubFrame(int sock, uint64_t expectedTS, void *bufferZone, int bufferSize); int receiveSubFrame(int sock, uint64_t expectedTS, void *bufferZone, int bufferSize);
int sendSubFrame(int sock, void *bufferZone, int nbBlocks); int sendSubFrame(int sock, void *bufferZone, int nbBlocks);
inline size_t alignedSize(void *ptr) {
commonUDP_t *header=(commonUDP_t *) ptr;
return ((header->contentBytes+sizeof(commonUDP_t)+blockAlign-1)/blockAlign)*blockAlign;
} }
void *cu_fs6(void *arg);
void *du_fs6(void *arg);
void fill_rf_config(RU_t *ru, char *rf_config_file);
void rx_rf(RU_t *ru,int *frame,int *subframe);
void tx_rf(RU_t *ru);
// mistakes in main OAI
void phy_init_RU(RU_t *);
void feptx_prec(RU_t *);
void feptx_ofdm(RU_t *);
void oai_subframe_ind(uint16_t sfn, uint16_t sf);
#endif #endif
#include <split_headers.h> #include <executables/split_headers.h>
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/udp.h>
int createListner (port) { int createListner (int port) {
int sock; int sock;
AssertFatal((sock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) >= 0, ""); AssertFatal((sock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) >= 0, "");
struct sockaddr_in addr = { struct sockaddr_in addr = {
...@@ -12,8 +16,8 @@ sin_addr: ...@@ -12,8 +16,8 @@ sin_addr:
{ s_addr: INADDR_ANY } { s_addr: INADDR_ANY }
}; };
int enable=1; int enable=1;
AssertFatal(setsockopt(eth->sockfdc, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable))==0,""); AssertFatal(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable))==0,"");
AssertFatal(bind(sock, const struct sockaddr *addr, socklen_t addrlen)==0,""); AssertFatal(bind(sock, (const struct sockaddr *) &addr, sizeof(addr))==0,"");
struct timeval tv= {0,UDP_TIMEOUT}; struct timeval tv= {0,UDP_TIMEOUT};
AssertFatal(setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,&tv,sizeof(tv)) ==0,""); AssertFatal(setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,&tv,sizeof(tv)) ==0,"");
// Make a send/recv buffer larger than a a couple of subframe // Make a send/recv buffer larger than a a couple of subframe
...@@ -28,6 +32,7 @@ sin_addr: ...@@ -28,6 +32,7 @@ sin_addr:
// bufferZone: a reception area of bufferSize // bufferZone: a reception area of bufferSize
int receiveSubFrame(int sock, uint64_t expectedTS, void *bufferZone, int bufferSize) { int receiveSubFrame(int sock, uint64_t expectedTS, void *bufferZone, int bufferSize) {
int rcved=0; int rcved=0;
commonUDP_t *tmp=NULL;
do { do {
//read all subframe data from the control unit //read all subframe data from the control unit
...@@ -41,7 +46,7 @@ int receiveSubFrame(int sock, uint64_t expectedTS, void *bufferZone, int buffer ...@@ -41,7 +46,7 @@ int receiveSubFrame(int sock, uint64_t expectedTS, void *bufferZone, int buffer
return -1; return -1;
} }
} else { } else {
commonUDP_t *tmp=(commonUDP_t *)bufferZone; tmp=(commonUDP_t *)bufferZone;
if ( expectedTS && tmp->timestamp != expectedTS) { if ( expectedTS && tmp->timestamp != expectedTS) {
LOG_W(HW,"Received a paquet in mixed subframes, dropping it\n"); LOG_W(HW,"Received a paquet in mixed subframes, dropping it\n");
...@@ -50,9 +55,9 @@ int receiveSubFrame(int sock, uint64_t expectedTS, void *bufferZone, int buffer ...@@ -50,9 +55,9 @@ int receiveSubFrame(int sock, uint64_t expectedTS, void *bufferZone, int buffer
bufferZone+=ret; bufferZone+=ret;
} }
} }
} while ( !recved || recved < tmp->nbBlocks); } while ( !rcved || rcved < tmp->nbBlocks);
return recv; return rcved;
} }
int sendSubFrame(int sock, void *bufferZone, int nbBlocks) { int sendSubFrame(int sock, void *bufferZone, int nbBlocks) {
......
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