2020-11-26 01:25:22 -08:00
|
|
|
/**
|
2021-03-28 14:12:42 -07:00
|
|
|
* Copyright 2013-2021 Software Radio Systems Limited
|
2017-05-18 03:11:31 -07:00
|
|
|
*
|
2021-03-28 14:12:42 -07:00
|
|
|
* This file is part of srsLTE.
|
2017-05-18 03:11:31 -07:00
|
|
|
*
|
2021-03-28 14:12:42 -07:00
|
|
|
* srsLTE is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* srsLTE is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
2017-05-18 03:11:31 -07:00
|
|
|
*
|
2021-03-28 14:12:42 -07:00
|
|
|
* A copy of the GNU Affero General Public License can be found in
|
|
|
|
* the LICENSE file in the top-level directory of this distribution
|
|
|
|
* and at http://www.gnu.org/licenses/.
|
2017-05-18 03:11:31 -07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#ifndef SRSRAN_COMMON_H
|
|
|
|
#define SRSRAN_COMMON_H
|
2017-05-18 03:11:31 -07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
INCLUDES
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2020-12-14 03:28:11 -08:00
|
|
|
#include <chrono>
|
2021-03-30 11:16:15 -07:00
|
|
|
#include <cstring>
|
2019-05-01 09:41:04 -07:00
|
|
|
#include <memory>
|
2017-05-18 03:11:31 -07:00
|
|
|
#include <stdint.h>
|
2021-03-30 11:16:15 -07:00
|
|
|
#include <string>
|
2021-01-20 06:46:46 -08:00
|
|
|
#include <sys/time.h>
|
2017-05-18 03:11:31 -07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
DEFINES
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#define SRSRAN_UE_CATEGORY 4
|
2017-05-18 03:11:31 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#define SRSRAN_N_SRB 3
|
|
|
|
#define SRSRAN_N_DRB 8
|
|
|
|
#define SRSRAN_N_RADIO_BEARERS 11
|
2017-05-18 03:11:31 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#define SRSRAN_N_MCH_LCIDS 32
|
2018-05-15 07:50:57 -07:00
|
|
|
|
2020-03-11 08:30:05 -07:00
|
|
|
#define FDD_HARQ_DELAY_DL_MS 4
|
|
|
|
#define FDD_HARQ_DELAY_UL_MS 4
|
|
|
|
#define MSG3_DELAY_MS 2 // Delay added to FDD_HARQ_DELAY_DL_MS
|
2017-09-29 11:38:12 -07:00
|
|
|
|
2019-04-23 01:53:11 -07:00
|
|
|
#define TTI_SUB(a, b) ((((a) + 10240) - (b)) % 10240)
|
2019-12-16 07:04:22 -08:00
|
|
|
#define TTI_ADD(a, b) (((a) + (b)) % 10240)
|
2017-11-14 04:44:47 -08:00
|
|
|
|
2020-03-11 08:30:05 -07:00
|
|
|
#define TTI_TX(tti) TTI_ADD(tti, FDD_HARQ_DELAY_DL_MS)
|
2019-04-23 01:53:11 -07:00
|
|
|
|
2020-03-11 08:30:05 -07:00
|
|
|
#define TTI_RX(tti) (TTI_SUB(tti, FDD_HARQ_DELAY_UL_MS))
|
|
|
|
#define TTI_RX_ACK(tti) (TTI_ADD(tti, FDD_HARQ_DELAY_UL_MS + FDD_HARQ_DELAY_DL_MS))
|
2019-04-23 01:53:11 -07:00
|
|
|
|
|
|
|
#define TTIMOD_SZ 20
|
2019-10-14 09:39:02 -07:00
|
|
|
#define TTIMOD(tti) (tti % TTIMOD_SZ)
|
2017-10-05 07:52:02 -07:00
|
|
|
|
2020-07-06 06:09:58 -07:00
|
|
|
#define INVALID_TTI 10241
|
2020-11-11 05:49:41 -08:00
|
|
|
#define TX_ENB_DELAY FDD_HARQ_DELAY_UL_MS
|
2020-07-06 06:09:58 -07:00
|
|
|
|
2019-04-23 01:53:11 -07:00
|
|
|
#define PHICH_MAX_SF 6 // Maximum PHICH in a subframe (1 in FDD, > 1 in TDD, see table 9.1.2-1 36.213)
|
|
|
|
|
2020-03-11 08:30:05 -07:00
|
|
|
#define ASYNC_DL_SCHED (FDD_HARQ_DELAY_UL_MS <= 4)
|
2017-10-04 09:30:10 -07:00
|
|
|
|
2018-09-26 07:59:11 -07:00
|
|
|
// Cat 4 UE - Max number of DL-SCH transport block bits received within a TTI
|
2019-07-15 13:22:45 -07:00
|
|
|
// 3GPP 36.306 v15.4.0 Table 4.1.1 for Category 11 with 2 layers and 256QAM
|
2021-03-19 03:45:56 -07:00
|
|
|
#define SRSRAN_MAX_TBSIZE_BITS 97896
|
|
|
|
#define SRSRAN_BUFFER_HEADER_OFFSET 1020
|
|
|
|
#define SRSRAN_MAX_BUFFER_SIZE_BITS (SRSRAN_MAX_TBSIZE_BITS + SRSRAN_BUFFER_HEADER_OFFSET)
|
|
|
|
#define SRSRAN_MAX_BUFFER_SIZE_BYTES (SRSRAN_MAX_TBSIZE_BITS / 8 + SRSRAN_BUFFER_HEADER_OFFSET)
|
2017-05-18 03:11:31 -07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
TYPEDEFS
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
namespace srsran {
|
2017-05-18 03:11:31 -07:00
|
|
|
|
2020-12-11 07:05:03 -08:00
|
|
|
#define ENABLE_TIMESTAMP
|
2018-03-06 03:37:08 -08:00
|
|
|
|
2020-12-02 03:45:20 -08:00
|
|
|
// helper functions
|
|
|
|
inline const char* enum_to_text(const char* const array[], uint32_t nof_types, uint32_t enum_val)
|
|
|
|
{
|
|
|
|
return enum_val >= nof_types ? "" : array[enum_val];
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ItemType>
|
|
|
|
ItemType enum_to_number(ItemType* array, uint32_t nof_types, uint32_t enum_val)
|
|
|
|
{
|
|
|
|
return enum_val >= nof_types ? -1 : array[enum_val];
|
|
|
|
}
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
enum class srsran_rat_t { lte, nr, nulltype };
|
|
|
|
inline std::string to_string(const srsran_rat_t& type)
|
2020-12-02 03:45:20 -08:00
|
|
|
{
|
|
|
|
constexpr static const char* options[] = {"LTE", "NR"};
|
2021-03-19 03:45:56 -07:00
|
|
|
return enum_to_text(options, (uint32_t)srsran_rat_t::nulltype, (uint32_t)type);
|
2020-12-02 03:45:20 -08:00
|
|
|
}
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
} // namespace srsran
|
2017-05-18 03:11:31 -07:00
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#endif // SRSRAN_COMMON_H
|