harq_nr.h 6.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
/*
 * 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 ***********************************************/


/************** VARIABLES *****************************************/


/*************** FUNCTIONS ****************************************/

Jacques's avatar
Jacques committed
70 71 72 73 74 75 76 77 78 79 80 81 82

/** \brief This function updates HARQ context according to dci
    @param PHY_VARS_NR_UE ue context
    @param nr_dci_info_extracted extracted information from dci
    @param dlsch downlink context
    @param ulsch uplink context
    @param nr_tti_rx rx slot
    @param tx_offset slot offset for tx
    @returns none */

void get_dci_info_for_harq(PHY_VARS_NR_UE *ue, NR_DCI_INFO_EXTRACTED_t *nr_dci_info_extracted,
		                   NR_UE_DLSCH_t **dlsch, NR_UE_ULSCH_t *ulsch, uint8_t nr_tti_rx, uint8_t tx_offset);

83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
/** \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
Jacques's avatar
Jacques committed
99
    @param ulsch uplink context
100 101 102 103
    @param harq process identifier harq_pid
    @param slot_tx slot for transmission related to current downlink PDCCH
    @returns 0 none */

Jacques's avatar
Jacques committed
104
void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx);
105 106

/** \brief This function initialises context of an uplink HARQ process
Jacques's avatar
Jacques committed
107
    @param ulsch uplink context
108
    @param harq process identifier harq_pid
Jacques's avatar
Jacques committed
109
    @returns harq number for tx slot */
110

Jacques's avatar
Jacques committed
111
int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
112 113 114 115 116 117

/** \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 */

Jacques's avatar
Jacques committed
118
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, uint8_t rnti_type);
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150

/** \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 */

Jacques's avatar
Jacques committed
151
harq_result_t downlink_harq_process(NR_DL_UE_HARQ_t *dlsch, int harq_pid, int ndi, uint8_t rnti_type);
152 153 154 155 156

#undef EXTERN
#undef INIT_VARIABLES_HARQ_NR_H

#endif /* HARQ_NR_H */