Commit c2d948a0 authored by rmagueta's avatar rmagueta

Implementation of the remaining procedures until call the new PHY function nr_get_srs_signal at gNB

parent 9551cf4a
......@@ -1804,6 +1804,7 @@ set(PHY_SRC_UE
${PHY_SMALLBLOCKSRC}
${PHY_NR_CODINGIF}
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/pucch_rx.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/srs_rx.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_uci_tools_common.c
)
set(PHY_NR_UE_SRC
......
......@@ -546,6 +546,12 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i);
}
for (int i=0; i<NUMBER_OF_NR_SRS_MAX; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffers for SRS %d/%d\n",i,NUMBER_OF_NR_SRS_MAX);
gNB->srs[i] = new_gNB_srs();
AssertFatal(gNB->srs[i]!=NULL,"Can't initialize srs %d \n", i);
}
for (int i=0; i<gNB->number_of_nr_ulsch_max; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max);
......
......@@ -310,6 +310,14 @@ int nr_find_pucch(uint16_t rnti,
int slot,
PHY_VARS_gNB *gNB);
NR_gNB_SRS_t *new_gNB_srs(void);
void nr_fill_srs(PHY_VARS_gNB *gNB,
int frame,
int slot,
nfapi_nr_srs_pdu_t *srs_pdu);
void nr_get_srs_signal(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_srs_pdu_t *srs_pdu);
void init_prach_list(PHY_VARS_gNB *gNB);
void init_prach_ru_list(RU_t *ru);
......
/*
* 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
*/
/*! \file PHY/NR_TRANSPORT/srs_rx.c
* \brief Top-level routines for getting the SRS physical channel
* \date 2021
* \version 1.0
*/
#include<stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include "PHY/impl_defs_nr.h"
#include "PHY/defs_nr_common.h"
#include "PHY/defs_gNB.h"
#include <openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h>
#include "common/utils/LOG/log.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "T.h"
NR_gNB_SRS_t *new_gNB_srs(void){
NR_gNB_SRS_t *srs;
srs = (NR_gNB_SRS_t *)malloc16(sizeof(NR_gNB_SRS_t));
srs->active = 0;
return (srs);
}
int nr_find_srs(uint16_t rnti,
int frame,
int slot,
PHY_VARS_gNB *gNB) {
AssertFatal(gNB!=NULL,"gNB is null\n");
int index = -1;
for (int i=0; i<NUMBER_OF_NR_SRS_MAX; i++) {
AssertFatal(gNB->srs[i]!=NULL,"gNB->srs[%d] is null\n",i);
if ((gNB->srs[i]->active >0) &&
(gNB->srs[i]->srs_pdu.rnti==rnti) &&
(gNB->srs[i]->frame==frame) &&
(gNB->srs[i]->slot==slot)) return(i);
else if ((gNB->srs[i]->active == 0) && (index==-1)) index=i;
}
if (index==-1)
LOG_E(MAC,"SRS list is full\n");
return(index);
}
void nr_fill_srs(PHY_VARS_gNB *gNB,
int frame,
int slot,
nfapi_nr_srs_pdu_t *srs_pdu) {
int id = nr_find_srs(srs_pdu->rnti,frame,slot,gNB);
AssertFatal( (id>=0) && (id<NUMBER_OF_NR_SRS_MAX),
"invalid id found for srs !!! rnti %04x id %d\n",srs_pdu->rnti,id);
NR_gNB_SRS_t *srs = gNB->srs[id];
srs->frame = frame;
srs->slot = slot;
srs->active = 1;
memcpy((void*)&srs->srs_pdu, (void*)srs_pdu, sizeof(nfapi_nr_srs_pdu_t));
}
void nr_get_srs_signal(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_srs_pdu_t *srs_pdu) {
LOG_W(NR_PHY, "(%d.%d) nr_get_srs_signal is not implemented yet!\n", frame,slot);
}
\ No newline at end of file
......@@ -411,6 +411,16 @@ typedef struct {
nfapi_nr_pucch_pdu_t pucch_pdu;
} NR_gNB_PUCCH_t;
typedef struct {
uint8_t active;
/// Frame where current SRS pdu was received
uint32_t frame;
/// Slot where current SRS pdu was received
uint32_t slot;
/// ULSCH PDU
nfapi_nr_srs_pdu_t srs_pdu;
} NR_gNB_SRS_t;
typedef struct {
/// \brief Pointers (dynamic) to the received data in the time domain.
/// - first index: rx antenna [0..nb_antennas_rx[
......@@ -770,6 +780,7 @@ typedef struct PHY_VARS_gNB_s {
NR_gNB_PRACH prach_vars;
NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX];
NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX];
NR_gNB_SRS_t *srs[NUMBER_OF_NR_SRS_MAX];
NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams
......
......@@ -231,6 +231,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
break;
case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
nr_fill_srs(gNB,UL_tti_req->SFN, UL_tti_req->Slot, &UL_tti_req->pdus_list[i].srs_pdu);
break;
}
}
......
......@@ -797,6 +797,19 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
}
}
}
for (int i=0;i<NUMBER_OF_NR_SRS_MAX;i++) {
NR_gNB_SRS_t *srs = gNB->srs[i];
if (srs) {
if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) {
LOG_D(NR_PHY, "(%d.%d) gNB is waiting for SRS, id = %i\n", frame_rx, slot_rx, i);
nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu;
nr_get_srs_signal(gNB,frame_rx,slot_rx,srs_pdu);
srs->active = 0;
}
}
}
stop_meas(&gNB->phy_proc_rx);
// figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS
if ((frame_rx&127) == 0 && slot_rx==19) {
......
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