Commit b2e49fd0 authored by Jacques's avatar Jacques

nr ue : integration pucch_uci and unit tests

parent bf674468
Pipeline #10188 failed with stage
in 0 seconds
......@@ -176,7 +176,8 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
# these changes are related to hardcoded path to include .h files
add_definitions(-DCMAKER)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
#set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
set(GIT_BRANCH "UNKNOWN")
......@@ -435,7 +436,6 @@ execute_process(COMMAND mkdir -p ${S1AP_C_DIR}
COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
......@@ -451,7 +451,6 @@ add_custom_command (
DEPENDS ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
)
add_library(S1AP_LIB
${S1AP_source}
${S1AP_DIR}/s1ap_common.c
......@@ -1045,6 +1044,17 @@ set(SCHED_SRC_UE
)
add_library(SCHED_UE_LIB ${SCHED_SRC_UE})
set(SCHED_SRC_NR_UE
${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c
# ${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_common_ue.c
${OPENAIR1_DIR}/SCHED_NR_UE/fapi_nr_ue_l1.c
${OPENAIR1_DIR}/SCHED_NR_UE/phy_frame_config_nr.c
${OPENAIR1_DIR}/SCHED_NR_UE/harq_nr.c
${OPENAIR1_DIR}/SCHED_NR_UE/pucch_uci_ue_nr.c
${OPENAIR1_DIR}/SCHED_NR_UE/pucch_power_control_ue_nr.c
)
add_library(SCHED_NR_UE_LIB ${SCHED_SRC_NR_UE})
# nFAPI
#################################
set(NFAPI_COMMON_SRC
......@@ -1282,6 +1292,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/TOOLS/lut.c
${PHY_POLARSRC}
)
set(PHY_NR_UE_SRC
# depend on code generation from asn1c
${RRC_FULL_DIR}/asn1_constants.h
......@@ -1315,12 +1326,10 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
${OPENAIR1_DIR}/PHY/TOOLS/lut.c
${OPENAIR1_DIR}/PHY/INIT/nr_init_ue.c
${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c
#${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_common_ue.c
${OPENAIR1_DIR}/SCHED_NR_UE/fapi_nr_ue_l1.c
${PHY_POLARSRC}
)
if (${SMBV})
set(PHY_SRC "${PHY_SRC} ${OPENAIR1_DIR}/PHY/TOOLS/smbv.c")
endif (${SMBV})
......@@ -1518,6 +1527,7 @@ add_library(L2
add_library(L2_UE
${L2_SRC_UE}
${MAC_SRC_UE}
${MAC_NR_SRC_UE}
)
add_library( NR_L2_UE
......@@ -2249,7 +2259,6 @@ add_executable(nr-softmodem-nos1
${OPENAIR_TARGETS}/RT/USER/nr-gnb.c
${OPENAIR_TARGETS}/RT/USER/nr-ru.c
${OPENAIR_TARGETS}/RT/USER/nr-softmodem.c
${OPENAIR_TARGETS}/COMMON/create_nr_tasks.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
......@@ -2305,7 +2314,7 @@ add_executable(nr-uesoftmodem
target_link_libraries (nr-uesoftmodem
-Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_NR_UE PHY_COMMON PHY_UE PHY_RU LFDS NR_L2_UE
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_NR_UE PHY_COMMON PHY_UE PHY_RU LFDS NR_L2_UE
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
-Wl,--end-group z dl)
......@@ -2340,7 +2349,7 @@ add_executable(nr-uesoftmodem-nos1
target_link_libraries (nr-uesoftmodem-nos1
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_NR_UE PHY_COMMON PHY_UE PHY_RU LFDS L2_UE
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB PHY_NR_UE PHY_COMMON PHY_UE PHY_RU LFDS L2_UE
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
-Wl,--end-group z dl)
......
......@@ -164,6 +164,7 @@ typedef struct {
nfapi_uint16_tlv_t p0_nominal; ///// L1 parameter 'p0-nominal-pucch'
} nfapi_nr_pucch_config_t;
typedef struct {
//NR TDD-UL-DL-ConfigCommon ///// L1 parameter 'UL-DL-configuration-common'
nfapi_uint16_tlv_t referenceSubcarrierSpacing; ///// L1 parameter 'reference-SCS'
......@@ -199,7 +200,7 @@ typedef struct {
typedef struct {
nfapi_p4_p5_message_header_t header;
uint8_t num_tlv;
uint8_t num_tlv;
nfapi_nr_subframe_config_t subframe_config;
nfapi_nr_rf_config_t rf_config;
nfapi_nr_sch_config_t sch_config;
......
......@@ -49,7 +49,7 @@
//#define CIC_DECIMATOR /* it allows enabling decimation based on CIC filter. By default, decimation is based on a FIF filter */
#define TEST_SYNCHRO_TIMING_PSS (1) /* enable time profiling */
#define TEST_SYNCHRO_TIMING_PSS (1) /* enable time profiling */
//#define DBG_PSS_NR
......
......@@ -32,6 +32,7 @@
#ifndef SSS_NR_H
#define SSS_NR_H
#include "limits.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/types.h"
......@@ -46,7 +47,6 @@
/************** DEFINE ********************************************/
#define INT_MIN (-2147483647 - 1)
#define SAMPLES_IQ (sizeof(int16_t)*2)
#define NUMBER_SSS_SEQUENCE (336)
#define INVALID_SSS_SEQUENCE (NUMBER_SSS_SEQUENCE)
......
......@@ -4574,10 +4574,15 @@ int nr_extract_dci_info(PHY_VARS_NR_UE *ue,
// packet was actually decoded in previous transmission (ACK was missed by eNB)
// however, the round is not a good check as it might have been decoded in a retransmission prior to this one.
// skip pdsch decoding and report ack
pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.ack = 1;
pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.send_harq_status;
#if 0
pdlsch0->active = 0;
pdlsch0->harq_ack[nr_tti_rx].ack = 1;
pdlsch0->harq_ack[nr_tti_rx].harq_id = nr_pdci_info_extracted->harq_process_number;
pdlsch0->harq_ack[nr_tti_rx].send_harq_status = 1;
#endif
} else { // normal retransmission, nothing special to do
}
} else {
......@@ -4602,7 +4607,8 @@ int nr_extract_dci_info(PHY_VARS_NR_UE *ue,
// 2 if one serving cell is configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 bits are the counter DAI
// 0 otherwise
nr_pdci_info_extracted->dai = (uint8_t)(((((*(uint64_t *)dci_pdu) << (left_shift - dci_fields_sizes[dci_field][dci_format-15]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format-15]));
pdlsch0->harq_ack[nr_tti_rx].vDAI_DL = nr_pdci_info_extracted->dai+1;
pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.vDAI_DL = nr_pdci_info_extracted->dai+1;
//pdlsch0->harq_ack[nr_tti_rx].vDAI_DL = nr_pdci_info_extracted->dai+1;
#ifdef NR_PDCCH_DCI_TOOLS_DEBUG
printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->dai=%x\n",nr_pdci_info_extracted->dai);
#endif
......
......@@ -30,7 +30,6 @@
*
************************************************************************/
//#include "PHY/LTE_REFSIG/defs.h"
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
#include "PHY/NR_REFSIG/dmrs_nr.h"
......
......@@ -31,7 +31,9 @@
*/
#ifndef __NR_TRANSPORT_UE__H__
#define __NR_TRANSPORT_UE__H__
#include "PHY/defs_nr_UE.h"
#include <limits.h>
#include "PHY/impl_defs_top.h"
//#include "PHY/defs_nr_UE.h"
//#include "../LTE_TRANSPORT/dci.h"
//#include "../LTE_TRANSPORT/mdci.h"
//#include "../LTE_TRANSPORT/uci_common.h"
......@@ -48,7 +50,31 @@
* @{
*/
#define SHRT_MAX 32767
//#if defined(UPGRADE_RAT_NR)
#if 1
typedef struct {
/// HARQ process id
uint8_t harq_id;
/// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX
uint8_t ack;
/// send status (for PUCCH)
uint8_t send_harq_status;
/// nCCE (for PUCCH)
uint8_t nCCE;
/// DAI value detected from DCI1/1a/1b/1d/2/2a/2b/2c. 0xff indicates not touched
uint8_t vDAI_DL;
/// DAI value detected from DCI0/4. 0xff indicates not touched
uint8_t vDAI_UL;
/// allow to define pucch parameters TS 38.213 9.2.3 UE procedure for reporting HARQ-ACK
uint8_t pucch_resource_indicator;
/// slot on which feedback ack should be send to network
uint16_t slot_for_feedback_ack;
/// index of a first CCE for the PDCCH reception
uint8_t n_CCE;
/// number of CCEs in a control resource set of a PDCCH reception conveying DCI format 1_0
uint8_t N_CCE;
} NR_UE_HARQ_STATUS_t;
#endif
typedef struct {
/// Indicator of first transmission
......@@ -128,9 +154,15 @@ typedef struct {
/// Current Number of Symbols
uint8_t Nsymb_pusch;
/// SRS active flag
uint8_t srs_active;
/// Pointers to 8 HARQ processes for the ULSCH
NR_UL_UE_HARQ_t *harq_processes[8];
uint8_t srs_active;
//#if defined(UPGRADE_RAT_NR)
#if 1
// Pointers to HARQ processes for the ULSCH
NR_UL_UE_HARQ_t *harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES];
int harq_process_id[NR_MAX_SLOTS_PAR_FRAME];
// UL number of harq processes
uint8_t number_harq_processes_for_pusch;
#endif
/// Pointer to CQI data (+1 for 8 bits crc)
uint8_t o[1+MAX_CQI_BYTES];
/// Length of CQI data (bits)
......@@ -197,9 +229,6 @@ typedef struct {
uint8_t Mlimit;
} NR_UE_ULSCH_t;
typedef struct {
/// Indicator of first transmission
uint8_t first_tx;
......@@ -269,24 +298,10 @@ typedef struct {
uint32_t errors[8];
/// codeword this transport block is mapped to
uint8_t codeword;
/// HARQ-ACKs
NR_UE_HARQ_STATUS_t harq_ack;
} NR_DL_UE_HARQ_t;
typedef struct {
/// HARQ process id
uint8_t harq_id;
/// ACK bits (after decoding) 0:NACK / 1:ACK / 2:DTX
uint8_t ack;
/// send status (for PUCCH)
uint8_t send_harq_status;
/// nCCE (for PUCCH)
uint8_t nCCE;
/// DAI value detected from DCI1/1a/1b/1d/2/2a/2b/2c. 0xff indicates not touched
uint8_t vDAI_DL;
/// DAI value detected from DCI0/4. 0xff indicates not touched
uint8_t vDAI_UL;
} nr_harq_status_t;
typedef struct {
/// RNTI
uint16_t rnti;
......@@ -310,10 +325,17 @@ typedef struct {
uint32_t cqi_alloc2;
/// saved subband PMI allocation from last PUSCH/PUCCH report
uint16_t pmi_alloc;
/// HARQ-ACKs
nr_harq_status_t harq_ack[10];
/// Pointers to up to 8 HARQ processes
NR_DL_UE_HARQ_t *harq_processes[8];
//#if defined(UPGRADE_RAT_NR)
#if 1
/// Pointers to up to HARQ processes
NR_DL_UE_HARQ_t *harq_processes[NR_MAX_DLSCH_HARQ_PROCESSES];
// DL number of harq processes
uint8_t number_harq_processes_for_pdsch;
/* higher layer parameter for reception of two transport blocks TS 38.213 9.1.3.1 Type-2 HARQ-ACK codebook dtermination */
uint8_t Number_MCS_HARQ_DL_DCI;
/* spatial bundling of PUCCH */
uint8_t HARQ_ACK_spatial_bundling_PUCCH;
#endif
/// Maximum number of HARQ processes(for definition see 36-212 V8.6 2009-03, p.17
uint8_t Mdlharq;
/// MIMO transmission mode indicator for this sub-frame (for definition see 36-212 V8.6 2009-03, p.17)
......@@ -363,6 +385,13 @@ typedef struct {
dci_space_t search_space;
/// DCI pdu
uint8_t dci_pdu[8];
//#if defined(UPGRADE_RAT_NR)
#if 1
/// harq information
uint8_t harq_pid_pusch;
/// delay between current slot and slot to transmit
uint8_t number_slots_rx_to_tx;
#endif
} NR_DCI_ALLOC_t;
......
......@@ -669,24 +669,21 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int rate_change)
#endif
#if 1
synchro_position = pss_search_time_nr(rxdata,
frame_parms,
(int *)&PHY_vars_UE->common_vars.eNb_id);
#else
synchro_position = lte_sync_time(rxdata,
frame_parms,
(int *)&PHY_vars_UE->common_vars.eNb_id);
#endif
#if TEST_SYNCHRO_TIMING_PSS
stop_meas(&generic_time[TIME_PSS]);
printf("PSS execution duration %5.2f \n", generic_time[TIME_PSS].p_time/(cpuf*1000.0));
int duration_ms = generic_time[TIME_PSS].p_time/(cpuf*1000.0);
#ifndef NR_UNIT_TEST
printf("PSS execution duration %4d microseconds \n", duration_ms);
#endif
#endif
......@@ -855,7 +852,9 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
}
//#endif
#ifdef DEBUG_PHY
#ifdef DBG_PSS_NR
static debug_cnt = 0;
if (debug_cnt == 0) {
write_output("pss_corr_ue0.m","pss_corr_ue0",pss_corr_ue[0],length,1,2);
......
......@@ -181,7 +181,7 @@ void insert_sss_nr(int16_t *sss_time,
/* get sss in the frequency domain by applying an inverse FFT */
idft2048(synchroF_tmp, /* complex input */
synchro_tmp, /* complex output */
1); /* scaling factor */
1); /* scaling factor */
/* then get final sss in time */
for (unsigned int i=0; i<ofdm_symbol_size; i++) {
......@@ -305,8 +305,6 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
int32_t **rxdataF;
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
#if 1
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
pss_symbol = PSS_SYMBOL_NB; /* symbol position */
......@@ -361,46 +359,6 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
printf(" pss_rxF_ext [%d] %d %d at address %p\n", i, p2[2*i], p2[2*i+1], &p2[2*i]);
}
#endif
#else
/* same method as LTE implementation */
uint16_t rb,nb_rb = N_RB_SS_PBCH_BLOCK;
int rx_offset = frame_parms->ofdm_symbol_size - (LENGTH_SSS_NR/2);
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
pss_symbol = PSS_SYMBOL_NB;
sss_symbol = SSS_SYMBOL_NB;
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF;
pss_rxF = &rxdataF[aarx][(rx_offset + (pss_symbol*(frame_parms->ofdm_symbol_size)))];
sss_rxF = &rxdataF[aarx][(rx_offset + (sss_symbol*(frame_parms->ofdm_symbol_size)))];
//printf("extract_rbs: symbol_mod=%d, rx_offset=%d, ch_offset=%d\n",symbol_mod,
// (rx_offset + (symbol*(frame_parms->ofdm_symbol_size)))*2,
// LTE_CE_OFFSET+ch_offset+(symbol_mod*(frame_parms->ofdm_symbol_size)));
pss_rxF_ext = &pss_ext[aarx][0];
sss_rxF_ext = &sss_ext[aarx][0];
for (rb=0; rb<nb_rb; rb++) {
for (int i=0; i<N_SC_RB; i++) {
if (doPss) {pss_rxF_ext[i] = pss_rxF[i];}
if (doSss) {sss_rxF_ext[i] = sss_rxF[i];}
}
pss_rxF += N_SC_RB;
sss_rxF += N_SC_RB;
pss_rxF_ext += N_SC_RB;
sss_rxF_ext += N_SC_RB;
}
}
#endif
return(0);
......
......@@ -82,6 +82,15 @@
//#define RX_NB_TH_MAX 3
//#define RX_NB_TH 3
#ifdef NR_UNIT_TEST
#define FILE_NAME " "
#define LINE_FILE (0)
#define NR_TST_PHY_PRINTF(...) printf(__VA_ARGS__)
#else
#define FILE_NAME (__FILE__)
#define LINE_FILE (__LINE__)
#define NR_TST_PHY_PRINTF(...)
#endif
//#ifdef SHRLIBDEV
//extern int rxrescale;
......@@ -151,6 +160,27 @@
#include "NR_IF_Module.h"
//#if defined(UPGRADE_RAT_NR)
#if 1
/* see 38.321 Table 7.1-2 RNTI usage */
typedef enum { /* Type for Radio Network Temporary Identifier */
C_RNTI_NR = 0, /* Cell RNTI */
Temporary_C_RNTI_NR, /* Temporary C-RNTI */
CS_RNTI_NR, /* Configured Scheduling RNTI */
P_RNTI_NR, /* Paging RNTI */
SI_RNTI_NR, /* System information RNTI */
RA_RNTI_NR, /* Random Access RNTI */
TPC_CS_RNTI_NR, /* configured scheduling uplink power control */
TPC_PUCCH_RNTI_NR, /* PUCCH power control */
TPC_PUSCH_RNTI_NR, /* PUSCH power control */
TPC_SRS_RNTI_NR, /* SRS trigger and power control */
INT_RNTI_NR, /* Indication pre-emption in DL */
SFI_RNTI_NR, /* Slot Format Indication on the given cell */
SP_CSI_RNTI_NR /* Semipersistent CSI reporting on PUSCH */
} nr_rnti_type_t;
#endif
/// Context data structure for RX/TX portion of subframe processing
typedef struct {
/// index of the current UE RX/TX proc
......@@ -978,9 +1008,9 @@ typedef struct {
/// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime)
uint32_t rx_gain_byp[4];
/// \brief Current transmit power
int16_t tx_power_dBm[10];
int16_t tx_power_dBm[MAX_NR_OF_SLOTS];
/// \brief Total number of REs in current transmission
int tx_total_RE[10];
int tx_total_RE[MAX_NR_OF_SLOTS];
/// \brief Maximum transmit power
int8_t tx_power_max_dBm;
/// \brief Number of eNB seen by UE
......@@ -1155,6 +1185,22 @@ typedef struct {
PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
//#if defined(UPGRADE_RAT_NR)
#if 1
SystemInformationBlockType1_nr_t systemInformationBlockType1_nr;
CellGroupConfig_t cell_group_config;
PDSCH_ServingCellConfig_t PDSCH_ServingCellConfig;
PDSCH_Config_t PDSCH_Config;
PUCCH_ConfigCommon_nr_t pucch_config_common_nr[NUMBER_OF_CONNECTED_eNB_MAX];
PUCCH_Config_t pucch_config_dedicated_nr[NUMBER_OF_CONNECTED_eNB_MAX];
PUSCH_Config_t pusch_config;
#endif
uint8_t ncs_cell[20][7];
/// UL-POWER-Control
......@@ -1173,6 +1219,12 @@ typedef struct {
/// Scheduling Request Config
SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_CONNECTED_eNB_MAX];
//#if defined(UPGRADE_RAT_NR)
#if 1
scheduling_request_config_t scheduling_request_config_nr[NUMBER_OF_CONNECTED_eNB_MAX];
#endif
/// Transmission mode per eNB
uint8_t transmission_mode[NUMBER_OF_CONNECTED_eNB_MAX];
......
This diff is collapsed.
......@@ -256,6 +256,21 @@
/// Threshold for PUCCH Format 1a/1b detection
#define PUCCH1a_THRES 4
//#if defined(UPGRADE_RAT_NR)
#if 1
#define NB_NUMEROLOGIES_NR (5)
#define TDD_CONFIG_NB_FRAMES (2)
#define NR_MAX_SLOTS_PAR_FRAME (160) /* number of slots per frame */
#define NR_UE_CAPABILITY_SLOT_RX_TO_TX (4) /* FFS_NR_TODO it defines ue capability which is the number of slots */
/* - between reception of pdsch and tarnsmission of its acknowlegment */
/* - between reception of un uplink grant and its related transmission */
#define NR_MAX_HARQ_PROCESSES (16)
#define NR_MAX_ULSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 6.1 UE procedure for receiving the physical uplink shared channel */
#define NR_MAX_DLSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 5.1 UE procedure for receiving the physical downlink shared channel */
#endif
/// Data structure for transmission.
typedef struct {
/// RAW TX sample buffer
......
......@@ -24,7 +24,6 @@
#include "PHY/types.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/phy_vars_nr_ue.h"
#include "common/ran_context.h"
......@@ -45,7 +44,7 @@ int16_t *primary_synch2_time;
#ifndef OCP_FRAMEWORK
PHY_VARS_NR_UE ***PHY_vars_UE_g;
PHY_VARS_eNB ***PHY_vars_eNB_g;
LTE_DL_FRAME_PARMS *lte_frame_parms_g;
NR_DL_FRAME_PARMS *lte_frame_parms_g;
#else
PHY_VARS_NR_UE * PHY_vars_UE_g[MAX_UE][MAX_NUM_CCs]={NULL};
......
......@@ -219,6 +219,7 @@ void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
*/
void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
#if 0
/*! \brief Compute ACK/NACK information for PUSCH/PUCCH for UE transmission in subframe n. This function implements table 10.1-1 of 36.213, p. 69.
@param frame_parms Pointer to DL frame parameter descriptor
@param harq_ack Pointer to dlsch_ue harq_ack status descriptor
......@@ -264,6 +265,7 @@ uint8_t nr_ul_ACK_subframe2_M(NR_DL_FRAME_PARMS *frame_parms,unsigned char subfr
@param eNB_id ID of eNB which is to receive the SR
@returns 1 if TXOp is active.
*/
#endif
uint8_t nr_is_SR_TXOp(PHY_VARS_NR_UE *phy_vars_ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id);
/*! \brief Gives the UL subframe corresponding to a PDDCH order in subframe n
......@@ -295,6 +297,7 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb
void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
#if 0
/*! \brief This function retrives the resource (n1_pucch) corresponding to a PDSCH transmission in
subframe n-4 which is acknowledged in subframe n (for FDD) according to n1_pucch = Ncce + N1_pucch. For
TDD, this routine computes the complex procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2)
......@@ -313,7 +316,7 @@ uint16_t nr_get_n1_pucch(PHY_VARS_NR_UE *phy_vars_ue,
uint8_t *b,
uint8_t SR);
#endif
/*! \brief This function retrieves the PHY UE mode. It is used as a helper function for the UE MAC.
@param Mod_id Local UE index on which to act
@param CC_id Component Carrier Index
......
This diff is collapsed.
/*
* 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
*/
/***********************************************************************
*
* FILENAME : harq_nr.h
*
* MODULE : HARQ
*
* DESCRIPTION : header related to Hybrid Automatic Repeat Request Acknowledgment
* This feature allows to acknowledge downlink and uplink transport blocks
*
************************************************************************/
#ifndef HARQ_NR_H
#define HARQ_NR_H
/************** DEFINE ********************************************/
#if 0
/* these define are in file PHY/impl_defs_top.h" because of compilation problems due to multiple header files inclusions */
#define NR_MAX_HARQ_PROCESSES (16)
#define NR_MAX_ULSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* TS 38.214 6.1 UE procedure for receiving the physical uplink shared channel */
#define NR_MAX_DLSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* TS 38.214 5.1 UE procedure for receiving the physical downlink shared channel */
#endif
#define NR_DEFAULT_DLSCH_HARQ_PROCESSES (8) /* TS 38.214 5.1 */
#define NR_DL_MAX_DAI (4) /* TS 38.213 table 9.1.3-1 Value of counter DAI for DCI format 1_0 and 1_1 */
#define NR_DL_MAX_NB_CW (2) /* number of downlink code word */
#define DL_ACKNACK_NO_SET (2)
#define DL_NACK (0)
#define DL_ACK (1)
#define DL_MAX_NB_FEEDBACK (NR_DL_MAX_DAI * NR_DL_MAX_NB_CW)
#define DL_DAI_NO_SET (0xFF)
#define UL_DAI_NO_SET (DL_DAI_NO_SET)
/************** INCLUDE *******************************************/
#include "PHY/defs_nr_UE.h"
/************* TYPE ***********************************************/
typedef enum {
NEW_TRANSMISSION_HARQ,
RETRANSMISSION_HARQ
} harq_result_t;
/************** VARIABLES *****************************************/
/*************** FUNCTIONS ****************************************/
/** \brief This function configures uplink HARQ context
@param PHY_VARS_NR_UE ue context
@param gNB_id gNodeB identifier
@param number_harq_processes_pusch maximum number of uplink HARQ processes
@returns none */
void config_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, uint8_t number_harq_processes_pusch);
/** \brief This function releases uplink HARQ context
@param PHY_VARS_NR_UE ue context
@param gNB_id gNodeB identifier
@returns none */
void release_uplink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id);
/** \brief This function stores slot for transmission in HARQ context
@param ulsch_harq uplink harq context
@param harq process identifier harq_pid
@param slot_tx slot for transmission related to current downlink PDCCH
@returns 0 none */
void set_tx_harq_id(PHY_VARS_NR_UE *ue, int gNB_id, int harq_pid, int slot_tx);
/** \brief This function initialises context of an uplink HARQ process
@param ulsch_harq uplink harq context
@param harq process identifier harq_pid
@returns 0 none */
int get_tx_harq_id(PHY_VARS_NR_UE *ue, int gNB_id, int slot_tx);
/** \brief This function returns number of slots between current reception and related transmission
@param dci value
@returns slots number between reception and related transmission */
int get_dci_slot_rx_to_tx(int dci_index);
/** \brief This function update uplink harq context and return transmission type (new transmission or retransmission)
@param ulsch uplink harq context
@param harq process identifier harq_pid
@returns retransmission or new transmission */
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, nr_rnti_type_t rnti_type);
/** \brief This function initialises downlink HARQ status
@param pointer to downlink harq status
@returns none */
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq);
/** \brief This function configures downlink HARQ context
@param PHY_VARS_NR_UE ue context
@param gNB_id gNodeB identifier
@param TB_id transport block identifier
@param execution_thread_number thread_number
@param number_harq_processes maximum number of downlink HARQ processes
@returns none */
void config_downlink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int TB_id, int execution_thread_number, uint8_t number_harq_processes);
/** \brief This function releases downlink HARQ context
@param PHY_VARS_NR_UE ue context
@param gNB_id gNodeB identifier
@param TB_id transport block identifier
@param execution_thread_number thread_number
@returns none */
void release_downlink_harq_process(PHY_VARS_NR_UE *ue, int gNB_id, int TB_id, int execution_thread_number);
/** \brief This function update downlink harq context and return reception type (new transmission or retransmission)
@param dlsch downlink harq context
@param harq process identifier harq_pid
@param rnti_type type of rnti
@returns retransmission or new transmission */
harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dlsch, int harq_pid, int ndi, nr_rnti_type_t rnti_type);
#undef EXTERN
#undef INIT_VARIABLES_HARQ_NR_H