Commit 20be2dd3 authored by Sofia Pison's avatar Sofia Pison Committed by rajeshwari.p

sending according to the NIC light

parent 4dad60fe
...@@ -233,6 +233,39 @@ int start_oran(void *xranlib_){ ...@@ -233,6 +233,39 @@ int start_oran(void *xranlib_){
#endif #endif
//------------------------------------------------------------------------
#ifdef __cplusplus
extern "C"
{
#endif
int stop_oran(void *xranlib_){
xranLibWraper *xranlib = ((xranLibWraper *) xranlib_);
xranlib->Stop();
return (0);
}
#ifdef __cplusplus
}
#endif
//------------------------------------------------------------------------
#ifdef __cplusplus
extern "C"
{
#endif
int close_oran(void *xranlib_){
xranLibWraper *xranlib = ((xranLibWraper *) xranlib_);
xranlib->Close();
return (0);
}
#ifdef __cplusplus
}
#endif
//------------------------------------------------------------------------ //------------------------------------------------------------------------
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
......
/*
* * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* * contributor license agreements. See the NOTICE file distributed with
* * this work for additional information regarding copyright ownership.
* * The OpenAirInterface Software Alliance licenses this file to You under
* * the OAI Public License, Version 1.1 (the "License"); you may not use this file
* * except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.openairinterface.org/?page_id=698
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
* *-------------------------------------------------------------------------------
* * For more information about the OpenAirInterface (OAI) Software Alliance:
* * contact@openairinterface.org
* */
#ifndef _ORAN_H_
#define _ORAN_H_
#include "shared_buffers.h"
#include "common_lib.h"
void oran_fh_if4p5_south_out(RU_t *ru, void oran_fh_if4p5_south_out(RU_t *ru,
int frame, int frame,
int slot, int slot,
...@@ -7,6 +33,9 @@ void oran_fh_if4p5_south_in(RU_t *ru, ...@@ -7,6 +33,9 @@ void oran_fh_if4p5_south_in(RU_t *ru,
int *frame, int *frame,
int *slot); int *slot);
int transport_init(openair0_device *device,
openair0_config_t *openair0_cfg,
eth_params_t * eth_params );
typedef struct { typedef struct {
...@@ -16,4 +45,4 @@ typedef struct { ...@@ -16,4 +45,4 @@ typedef struct {
int capabilities_sent; int capabilities_sent;
void *oran_priv; void *oran_priv;
} oran_eth_state_t; } oran_eth_state_t;
#endif /* _ORAN_H_ */
...@@ -50,6 +50,9 @@ int trx_oran_start(openair0_device *device) ...@@ -50,6 +50,9 @@ int trx_oran_start(openair0_device *device)
void trx_oran_end(openair0_device *device) void trx_oran_end(openair0_device *device)
{ {
printf("ORAN: %s\n", __FUNCTION__); printf("ORAN: %s\n", __FUNCTION__);
oran_eth_state_t *s = device->priv;
stop_oran(s);
close_oran(s);
} }
...@@ -241,8 +244,8 @@ void oran_fh_if4p5_south_in(RU_t *ru, ...@@ -241,8 +244,8 @@ void oran_fh_if4p5_south_in(RU_t *ru,
int *slot) int *slot)
{ {
printf("XXX oran_fh_if4p5_south_in %d %d\n", *frame, *slot);
printf("XXX oran_fh_if4p5_south_in %d %d\n", *frame, *slot);
oran_eth_state_t *s = ru->ifdevice.priv; oran_eth_state_t *s = ru->ifdevice.priv;
NR_DL_FRAME_PARMS *fp; NR_DL_FRAME_PARMS *fp;
int symbol; int symbol;
...@@ -252,8 +255,8 @@ printf("XXX oran_fh_if4p5_south_in %d %d\n", *frame, *slot); ...@@ -252,8 +255,8 @@ printf("XXX oran_fh_if4p5_south_in %d %d\n", *frame, *slot);
lock_ul_buffer(&s->buffers, *slot); lock_ul_buffer(&s->buffers, *slot);
#if 1 #if 1
next: next:
while (!((s->buffers.ul_busy[*slot] == 0x3fff && while (!((s->buffers.ul_busy[0][*slot] == 0x3fff &&
s->buffers.ul_busy[*slot] == 0x3fff) || s->buffers.ul_busy[1][*slot] == 0x3fff) ||
s->buffers.prach_busy[*slot] == 1)) s->buffers.prach_busy[*slot] == 1))
wait_ul_buffer(&s->buffers, *slot); wait_ul_buffer(&s->buffers, *slot);
if (s->buffers.prach_busy[*slot] == 1) { if (s->buffers.prach_busy[*slot] == 1) {
...@@ -276,7 +279,7 @@ next: ...@@ -276,7 +279,7 @@ next:
for (antenna = 0; antenna < ru->nb_rx; antenna++) { for (antenna = 0; antenna < ru->nb_rx; antenna++) {
for (symbol = 0; symbol < 14; symbol++) { for (symbol = 0; symbol < 14; symbol++) {
int i; int i;
int16_t *p = (int16_t *)(&s->buffers.ul[*slot][symbol*1272*4]); int16_t *p = (int16_t *)(&s->buffers.ul[antenna][*slot][symbol*1272*4]);
for (i = 0; i < 1272*2; i++) { for (i = 0; i < 1272*2; i++) {
p[i] = (int16_t)(ntohs(p[i])) / 16; p[i] = (int16_t)(ntohs(p[i])) / 16;
} }
...@@ -287,17 +290,17 @@ printf("rxdata in oran_fh_if4p5_south_in %p\n", &ru->common.rxdataF[antenna][0]) ...@@ -287,17 +290,17 @@ printf("rxdata in oran_fh_if4p5_south_in %p\n", &ru->common.rxdataF[antenna][0])
#endif #endif
#if 1 #if 1
memcpy(rxdata + 2048 - 1272/2, memcpy(rxdata + 2048 - 1272/2,
&s->buffers.ul[*slot][symbol*1272*4], &s->buffers.ul[antenna][*slot][symbol*1272*4],
(1272/2) * 4); (1272/2) * 4);
memcpy(rxdata, memcpy(rxdata,
&s->buffers.ul[*slot][symbol*1272*4] + (1272/2)*4, &s->buffers.ul[antenna][*slot][symbol*1272*4] + (1272/2)*4,
(1272/2) * 4); (1272/2) * 4);
#endif #endif
} }
} }
s->buffers.ul_busy[*slot] = 0; s->buffers.ul_busy[0][*slot] = 0;
s->buffers.ul_busy[*slot] = 0; s->buffers.ul_busy[1][*slot] = 0;
signal_ul_buffer(&s->buffers, *slot); signal_ul_buffer(&s->buffers, *slot);
unlock_ul_buffer(&s->buffers, *slot); unlock_ul_buffer(&s->buffers, *slot);
...@@ -333,7 +336,6 @@ void oran_fh_if4p5_south_out(RU_t *ru, ...@@ -333,7 +336,6 @@ void oran_fh_if4p5_south_out(RU_t *ru,
printf("XXX oran_fh_if4p5_south_out %d %d %ld\n", frame, slot, timestamp); printf("XXX oran_fh_if4p5_south_out %d %d %ld\n", frame, slot, timestamp);
#if 0
oran_eth_state_t *s = ru->ifdevice.priv; oran_eth_state_t *s = ru->ifdevice.priv;
NR_DL_FRAME_PARMS *fp; NR_DL_FRAME_PARMS *fp;
int symbol; int symbol;
...@@ -380,7 +382,6 @@ printf("XXX oran_fh_if4p5_south_out %d %d %ld\n", frame, slot, timestamp); ...@@ -380,7 +382,6 @@ printf("XXX oran_fh_if4p5_south_out %d %d %ld\n", frame, slot, timestamp);
s->buffers.dl_busy[0][slot] = 0x3fff; s->buffers.dl_busy[0][slot] = 0x3fff;
s->buffers.dl_busy[1][slot] = 0x3fff; s->buffers.dl_busy[1][slot] = 0x3fff;
unlock_dl_buffer(&s->buffers, slot); unlock_dl_buffer(&s->buffers, slot);
#endif
} }
void *get_internal_parameter(char *name) void *get_internal_parameter(char *name)
...@@ -403,7 +404,6 @@ int transport_init(openair0_device *device, ...@@ -403,7 +404,6 @@ int transport_init(openair0_device *device,
{ {
oran_eth_state_t *eth; oran_eth_state_t *eth;
printf("ORAN: %s\n", __FUNCTION__);
device->Mod_id = 0; device->Mod_id = 0;
device->transp_type = ETHERNET_TP; device->transp_type = ETHERNET_TP;
...@@ -440,6 +440,54 @@ int transport_init(openair0_device *device, ...@@ -440,6 +440,54 @@ int transport_init(openair0_device *device,
init_buffers(&eth->buffers); init_buffers(&eth->buffers);
oran_eth_state_t *s = eth;
printf("ORAN: %s\n", __FUNCTION__);
// Check if the machine is PTP sync
check_xran_ptp_sync();
// SetUp
if ( setup_oran(s->oran_priv) !=0 ){
printf("%s:%d:%s: SetUp ORAN failed ... Exit\n",
__FILE__, __LINE__, __FUNCTION__);
exit(1);
}else{
printf("SetUp ORAN. Done\n");
}
// Load the IQ samples from file
load_iq_from_file(s->oran_priv);
printf("Load IQ from file. Done\n");
// Register physide callbacks
register_physide_callbacks(s->oran_priv);
printf("Register physide callbacks. Done\n");
// Open callbacks
open_oran_callback(s->oran_priv);
printf("Open Oran callbacks. Done\n");
// Init ORAN
initialize_oran(s->oran_priv);
printf("Init Oran. Done\n");
// Copy the loaded IQ to the xran buffer fro the tx
xran_fh_tx_send_buffer(s->oran_priv);
printf("ORAN FH send tx buffer filled in with loaded IQs. Done\n");
// Open ORAN
open_oran(s->oran_priv);
printf("xran_open. Done\n");
// Start ORAN
if ( start_oran(s->oran_priv) !=0 ){
printf("%s:%d:%s: Start ORAN failed ... Exit\n",
__FILE__, __LINE__, __FUNCTION__);
exit(1);
}else{
printf("Start ORAN. Done\n");
}
return 0; return 0;
} }
...@@ -102,6 +102,25 @@ int start_oran( void *xranlib_ ); ...@@ -102,6 +102,25 @@ int start_oran( void *xranlib_ );
#endif #endif
#ifdef __cplusplus
extern "C"
{
#endif
int stop_oran( void *xranlib_ );
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
int close_oran( void *xranlib_ );
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
......
...@@ -45,16 +45,16 @@ void init_buffers(shared_buffers *s) ...@@ -45,16 +45,16 @@ void init_buffers(shared_buffers *s)
* needs to have slots 1, 2 and 3, 4 and 5 ready. Let's pretend * needs to have slots 1, 2 and 3, 4 and 5 ready. Let's pretend
* they are ready. * they are ready.
*/ */
s->dl_busy[1] = 0x3fff; s->dl_busy[0][1] = 0x3fff;
s->dl_busy[2] = 0x3fff; s->dl_busy[0][2] = 0x3fff;
s->dl_busy[3] = 0x3fff; s->dl_busy[0][3] = 0x3fff;
s->dl_busy[4] = 0x3fff; s->dl_busy[0][4] = 0x3fff;
s->dl_busy[5] = 0x3fff; s->dl_busy[0][5] = 0x3fff;
s->dl_busy[1] = 0x3fff; s->dl_busy[1][1] = 0x3fff;
s->dl_busy[2] = 0x3fff; s->dl_busy[1][2] = 0x3fff;
s->dl_busy[3] = 0x3fff; s->dl_busy[1][3] = 0x3fff;
s->dl_busy[4] = 0x3fff; s->dl_busy[1][4] = 0x3fff;
s->dl_busy[5] = 0x3fff; s->dl_busy[1][5] = 0x3fff;
} }
void lock_dl_buffer(shared_buffers *s, int slot) void lock_dl_buffer(shared_buffers *s, int slot)
......
...@@ -19,23 +19,25 @@ ...@@ -19,23 +19,25 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#ifndef _SHARED_BUFFERS_H_ #ifndef _BENETEL_5G_SHARED_BUFFERS_H_
#define _SHARED_BUFFERS_H_ #define _BENETEL_5G_SHARED_BUFFERS_H_
#include <pthread.h> #include <pthread.h>
#include <stdint.h> #include <stdint.h>
typedef struct { typedef struct {
unsigned char dl[20][14*1272*4]; /* [2] is for two antennas */
unsigned char ul[20][14*1272*4]; unsigned char dl[2][20][14*1272*4];
uint16_t dl_busy[20]; unsigned char ul[2][20][14*1272*4];
uint16_t ul_busy[20]; uint16_t dl_busy[2][20];
uint16_t ul_busy[2][20];
pthread_mutex_t m_ul[20]; pthread_mutex_t m_ul[20];
pthread_cond_t c_ul[20]; pthread_cond_t c_ul[20];
pthread_mutex_t m_dl[20]; pthread_mutex_t m_dl[20];
pthread_cond_t c_dl[20]; pthread_cond_t c_dl[20];
unsigned char prach[20][849*4]; unsigned char prach[20][849*4];
unsigned char prach_busy[20]; unsigned char prach_busy[20];
...@@ -46,16 +48,14 @@ typedef struct { ...@@ -46,16 +48,14 @@ typedef struct {
void init_buffers(shared_buffers *s); void init_buffers(shared_buffers *s);
void lock_dl_buffers(shared_buffers *s, int slot); void lock_dl_buffer(shared_buffers *s, int slot);
void unlock_dl_buffers(shared_buffers *s, int slot); void unlock_dl_buffer(shared_buffers *s, int slot);
void wait_dl_buffers(shared_buffers *s, int slot); void wait_dl_buffer(shared_buffers *s, int slot);
void signal_dl_buffers(shared_buffers *s, int slot); void signal_dl_buffer(shared_buffers *s, int slot);
void lock_ul_buffers(shared_buffers *s, int slot); void lock_ul_buffer(shared_buffers *s, int slot);
void unlock_ul_buffers(shared_buffers *s, int slot); void unlock_ul_buffer(shared_buffers *s, int slot);
void wait_ul_buffers(shared_buffers *s, int slot); void wait_ul_buffer(shared_buffers *s, int slot);
void signal_ul_buffers(shared_buffers *s, int slot); void signal_ul_buffer(shared_buffers *s, int slot);
#endif /* _SHARED_BUFFERS_H_ */ #endif /* _BENETEL_5G_SHARED_BUFFERS_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