Commit e4ed054c authored by 111's avatar 111

add ric and changes for 4rx

parent 2e36b896
......@@ -2430,6 +2430,7 @@ add_executable(nr-softmodem
${OPENAIR_DIR}/executables/nr-ru.c
${OPENAIR_DIR}/executables/nr-softmodem.c
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR_DIR}/executables/ric-interface.c
${OPENAIR_DIR}/radio/COMMON/common_lib.c
${OPENAIR_DIR}/radio/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
......
......@@ -403,7 +403,7 @@ void *tx_reorder_thread(void* param) {
if (resL1Reserve) {
resL1=resL1Reserve;
if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) {
LOG_E(PHY,"order mistake\n");
LOG_E(PHY,"order mistakeslot %d %d\n", ((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot, next_tx_slot);
resL1Reserve = NULL;
resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
}
......@@ -415,7 +415,7 @@ void *tx_reorder_thread(void* param) {
resL1Reserve = resL1;
resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot)
LOG_E(PHY,"error, pull two msg, none is good\n");
LOG_E(PHY,"error, pull two msg, none is good, slot %d %d\n", ((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot, next_tx_slot);
}
}
if (resL1 == NULL)
......
......@@ -64,7 +64,7 @@ unsigned short config_frames[4] = {2,9,11,13};
static int DEFBANDS[] = {7};
static int DEFENBS[] = {0};
static int DEFBFW[] = {0x00007fff};
static int DEFRUTPCORES[] = {-1,-1,-1,-1};
static int DEFRUTPCORES[] = {-1,-1,-1,-1, -1,-1,-1,-1};
//static int DEFNRBANDS[] = {7};
//static int DEFGNBS[] = {0};
......@@ -1000,6 +1000,105 @@ void *ru_stats_thread(void *param) {
return(NULL);
}
extern void nr_fep(void* arg);
void ru_rx_func(void *arg) {
PHY_VARS_gNB *gNB = RC.gNB[0];
feprx_cmd_t *feprx_cmd = (feprx_cmd_t *)arg;
RU_t *ru = feprx_cmd->ru;
int aid = feprx_cmd->aid;
int tti_rx = feprx_cmd->slot;
int frame_rx = feprx_cmd->frame;
int startSymbol = feprx_cmd->startSymbol;
int endSymbol = feprx_cmd->endSymbol;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
notifiedFIFO_elt_t *res;
processingData_L1_t *syncMsg;
RU_proc_t *proc = (RU_proc_t *)&(ru->proc);
nfapi_nr_config_request_scf_t *cfg = &ru->config;
int slot_type = nr_slot_select(cfg,proc->frame_rx,proc->tti_rx);
if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT)
{
int nbfeprx=0;
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 );
start_meas(&ru->ofdm_demod_stats);
for (int aid=0;aid<ru->nb_rx;aid++) {
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feprx_cmd_t), 1000 + aid,ru->respfeprx,nr_fep);
feprx_cmd_t *feprx_cmd=(feprx_cmd_t*)NotifiedFifoData(req);
feprx_cmd->aid = aid;
feprx_cmd->ru = ru;
feprx_cmd->slot = ru->proc.tti_rx;
feprx_cmd->startSymbol = 0;
feprx_cmd->endSymbol = (ru->half_slot_parallelization > 0)?(ru->nr_frame_parms->symbols_per_slot>>1)-1:(ru->nr_frame_parms->symbols_per_slot-1);
pushTpool(ru->threadPool,req);
nbfeprx++;
if (ru->half_slot_parallelization>0) {
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feprx_cmd_t), 1000 + aid + ru->nb_rx,ru->respfeprx,nr_fep);
feprx_cmd_t *feprx_cmd=(feprx_cmd_t*)NotifiedFifoData(req);
feprx_cmd->aid = aid;
feprx_cmd->ru = ru;
feprx_cmd->slot = ru->proc.tti_rx;
feprx_cmd->startSymbol = ru->nr_frame_parms->symbols_per_slot>>1;
feprx_cmd->endSymbol = ru->nr_frame_parms->symbols_per_slot-1;
pushTpool(ru->threadPool,req);
nbfeprx++;
}
}
//LOG_M("rxdata.m","rxs",ru->common.rxdata[0],1228800,1,1);
LOG_D(PHY,"RU proc: frame_rx = %d, tti_rx = %d\n", frame_rx, tti_rx);
if (IS_SOFTMODEM_DOSCOPE && RC.gNB[0]->scopeData)
((scopeData_t *)RC.gNB[0]->scopeData)->slotFunc(ru->common.rxdataF[0],proc->tti_rx, RC.gNB[0]->scopeData);
// Do PRACH RU processing
int prach_id=find_nr_prach_ru(ru,frame_rx,tti_rx,SEARCH_EXIST);
uint8_t prachStartSymbol,N_dur;
if (prach_id>=0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );
T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(frame_rx), T_INT(tti_rx), T_INT(0),
T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2));
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
for (int prach_oc = 0; prach_oc<ru->prach_list[prach_id].num_prach_ocas; prach_oc++) {
prachStartSymbol = ru->prach_list[prach_id].prachStartSymbol+prach_oc*N_dur;
//comment FK: the standard 38.211 section 5.3.2 has one extra term +14*N_RA_slot. This is because there prachStartSymbol is given wrt to start of the 15kHz slot or 60kHz slot. Here we work slot based, so this function is anyway only called in slots where there is PRACH. Its up to the MAC to schedule another PRACH PDU in the case there are there N_RA_slot \in {0,1}.
rx_nr_prach_ru(ru,
ru->prach_list[prach_id].fmt, //could also use format
ru->prach_list[prach_id].numRA,
prachStartSymbol,
prach_oc,
proc->frame_rx,proc->tti_rx);
}
//clock_gettime(CLOCK_MONOTONIC,&ru->rt_ru_profiling.return_RU_prachrx[rt_prof_idx]);
free_nr_ru_prach_entry(ru,prach_id);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 );
} // end if (prach_id > 0)
while (nbfeprx>0) {
notifiedFIFO_elt_t *req=pullTpool(ru->respfeprx, ru->threadPool);
delNotifiedFIFO_elt(req);
nbfeprx--;
}
//clock_gettime(CLOCK_MONOTONIC,&ru->rt_ru_profiling.return_RU_feprx[rt_prof_idx]);
stop_meas(&ru->ofdm_demod_stats);
}
// At this point, all information for subframe has been received on FH interface
res = pullTpool(&gNB->resp_L1, &gNB->threadPool);
if (res == NULL)
AssertFatal(1==0, "Tpool has been stopped, exiting\n"); // Tpool has been stopped
syncMsg = (processingData_L1_t *)NotifiedFifoData(res);
syncMsg->gNB = gNB;
syncMsg->frame_rx = frame_rx;
syncMsg->slot_rx = tti_rx;
syncMsg->frame_tx = proc->frame_tx;
syncMsg->slot_tx = proc->tti_tx;
syncMsg->timestamp_tx = proc->timestamp_tx;
res->key = proc->tti_rx;
pushTpool(&gNB->threadPool, res);
}
void ru_tx_func(void *param) {
processingData_RU_t *info = (processingData_RU_t *) param;
......@@ -1133,7 +1232,7 @@ void *ru_thread( void *param ) {
pthread_mutex_unlock(&RC.ru_mutex);
wait_sync("ru_thread");
processingData_L1_t *syncMsg;
feprx_cmd_t *syncRuMsg;
notifiedFIFO_elt_t *res;
if(!emulate_rf) {
......@@ -1236,61 +1335,42 @@ void *ru_thread( void *param ) {
if (ru->idx!=0) proc->frame_tx = (proc->frame_tx+proc->frame_offset)&1023;
// do RX front-end processing (frequency-shift, dft) if needed
int slot_type = nr_slot_select(cfg,proc->frame_rx,proc->tti_rx);
// int slot_type = nr_slot_select(cfg,proc->frame_rx,proc->tti_rx);
if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) {
// if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) {
// At this point, all information for subframe has been received on FH interface
if (ru->feprx) {
ru->feprx(ru,proc->tti_rx);
clock_gettime(CLOCK_MONOTONIC,&ru->rt_ru_profiling.return_RU_feprx[rt_prof_idx]);
//LOG_M("rxdata.m","rxs",ru->common.rxdata[0],1228800,1,1);
LOG_D(PHY,"RU proc: frame_rx = %d, tti_rx = %d\n", proc->frame_rx, proc->tti_rx);
if (IS_SOFTMODEM_DOSCOPE && RC.gNB[0]->scopeData)
((scopeData_t *)RC.gNB[0]->scopeData)->slotFunc(ru->common.rxdataF[0],proc->tti_rx, RC.gNB[0]->scopeData);
// Do PRACH RU processing
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
uint8_t prachStartSymbol,N_dur;
if (prach_id>=0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );
T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0),
T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2));
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
for (int prach_oc = 0; prach_oc<ru->prach_list[prach_id].num_prach_ocas; prach_oc++) {
prachStartSymbol = ru->prach_list[prach_id].prachStartSymbol+prach_oc*N_dur;
//comment FK: the standard 38.211 section 5.3.2 has one extra term +14*N_RA_slot. This is because there prachStartSymbol is given wrt to start of the 15kHz slot or 60kHz slot. Here we work slot based, so this function is anyway only called in slots where there is PRACH. Its up to the MAC to schedule another PRACH PDU in the case there are there N_RA_slot \in {0,1}.
rx_nr_prach_ru(ru,
ru->prach_list[prach_id].fmt, //could also use format
ru->prach_list[prach_id].numRA,
prachStartSymbol,
prach_oc,
proc->frame_rx,proc->tti_rx);
#if 1
res = pullTpool(ru->resprurx, ru->threadPool);
if (res == NULL)
break; // Tpool has been stopped
syncRuMsg = (feprx_cmd_t *)NotifiedFifoData(res);
syncRuMsg->aid = 0;
syncRuMsg->ru = ru;
syncRuMsg->frame = proc->frame_rx;
syncRuMsg->slot = proc->tti_rx;
syncRuMsg->startSymbol = 0;
pushTpool(ru->threadPool, res);
#else
feprx_cmd_t syncRuMsg;
syncRuMsg.aid = 0;
syncRuMsg.ru = ru;
syncRuMsg.frame = proc->frame_rx;
syncRuMsg.slot = proc->tti_rx;
syncRuMsg.startSymbol = 0;
ru_rx_func((void *)&syncRuMsg);
#endif
}
clock_gettime(CLOCK_MONOTONIC,&ru->rt_ru_profiling.return_RU_prachrx[rt_prof_idx]);
free_nr_ru_prach_entry(ru,prach_id);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 );
} // end if (prach_id > 0)
} // end if (ru->feprx)
else {
memset(&ru->rt_ru_profiling.return_RU_feprx[rt_prof_idx],0,sizeof(struct timespec));
memset(&ru->rt_ru_profiling.return_RU_prachrx[rt_prof_idx],0,sizeof(struct timespec));
}
} // end if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) {
// }
// At this point, all information for subframe has been received on FH interface
res = pullTpool(&gNB->resp_L1, &gNB->threadPool);
if (res == NULL)
break; // Tpool has been stopped
syncMsg = (processingData_L1_t *)NotifiedFifoData(res);
syncMsg->gNB = gNB;
syncMsg->frame_rx = proc->frame_rx;
syncMsg->slot_rx = proc->tti_rx;
syncMsg->frame_tx = proc->frame_tx;
syncMsg->slot_tx = proc->tti_tx;
syncMsg->timestamp_tx = proc->timestamp_tx;
res->key = proc->tti_rx;
pushTpool(&gNB->threadPool, res);
}
printf( "Exiting ru_thread \n");
......@@ -1343,7 +1423,6 @@ void init_RU_proc(RU_t *ru) {
pthread_mutex_init( &proc->mutex_emulateRF,NULL);
pthread_cond_init( &proc->cond_emulateRF, NULL);
threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "ru_thread", ru->tpcores[0], OAI_PRIORITY_RT_MAX );
if(emulate_rf)
threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT );
if (opp_enabled == 1)
......@@ -1797,6 +1876,12 @@ void init_NR_RU(char *rf_config_file) {
// FEP TX result FIFO
ru->respfeptx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(ru->respfeptx);
// L1 RX result FIFO
ru->resprurx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(ru->resprurx);
notifiedFIFO_elt_t *msg = newNotifiedFIFO_elt(sizeof(feprx_cmd_t), 0, ru->resprurx, ru_rx_func);
pushNotifiedFIFO(ru->resprurx, msg);
} // for ru_id
// sleep(1);
......@@ -1805,9 +1890,12 @@ void init_NR_RU(char *rf_config_file) {
void stop_RU(int nb_ru) {
RU_t *ru;
for (int inst = 0; inst < nb_ru; inst++) {
LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
kill_NR_RU_proc(inst);
ru = RC.ru[inst];
abortNotifiedFIFO(ru->resprurx);
}
}
......
......@@ -154,4 +154,5 @@ extern int emulate_rf;
extern int numerology;
extern int usrp_tx_thread;
extern void *ric_interface_task(void *args_p);
#endif
......@@ -151,6 +151,8 @@ int otg_enabled;
uint32_t timing_advance = 0;
uint64_t num_missed_slots=0; // counter for the number of missed slots
extern sem_t ric_send_sem;
#include <executables/split_headers.h>
#include <SIMULATION/ETH_TRANSPORT/proto.h>
......@@ -577,6 +579,15 @@ int main( int argc, char **argv ) {
#endif
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
sem_init(&ric_send_sem,0,0);
pthread_t ntid;
int gnb_flag = 1;
if (pthread_create(&ntid, NULL, ric_interface_task, &gnb_flag) < 0) {
fprintf(stderr, "ric_interface_task: Failed to create thread: %s\n",
strerror(errno));
exit;
}
if (RC.nb_nr_L1_inst > 0)
RCconfig_NR_L1();
......
/*
OpenXG RIC socket server
used to send PDSCH/PUSCH DMRS to client
*/
#include <stdio.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <linux/tcp.h>
#include <semaphore.h>
sem_t ric_send_sem;
//uint8_t ric_test_data[]={0,1,2,3,4,5,6,7,8,9};
uint8_t *ric_send_buf;
int ric_send_len;
#define RIC_INTERFACE_PORT 7788
#define RIC_INTERFACE_SOCKET_MAX_LEN (100+4*273*12)*4 //52516
//#define RIC_INTERFACE_SOCKET_MAX_LEN 65536
/*
gcc -o ric_s ric-interface.c -DRIC_TEST_SERVER -pthread
*/
#ifdef RIC_TEST_SERVER
void main()
#else
void *ric_interface_task(void *args_p)
#endif
{
int iSocketFD = 0; //socket句柄
int iRecvLen = 0; //接收成功后的返回值
int new_fd = 0; //建立连接后的句柄
char buf[4096] = {0}; //
struct sockaddr_in stLocalAddr = {0}; //本地地址信息结构图,下面有具体的属性赋值
struct sockaddr_in stRemoteAddr = {0}; //对方地址信息
socklen_t socklen = 0;
#ifdef RIC_TEST_SERVER
int gnb_flag = 0;
ric_send_buf = malloc(RIC_INTERFACE_SOCKET_MAX_LEN);
ric_send_buf[0] = 0x1E;
ric_send_buf[10] = 0x20;
ric_send_len = RIC_INTERFACE_SOCKET_MAX_LEN;
#else
int gnb_flag = *(int*)args_p;
#endif
iSocketFD = socket(AF_INET, SOCK_STREAM, 0); //建立socket
if(0 > iSocketFD)
{
perror("创建socket失败!\n");
return;
}
stLocalAddr.sin_family = AF_INET; /*该属性表示接收本机或其他机器传输*/
stLocalAddr.sin_port = htons(RIC_INTERFACE_PORT+gnb_flag); /*端口号*/
stLocalAddr.sin_addr.s_addr=htonl(INADDR_ANY); /*IP,括号内容表示本机IP*/
//绑定地址结构体和socket
if(0 > bind(iSocketFD, (void *)&stLocalAddr, sizeof(stLocalAddr)))
{
printf("绑定失败!gnb_flag %d\n", gnb_flag);
perror("绑定失败!");
return;
}
while(1)
{
//开启监听 ,第二个参数是最大监听数
if(0 > listen(iSocketFD, 1))
{
perror("监听失败!\n");
return;
}
printf("iSocketFD: %d\n", iSocketFD);
//在这里阻塞知道接收到消息,参数分别是socket句柄,接收到的地址信息以及大小
new_fd = accept(iSocketFD, (void *)&stRemoteAddr, &socklen);
if(0 > new_fd)
{
perror("接收失败!\n");
return;
}else{
printf("接收成功!\n");
}
printf("new_fd: %d\n", new_fd);
// iRecvLen = recv(new_fd, buf, sizeof(buf), 0);
// if(0 >= iRecvLen) //对端关闭连接 返回0
// {
// printf("接收失败或者对端关闭连接!\n");
// }else{
// printf("buf: %s\n", buf);
// }
int send_len;
while(1)
{
// printf ("wait for ric_send_sem \n");
#ifdef RIC_TEST_SERVER
usleep(10000);
#else
sem_wait (&ric_send_sem);
#endif
struct tcp_info info;
int len=sizeof(info);
getsockopt(new_fd, IPPROTO_TCP, TCP_INFO, &info, (socklen_t *)&len);
if((info.tcpi_state==1))
{
send_len = send(new_fd, ric_send_buf, ric_send_len, 0);
printf ("send data %p, size %d to client. %d OK \n", ric_send_buf, ric_send_len, send_len);
}
else
break;
}
}
}
#ifdef RIC_TEST_CLIENT
/*
gcc -o ric_c ric-interface.c -DRIC_TEST_CLIENT -pthread
*/
#include <stdio.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#define PORT 7789 //目标地址端口号 7788 -- ue 7789 -- NB
#define ADDR "127.0.0.1" //目标地址IP
void main()
{
int iSocketFD = 0; //socket句柄
unsigned int iRemoteAddr = 0;
struct sockaddr_in stRemoteAddr = {0}; //对端,即目标地址信息
socklen_t socklen = 0;
unsigned char buf[RIC_INTERFACE_SOCKET_MAX_LEN] = {0}; //存储接收到的数据
short *pdata = (int *)buf;
static int log_first = 0;
unsigned char buf_debug[RIC_INTERFACE_SOCKET_MAX_LEN] = {0}; //存储接收到的数据
iSocketFD = socket(AF_INET, SOCK_STREAM, 0); //建立socket
if(0 > iSocketFD)
{
printf("创建socket失败!\n");
return;
}
stRemoteAddr.sin_family = AF_INET;
stRemoteAddr.sin_port = htons(PORT);
inet_pton(AF_INET, ADDR, &iRemoteAddr);
stRemoteAddr.sin_addr.s_addr=iRemoteAddr;
//连接方法: 传入句柄,目标地址,和大小
while (1)
{
if(0 > connect(iSocketFD, (void *)&stRemoteAddr, sizeof(stRemoteAddr)))
{
printf("连接失败!\n");
//printf("connect failed:%d",errno);//失败时也可打印errno
}else{
printf("连接成功!\n");
int recv_len;
while(1)
{
recv_len = recv(iSocketFD, buf, RIC_INTERFACE_SOCKET_MAX_LEN, 0);
if (0 == recv_len)
{
printf("socket ERROR !!! \n\n\n");
return;
}
printf("Received(%d):, msg len %d, cnt %d\n", recv_len, pdata[0], pdata[1]);
// for(int i=0;i<20;i++)
// {
// printf("%02x ",buf[i]);
// }
//printf("\n\n\n");
log_first++;
if (log_first == 1)
{
memcpy(buf_debug, buf, recv_len);
FILE *fd;
if ((fd = fopen("srs_data.am","w")) != NULL) {
fwrite((void *)buf_debug,
sizeof(int32_t),
recv_len/4,
fd);
printf("Dummping Frame ...len %d bye bye \n", recv_len);
fclose(fd);
}
}
}
}
sleep(2);
}
close(iSocketFD);//关闭socket
}
#endif
\ No newline at end of file
......@@ -289,6 +289,7 @@ extern int oai_exit;
void tx_func(void *param);
void rx_func(void *param);
void ru_tx_func(void *param);
void ru_rx_func(void *param);
extern uint8_t nfapi_mode;
extern int16_t vnf_pnf_sfnslot_delta;
#ifdef __cplusplus
......
......@@ -384,8 +384,8 @@ void rx_nr_prach_ru(RU_t *ru,
k*=K;
k+=kbar;
for (int aa=0; aa<ru->nb_rx; aa++) {
//for (int aa=0; aa<ru->nb_rx; aa++) {
for (int aa=0; aa<1; aa++) {
AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa);
// do DFT
......@@ -462,6 +462,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
fp = &gNB->frame_parms;
nb_rx = gNB->gNB_config.carrier_config.num_rx_ant.value;
nb_rx = 1;
rootSequenceIndex = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].prach_root_sequence_index.value;
numrootSequenceIndex = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].num_root_sequences.value;
NCS = prach_pdu->num_cs;//cfg->num_prach_fd_occasions_list[0].prach_zero_corr_conf.value;
......
......@@ -43,15 +43,17 @@
#include "T.h"
//#define SRS_DEBUG
#define SEND_BY_SOCKET
int g_dmrs_caps_idx = 0;
int g_dmrs_cnt = 0;
//#if defined SEND_BY_SOCKET
nr_srs_cap_t g_srs_caps[2];
// extern uint8_t *ric_send_buf;
// extern int ric_send_len;
// extern sem_t ric_send_sem;
//#endif
nr_srs_cap_t g_srs_caps[2];
#if defined SEND_BY_SOCKET
extern uint8_t *ric_send_buf;
extern int ric_send_len;
extern sem_t ric_send_sem;
#endif
......@@ -252,6 +254,14 @@ int nr_cap_srs_signal(PHY_VARS_gNB *gNB,
}
}
#ifdef SEND_BY_SOCKET
ric_send_buf = ns_srs_cap;
ric_send_len = 40*2+273*12*frame_parms->nb_antennas_rx*N_symb_SRS*4;//for test
sem_post(&ric_send_sem);
//LOG_I(PHY,"sem_post(&ric_send_sem) buf %p, size %d pos %d \n\n\n",ric_send_buf,ric_send_len, pos);
g_dmrs_cnt++;
#else
FILE *output_fd = NULL;
output_fd = fopen("srs_data.am","w");
if (output_fd==NULL){
......@@ -263,6 +273,8 @@ int nr_cap_srs_signal(PHY_VARS_gNB *gNB,
fwrite(&(ns_srs_cap->num_ant_ports),sizeof(int16_t),38+273*12*frame_parms->nb_antennas_rx*N_symb_SRS*2,output_fd);
fclose(output_fd);
}
g_dmrs_caps_idx++;
#endif
g_dmrs_caps_idx = (g_dmrs_caps_idx+1) % 2;
}
\ No newline at end of file
......@@ -175,6 +175,7 @@ typedef struct {
struct RU_t_s *ru;
int startSymbol;
int endSymbol;
int frame;
int slot;
} feprx_cmd_t;
......@@ -649,6 +650,7 @@ typedef struct RU_t_s {
notifiedFIFO_t *respfeprx;
/// to signal end of feptx
notifiedFIFO_t *respfeptx;
notifiedFIFO_t *resprurx;
/// core id for RX fhaul (IF5 ECPRI)
int rxfh_core_id;
/// core id for RX fhaul (IF5 ECPRI)
......
......@@ -374,6 +374,8 @@ typedef struct {
} prs_meas_t;
typedef struct {
uint16_t frame;
uint16_t slot;
uint16_t num_ant_ports; // Number of antenna ports N_SRS_ap [3GPP TS 38.211, Sec 6.4.1.4.1], Value: 0 = 1 port, 1 = 2 ports, 2 = 4 ports
uint16_t num_symbols; // Number of symbols N_SRS_symb [3GPP TS 38.211, Sec 6.4.1.4.1], Value: 0 = 1 symbol, 1 = 2 symbols, 2 = 4 symbols
uint16_t num_repetitions; // Repetition factor R [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 = 1, 1 = 2, 2 = 4
......
......@@ -880,7 +880,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
generate_srs_nr(srs_pdu, frame_parms, gNB->nr_srs_info[i]->srs_generated_signal, 0, gNB->nr_srs_info[i], AMP, frame_rx, slot_rx);
int srs_est = nr_get_srs_signal(gNB, frame_rx, slot_rx, srs_pdu, gNB->nr_srs_info[i], srs_received_signal);
static int log_first = 0;
if ((log_first == 0) && ((1<<srs_pdu->num_ant_ports)== 2))
//if ((log_first == 0) && ((1<<srs_pdu->num_ant_ports)== 2))
if (log_first == 0)
{
nr_cap_srs_signal(gNB, frame_rx, slot_rx, srs_pdu, gNB->nr_srs_info[i]);
log_first++;
......
......@@ -12,7 +12,6 @@
#include <inttypes.h>
#include <math.h>
#include "oxgrf_lib.h"
#include "common/utils/LOG/log.h"
/** @addtogroup _OXGRF_PHY_RF_INTERFACE_
* @{
......@@ -75,7 +74,7 @@ openair0_timestamp trx_get_timestamp(openair0_device *device) {
*/
int trx_oxgrf_start(openair0_device *device) {
LOG_I(HW, "[oxgrf] Start oxgrf ...\n");
printf( "[oxgrf] Start oxgrf ...\n");
running = true;
return 0;
......@@ -96,8 +95,9 @@ static int trx_oxgrf_write(openair0_device *device,openair0_timestamp timestamp,
oxgrf_state_t *oxgrf = (oxgrf_state_t*)device->priv;
#ifdef __GNUC__
__sync_fetch_and_add(&transmiting, 1);
//__sync_fetch_and_add(&transmiting, 1);
#endif
#if 0
#ifdef __AVX2__
__m256i a, *b;
int len = nsamps * 2;
......@@ -129,15 +129,15 @@ static int trx_oxgrf_write(openair0_device *device,openair0_timestamp timestamp,
iq++;
len--;
}
#endif
status = oxgrf_write_samples_multiport(oxgrf->dev, (const void **)buff, nsamps, channel_to_mask(oxgrf->tx_num_channels), timestamp, 0);
if (status < 0) {
oxgrf->num_tx_errors++;
LOG_E(HW, "[oxgrf] Failed to TX samples\n");
printf("[oxgrf] Failed to TX samples\n");
exit(-1);
}
#ifdef __GNUC__
__sync_fetch_and_sub(&transmiting, 1);
//__sync_fetch_and_sub(&transmiting, 1);
#endif
//LOG_D(HW, "Provided TX timestamp: %u, nsamps: %u\n", ptimestamp, nsamps);
......@@ -166,9 +166,9 @@ static int trx_oxgrf_read(openair0_device *device, openair0_timestamp *ptimestam
uint64_t timestamp = 0L;
#ifdef __GNUC__
__sync_fetch_and_add(&recving, 1);
//__sync_fetch_and_add(&recving, 1);
#endif
#if 0
if(remain == 0) {
int recv = 0;
if(nsamps % RX_MTU)
......@@ -178,7 +178,7 @@ static int trx_oxgrf_read(openair0_device *device, openair0_timestamp *ptimestam
timestamp = 0L;
status = oxgrf_read_samples_multiport(oxgrf->dev, iq_buf, recv, channel_to_mask(oxgrf->rx_num_channels), &timestamp);
if (status < 0) {
LOG_E(HW, "[oxgrf] Failed to read samples %d\n", nsamps);
printf("[oxgrf] Failed to read samples %d\n", nsamps);
oxgrf->num_rx_errors++;
exit(-1);
}
......@@ -212,7 +212,7 @@ static int trx_oxgrf_read(openair0_device *device, openair0_timestamp *ptimestam
timestamp = 0L;
status = oxgrf_read_samples_multiport(oxgrf->dev, iq_buf, recv, channel_to_mask(oxgrf->rx_num_channels), &timestamp);
if (status < 0) {
LOG_E(HW, "[oxgrf] Failed to read samples %d\n", nsamps);
printf("[oxgrf] Failed to read samples %d\n", nsamps);
oxgrf->num_rx_errors++;
exit(-1);
}
......@@ -235,7 +235,17 @@ static int trx_oxgrf_read(openair0_device *device, openair0_timestamp *ptimestam
}
#ifdef __GNUC__
__sync_fetch_and_sub(&recving, 1);
//__sync_fetch_and_sub(&recving, 1);
#endif
#else
timestamp = 0;
status = oxgrf_read_samples_multiport(oxgrf->dev, buff, nsamps, channel_to_mask(oxgrf->rx_num_channels), &timestamp);
if (status < 0) {
printf("[oxgrf] Failed to read samples %d\n", nsamps);
oxgrf->num_rx_errors++;
exit(-1);
}
*ptimestamp = (openair0_timestamp)timestamp;
#endif
//LOG_D(HW, "Current RX timestamp %"PRIu64", nsamps %u\n", *ptimestamp, nsamps);
oxgrf->rx_nsamps += nsamps;
......@@ -261,13 +271,13 @@ void trx_oxgrf_end(openair0_device *device) {
__sync_and_and_fetch(&transmiting, 1))
usleep(50000);
#endif
LOG_I(HW, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
uint32_t count = 0;
oxgrf_get_channel_event(oxgrf->dev, TX_CHANNEL_TIMEOUT, 1, &count);
LOG_I(HW, "[oxgrf] TX%d Channel timeout: %u\n", 1, count);
printf("[oxgrf] TX%d Channel timeout: %u\n", 1, count);
oxgrf_get_channel_event(oxgrf->dev, RX_CHANNEL_OVERFLOW, 1, &count);
LOG_I(HW, "[oxgrf] RX%d Channel overflow: %u\n", 1, count);
LOG_I(HW, "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
printf("[oxgrf] RX%d Channel overflow: %u\n", 1, count);
printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
oxgrf_close_device(oxgrf->dev);
//exit(1);
......@@ -304,21 +314,21 @@ int trx_oxgrf_stop(openair0_device* device) {
* \param exmimo_dump_config (ignored)
* \returns 0 in success
*/
int trx_oxgrf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1,int exmimo_dump_config) {
int trx_oxgrf_set_freq(openair0_device* device, openair0_config_t *openair0_cfg1) {
int status;
oxgrf_state_t *oxgrf = (oxgrf_state_t *)device->priv;
openair0_config_t *openair0_cfg = (openair0_config_t *)device->openair0_cfg;
if ((status = oxgrf_set_tx_lo_freq(oxgrf->dev, 0, (uint64_t)(openair0_cfg->tx_freq[0]))) < 0) {
LOG_E(HW, "[oxgrf] Failed to set TX frequency\n");
printf("[oxgrf] Failed to set TX frequency\n");
} else
LOG_I(HW, "[oxgrf] set TX frequency to %lu\n",(uint64_t)(openair0_cfg->tx_freq[0]));
printf("[oxgrf] set TX frequency to %lu\n",(uint64_t)(openair0_cfg->tx_freq[0]));
if ((status = oxgrf_set_rx_lo_freq(oxgrf->dev, 0, (uint64_t)(openair0_cfg->rx_freq[0]))) < 0) {
LOG_E(HW, "[oxgrf] Failed to set RX frequency\n");
printf("[oxgrf] Failed to set RX frequency\n");
} else
LOG_I(HW, "[oxgrf] set RX frequency to %lu\n",(uint64_t)(openair0_cfg->rx_freq[0]));
printf("[oxgrf] set RX frequency to %lu\n",(uint64_t)(openair0_cfg->rx_freq[0]));
return(0);
......@@ -335,34 +345,34 @@ int trx_oxgrf_set_gains(openair0_device* device, openair0_config_t *openair0_cfg
oxgrf_state_t *oxgrf = (oxgrf_state_t *)device->priv;
if (openair0_cfg->rx_gain[0] > 65+openair0_cfg->rx_gain_offset[0]) {
LOG_E(HW, "[oxgrf] Reduce RX Gain 0 by %f dB\n", openair0_cfg->rx_gain[0] - openair0_cfg->rx_gain_offset[0] - 65);
printf("[oxgrf] Reduce RX Gain 0 by %f dB\n", openair0_cfg->rx_gain[0] - openair0_cfg->rx_gain_offset[0] - 65);
return -1;
}
if ((ret = oxgrf_set_rx1_rf_gain(oxgrf->dev, 0, (uint32_t)(openair0_cfg->rx_gain[0] > 65?65:openair0_cfg->rx_gain[0]))) < 0) {
LOG_I(HW, "[oxgrf] Failed to set RX1 gain\n");
printf("[oxgrf] Failed to set RX1 gain\n");
} else
LOG_I(HW, "[oxgrf] set RX1 gain to %u\n",(uint32_t)(openair0_cfg->rx_gain[0]));
printf("[oxgrf] set RX1 gain to %u\n",(uint32_t)(openair0_cfg->rx_gain[0]));
if(oxgrf->rx_num_channels > 1) {
if ((ret = oxgrf_set_rx2_rf_gain(oxgrf->dev, 0, (uint32_t)(openair0_cfg->rx_gain[1] > 65?65:openair0_cfg->rx_gain[1]))) < 0) {
LOG_E(HW, "[oxgrf] Failed to set RX2 gain\n");
printf("[oxgrf] Failed to set RX2 gain\n");
} else
LOG_I(HW, "[oxgrf] set RX gain to %u\n",(uint32_t)(openair0_cfg->rx_gain[1]));
printf("[oxgrf] set RX gain to %u\n",(uint32_t)(openair0_cfg->rx_gain[1]));
}
int tx_gain = ((uint32_t)openair0_cfg->tx_gain[0] > 90?90:(uint32_t)openair0_cfg->tx_gain[0]);
if ((ret = oxgrf_set_tx1_attenuation(oxgrf->dev, 0, (90 - tx_gain) * 1000)) < 0) {
LOG_E(HW, "[oxgrf] Failed to set TX1 gain\n");
printf("[oxgrf] Failed to set TX1 gain\n");
} else
LOG_I(HW, "[oxgrf] set the TX1 gain to %d\n", (uint32_t)openair0_cfg->tx_gain[0]);
printf("[oxgrf] set the TX1 gain to %d\n", (uint32_t)openair0_cfg->tx_gain[0]);
if(oxgrf->tx_num_channels > 1) {
tx_gain = ((uint32_t)openair0_cfg->tx_gain[1] > 90?90:(uint32_t)openair0_cfg->tx_gain[1]);
if ((ret = oxgrf_set_tx2_attenuation(oxgrf->dev, 0, (90 - tx_gain) * 1000)) < 0) {
LOG_E(HW, "[oxgrf] Failed to set TX2 gain\n");
printf("[oxgrf] Failed to set TX2 gain\n");
} else
LOG_I(HW, "[oxgrf] set the TX2 gain to %d\n", (uint32_t)openair0_cfg->tx_gain[1]);
printf("[oxgrf] set the TX2 gain to %d\n", (uint32_t)openair0_cfg->tx_gain[1]);
}
return(ret);
......@@ -378,12 +388,17 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
int status;
oxgrf_state_t *oxgrf = (oxgrf_state_t*)malloc(sizeof(oxgrf_state_t));
memset(oxgrf, 0, sizeof(oxgrf_state_t));
LOG_I(HW, "[oxgrf] openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs);
LOG_I(HW, "[oxgrf] openair0_cfg[0].rx_num_channels == '%d'\n", openair0_cfg[0].rx_num_channels);
LOG_I(HW, "[oxgrf] openair0_cfg[0].tx_num_channels == '%d'\n", openair0_cfg[0].tx_num_channels);
memset(oxgrf, 0, sizeof(oxgrf_state_t));
printf("[oxgrf] openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs);
printf("[oxgrf] openair0_cfg[0].rx_num_channels == '%d'\n", openair0_cfg[0].rx_num_channels);
printf("[oxgrf] openair0_cfg[0].tx_num_channels == '%d'\n", openair0_cfg[0].tx_num_channels);
printf("[oxgrf] oxgrf->sample_rate == '%d'\n", oxgrf->sample_rate);
printf("[oxgrf] openair0_cfg->sample_rate == '%f'\n", openair0_cfg->sample_rate);
oxgrf->sample_rate = (unsigned int)openair0_cfg->sample_rate;
oxgrf->sample_rate = 30720000;
// return 0;
// init required params
switch ((int)openair0_cfg->sample_rate) {
case 122880000:
......@@ -423,15 +438,14 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
openair0_cfg[0].rx_bw = 1.25e6;
break;
default:
LOG_I(HW, "[oxgrf] Error: unknown sampling rate %f\n", openair0_cfg->sample_rate);
printf("[oxgrf] Error: unknown sampling rate %f\n", openair0_cfg->sample_rate);
free(oxgrf);
exit(-1);
break;
}
//openair0_cfg->iq_txshift = 2;
//openair0_cfg->iq_rxrescale = 14; /*not sure*/ //FIXME: adjust to oxgrf
oxgrf->sample_rate = (unsigned int)openair0_cfg->sample_rate;
LOG_I(HW, "[oxgrf] sampling_rate %d\n", oxgrf->sample_rate);
printf("[oxgrf] sampling_rate %d\n", oxgrf->sample_rate);
oxgrf->rx_num_channels = openair0_cfg[0].rx_num_channels;
oxgrf->tx_num_channels = openair0_cfg[0].tx_num_channels;
......@@ -450,7 +464,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
copy_subdev_string(dev_str, dev_ptr + strlen(dev_arg));
remove_substring(args, dev_arg);
remove_substring(args, dev_str);
LOG_I(HW, "[oxgrf] Using %s\n", dev_str);
printf("[oxgrf] Using %s\n", dev_str);
}
const char auxdac1_arg[] = "auxdac1=";
......@@ -461,31 +475,32 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
remove_substring(args, auxdac1_arg);
remove_substring(args, auxdac1_str);
auxdac1 = atoi(auxdac1_str);
LOG_I(HW, "[oxgrf] Setting auxdac1:%u\n", auxdac1);
printf("[oxgrf] Setting auxdac1:%u\n", auxdac1);
}
if ((oxgrf->dev = oxgrf_open_device(dev_str)) == NULL ) {
LOG_E(HW, "[oxgrf] Failed to open oxgrf\n");
//if ((oxgrf->dev = oxgrf_open_device(dev_str)) == NULL ) {
if ((oxgrf->dev = oxgrf_open_device("pciex:0,nsamples_recv_frame:7680")) == NULL ) {
printf("[oxgrf] Failed to open oxgrf\n");
free(oxgrf);
return -1;
}
LOG_I(HW, "[oxgrf] Initializing openair0_device\n");
printf("[oxgrf] Initializing openair0_device\n");
switch (openair0_cfg[0].clock_source) {
case external:
LOG_I(HW, "[oxgrf] clock_source: external\n");
printf("[oxgrf] clock_source: external\n");
oxgrf_set_ref_clock (oxgrf->dev, 0, EXTERNAL_REFERENCE);
oxgrf_set_pps_select (oxgrf->dev, 0, PPS_EXTERNAL_EN);
break;
case gpsdo:
LOG_I(HW, "[oxgrf] clock_source: gpsdo\n");
printf("[oxgrf] clock_source: gpsdo\n");
break;
case internal:
default:
oxgrf_set_ref_clock (oxgrf->dev, 0, INTERNAL_REFERENCE);
oxgrf_set_pps_select (oxgrf->dev, 0, PPS_INTERNAL_EN);
//oxgrf_set_vco_select (oxgrf->dev, 0, AUXDAC1);
LOG_I(HW, "[oxgrf] clock_source: internal\n");
printf("[oxgrf] clock_source: internal\n");
break;
}
oxgrf_set_auxdac1 (oxgrf->dev, 0, auxdac1);
......@@ -497,68 +512,68 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
// RX port Initialize
if ((status = oxgrf_set_rx_lo_freq(oxgrf->dev, 0, (uint64_t)(openair0_cfg->rx_freq[0]))) < 0) {
LOG_E(HW, "[oxgrf] Failed to set RX frequency\n");
printf("[oxgrf] Failed to set RX frequency\n");
} else
LOG_I(HW, "[oxgrf] set RX frequency to %lu\n",(uint64_t)(openair0_cfg->rx_freq[0]));
printf("[oxgrf] set RX frequency to %lu\n",(uint64_t)(openair0_cfg->rx_freq[0]));
if ((status = oxgrf_set_rx_sampling_freq(oxgrf->dev, 0, (uint32_t)(openair0_cfg->sample_rate))) < 0) {
LOG_E(HW, "[oxgrf] Failed to set RX sample rate\n");
printf("[oxgrf] Failed to set RX sample rate\n");
} else
LOG_I(HW, "[oxgrf] set RX sample rate to %u\n", (uint32_t)(openair0_cfg->sample_rate));
printf("[oxgrf] set RX sample rate to %u\n", (uint32_t)(openair0_cfg->sample_rate));
if ((status = oxgrf_set_rx_rf_bandwidth(oxgrf->dev, 0, (uint32_t)(openair0_cfg->rx_bw))) < 0) {
LOG_E(HW, "[oxgrf] Failed to set RX bandwidth\n");
printf("[oxgrf] Failed to set RX bandwidth\n");
} else
LOG_I(HW, "[oxgrf] set RX bandwidth to %u\n",(uint32_t)(openair0_cfg->rx_bw));
printf("[oxgrf] set RX bandwidth to %u\n",(uint32_t)(openair0_cfg->rx_bw));
if ((status = oxgrf_set_rx1_gain_control_mode(oxgrf->dev, 0, 0)) < 0){
LOG_E(HW, "[oxgrf] Failed to set RX1 Gain Control Mode\n");
printf("[oxgrf] Failed to set RX1 Gain Control Mode\n");
} else
LOG_I(HW, "[oxgrf] set RX1 Gain Control Mode MGC\n");
printf("[oxgrf] set RX1 Gain Control Mode MGC\n");
if ((status = oxgrf_set_rx1_rf_gain(oxgrf->dev, 0, (uint32_t)(openair0_cfg->rx_gain[0] > 65?65:openair0_cfg->rx_gain[0]))) < 0) {
LOG_I(HW, "[oxgrf] Failed to set RX1 gain\n");
printf("[oxgrf] Failed to set RX1 gain\n");
} else
LOG_I(HW, "[oxgrf] set RX1 gain to %u\n",(uint32_t)(openair0_cfg->rx_gain[0]));
printf("[oxgrf] set RX1 gain to %u\n",(uint32_t)(openair0_cfg->rx_gain[0]));
if(oxgrf->rx_num_channels > 1) {
if ((status = oxgrf_set_rx2_gain_control_mode(oxgrf->dev, 0, 0)) < 0){
LOG_E(HW, "[oxgrf] Failed to set RX2 Gain Control Mode\n");
printf("[oxgrf] Failed to set RX2 Gain Control Mode\n");
} else
LOG_I(HW, "[oxgrf] set RX2 Gain Control Mode MGC\n");
printf("[oxgrf] set RX2 Gain Control Mode MGC\n");
if ((status = oxgrf_set_rx2_rf_gain(oxgrf->dev, 0, (uint32_t)(openair0_cfg->rx_gain[1] > 65?65:openair0_cfg->rx_gain[1]))) < 0) {
LOG_E(HW, "[oxgrf] Failed to set RX2 gain\n");
printf("[oxgrf] Failed to set RX2 gain\n");
} else
LOG_I(HW, "[oxgrf] set RX2 gain to %u\n",(uint32_t)(openair0_cfg->rx_gain[1]));
printf("[oxgrf] set RX2 gain to %u\n",(uint32_t)(openair0_cfg->rx_gain[1]));
}
// TX port Initialize
if ((status = oxgrf_set_tx_lo_freq(oxgrf->dev, 0, (uint64_t)openair0_cfg->tx_freq[0])) < 0) {
LOG_E(HW, "[oxgrf] Failed to set TX frequency\n");
printf("[oxgrf] Failed to set TX frequency\n");
} else
LOG_I(HW, "[oxgrf] set TX Frequency to %lu\n", (uint64_t)openair0_cfg->tx_freq[0]);
printf("[oxgrf] set TX Frequency to %lu\n", (uint64_t)openair0_cfg->tx_freq[0]);
if ((status = oxgrf_set_tx_sampling_freq(oxgrf->dev, 0, (uint32_t)openair0_cfg->sample_rate)) < 0) {
LOG_E(HW, "[oxgrf] Failed to set TX sample rate\n");
printf("[oxgrf] Failed to set TX sample rate\n");
} else
LOG_I(HW, "[oxgrf] set TX sampling rate to %u\n", (uint32_t)openair0_cfg->sample_rate);
printf("[oxgrf] set TX sampling rate to %u\n", (uint32_t)openair0_cfg->sample_rate);
if ((status = oxgrf_set_tx_rf_bandwidth(oxgrf->dev, 0, (uint32_t)openair0_cfg->tx_bw)) <0) {
LOG_E(HW, "[oxgrf] Failed to set TX bandwidth\n");
printf("[oxgrf] Failed to set TX bandwidth\n");
} else
LOG_I(HW, "[oxgrf] set TX bandwidth to %u\n", (uint32_t)openair0_cfg->tx_bw);
printf("[oxgrf] set TX bandwidth to %u\n", (uint32_t)openair0_cfg->tx_bw);
int tx_gain = ((uint32_t)openair0_cfg->tx_gain[0] > 90?90:(uint32_t)openair0_cfg->tx_gain[0]);
if ((status = oxgrf_set_tx1_attenuation(oxgrf->dev, 0, (90 - tx_gain) * 1000)) < 0) {
LOG_E(HW, "[oxgrf] Failed to set TX1 gain\n");
printf("[oxgrf] Failed to set TX1 gain\n");
} else
LOG_I(HW, "[oxgrf] set the TX1 gain to %d\n", (uint32_t)openair0_cfg->tx_gain[0]);
printf("[oxgrf] set the TX1 gain to %d\n", (uint32_t)openair0_cfg->tx_gain[0]);
if(oxgrf->tx_num_channels > 1) {
tx_gain = ((uint32_t)openair0_cfg->tx_gain[1] > 90?90:(uint32_t)openair0_cfg->tx_gain[1]);
if ((status = oxgrf_set_tx2_attenuation(oxgrf->dev, 0, (90 - tx_gain) * 1000)) < 0) {
LOG_E(HW, "[oxgrf] Failed to set TX2 gain\n");
printf("[oxgrf] Failed to set TX2 gain\n");
} else
LOG_I(HW, "[oxgrf] set the TX2 gain to %d\n", (uint32_t)openair0_cfg->tx_gain[1]);
printf("[oxgrf] set the TX2 gain to %d\n", (uint32_t)openair0_cfg->tx_gain[1]);
}
oxgrf_enable_timestamp(oxgrf->dev, 0, 0);
......@@ -568,12 +583,12 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
for(int i = 0; i < NCHAN_PER_DEV; i++) {
int ret = posix_memalign((void **)&cache_buf[i], 4096, BUFFER_SIZE);
if(ret) {
LOG_I(HW, "Failed to alloc memory\n");
printf("Failed to alloc memory\n");
return -1;
}
ret = posix_memalign((void **)&iq_buf[i], 4096, BUFFER_SIZE);
if(ret) {
LOG_I(HW, "Failed to alloc memory\n");
printf("Failed to alloc memory\n");
return -1;
}
}
......
Active_gNBs = ( "gNB-OAI");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
gNBs =
(
{
////////// Identification parameters:
gNB_ID = 0xe00;
gNB_name = "gNB-OAI";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 100;
plmn_list = ({
mcc = 466;
mnc = 92;
mnc_length = 2;
snssaiList = (
{
sst = 1;
}
);
});
nr_cellid = 12345678L;
////////// Physical parameters:
sib1_tda = 15;
min_rxtxtime = 6;
pdsch_AntennaPorts_XP = 1;
pusch_AntennaPorts = 2;
do_CSIRS = 1;
do_SRS = 1;
ul_prbblacklist = "135,136,137,138"
pdcch_ConfigSIB1 = (
{
controlResourceSetZero = 12;
searchSpaceZero = 10;
}
);
servingCellConfigCommon = (
{
#spCellConfigCommon
physCellId = 0;
# downlinkConfigCommon
#frequencyInfoDL
# this is 3300.24 + 134*12*30e3 = 3348.48 MHz (5G NR GSCN: 7741)
absoluteFrequencySSB = 623232; #652608;
dl_frequencyBand = 78;
# this is 3300.24 MHz
dl_absoluteFrequencyPointA = 620016; #651280;
#scs-SpecificCarrierList
dl_offstToCarrier = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_subcarrierSpacing = 1;
dl_carrierBandwidth = 273;
#initialDownlinkBWP
#genericParameters
# this is RBstart=0,L=162 (275*(275-L+1))+(274-RBstart))
initialDLBWPlocationAndBandwidth = 1099;
#
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
#pdcch-ConfigCommon
initialDLBWPcontrolResourceSetZero = 12;
initialDLBWPsearchSpaceZero = 10;
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 78;
#scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_subcarrierSpacing = 1;
ul_carrierBandwidth = 273;
pMax = 20;
#initialUplinkBWP
#genericParameters
initialULBWPlocationAndBandwidth = 1099;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
#rach-ConfigCommon
#rach-ConfigGeneric
prach_ConfigurationIndex = 98;
#prach_msg1_FDM
#0 = one, 1=two, 2=four, 3=eight
prach_msg1_FDM = 0;
prach_msg1_FrequencyStart = 0;
zeroCorrelationZoneConfig = 12;
preambleReceivedTargetPower = -90;
#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
preambleTransMax = 6;
#powerRampingStep
# 0=dB0,1=dB2,2=dB4,3=dB6
powerRampingStep = 1;
#ra_ReponseWindow
#1,2,4,8,10,20,40,80
ra_ResponseWindow = 4;
#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3;
#oneHalf (0..15) 4,8,12,16,...60,64
ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15;
#ra_ContentionResolutionTimer
#(0..7) 8,16,24,32,40,48,56,64
ra_ContentionResolutionTimer = 7;
rsrp_ThresholdSSB = 19;
#prach-RootSequenceIndex_PR
#1 = 839, 2 = 139
prach_RootSequenceIndex_PR = 2;
prach_RootSequenceIndex = 1;
# SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
#
msg1_SubcarrierSpacing = 1,
# restrictedSetConfig
# 0=unrestricted, 1=restricted type A, 2=restricted type B
restrictedSetConfig = 0,
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
# pucch-ConfigCommon setup :
# pucchGroupHopping
# 0 = neither, 1= group hopping, 2=sequence hopping
pucchGroupHopping = 0;
hoppingId = 40;
p0_nominal = -70;
# ssb_PositionsInBurs_BitmapPR
# 1=short, 2=medium, 3=long
ssb_PositionsInBurst_PR = 2;
ssb_PositionsInBurst_Bitmap = 1;
# ssb_periodicityServingCell
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
ssb_periodicityServingCell = 2;
# dmrs_TypeA_position
# 0 = pos2, 1 = pos3
dmrs_TypeA_Position = 0;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
subcarrierSpacing = 1;
#tdd-UL-DL-ConfigurationCommon
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
referenceSubcarrierSpacing = 1;
# pattern1
# dl_UL_TransmissionPeriodicity
# 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
dl_UL_TransmissionPeriodicity = 6;
nrofDownlinkSlots = 7;
nrofDownlinkSymbols = 6;
nrofUplinkSlots = 2;
nrofUplinkSymbols = 4;
ssPBCH_BlockPower = -25;
}
);
# Dedicated Serving Cell Configuration
servingCellConfigDedicated = ({
# BWP-Downlink
# BWP 1 Configuration
dl_bwp-Id_1 = 1;
dl_bwp1_locationAndBandwidth = 1099; // RBstart=0, L=273 (100 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
dl_bwp1_subcarrierSpacing = 1;
firstActiveDownlinkBWP-Id = 1; #BWP-Id
defaultDownlinkBWP-Id = 1; #BWP-Id
# bwp-InactivityTimer ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30,
# ms40,ms50, ms60, ms80,ms100, ms200,ms300, ms500,
# ms750, ms1280, ms1920, ms2560, spare10, spare9, spare8,
# spare7, spare6, spare5, spare4, spare3, spare2, spare1 }
# UplinkConfig
# BWP-Uplink
# BWP 1 Configuration
ul_bwp-Id_1 = 1;
ul_bwp1_locationAndBandwidth = 1099; // RBstart=0, L=273 (100 MHz BW)
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
ul_bwp1_subcarrierSpacing = 1;
firstActiveUplinkBWP-Id = 1; #BWP-Id
}
);
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// AMF parameters:
amf_ip_address = ( { ipv4 = "172.11.200.14";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
GNB_INTERFACE_NAME_FOR_NG_AMF = "docker-openxg";
GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.11.200.1";
GNB_INTERFACE_NAME_FOR_NGU = "docker-openxg";
GNB_IPV4_ADDRESS_FOR_NGU = "172.11.200.1";
GNB_PORT_FOR_S1U = 2152; # Spec 2152
};
}
);
MACRLCs = (
{
num_cc = 1;
tr_s_preference = "local_L1";
tr_n_preference = "local_RRC";
pusch_TargetSNRx10 = 150;
pucch_TargetSNRx10 = 200;
pusch_FailureThres = 1000;
ulsch_max_frame_inactivity = 0;
}
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
prach_dtx_threshold = 120;
pucch0_dtx_threshold = 80;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1;
nb_rx = 4;
att_tx = 85;
att_rx = 0;
bands = [78];
num_tp_cores = 8;
max_pdschReferenceSignalPower = -27;
max_rxgain = 45;
eNB_instances = [0];
##beamforming 1x2 matrix: 1 layer x 2 antennas
#bf_weights = [0x00007fff, 0x0000];
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
sdr_addrs = "dev=pciex:0,auxdac1=1660";
clock_src = "internal";
}
);
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_RU_L1_TRX_SPLIT";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";
};
security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
# valid values: nia0, nia1, nia2, nia3
integrity_algorithms = ( "nia2", "nia0" );
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="info";
pdcp_log_level ="info";
rrc_log_level ="info";
ngap_log_level ="debug";
f1ap_log_level ="debug";
};
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