mirror of https://github.com/pvnis/srsRAN_4G.git
Merge branch 'next' into agpl_next
# Conflicts: # lib/include/srslte/phy/ch_estimation/ul_rs_tables.h # lib/include/srslte/phy/ue/ue_dl_nr_data.h # lib/src/phy/ue/ue_dl_nr_data.c # srsue/test/ttcn3/hdr/swappable_log.hmaster
commit
c9f48bce7b
@ -0,0 +1,201 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_MEM_POOL_H
|
||||||
|
#define SRSLTE_MEM_POOL_H
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
namespace srslte {
|
||||||
|
|
||||||
|
/// Stores provided mem blocks in a stack in an non-owning manner. Not thread-safe
|
||||||
|
class memblock_stack
|
||||||
|
{
|
||||||
|
struct node {
|
||||||
|
node* prev;
|
||||||
|
explicit node(node* prev_) : prev(prev_) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
constexpr static size_t min_memblock_size() { return sizeof(node); }
|
||||||
|
|
||||||
|
memblock_stack() = default;
|
||||||
|
|
||||||
|
memblock_stack(const memblock_stack&) = delete;
|
||||||
|
|
||||||
|
memblock_stack(memblock_stack&& other) noexcept : head(other.head) { other.head = nullptr; }
|
||||||
|
|
||||||
|
memblock_stack& operator=(const memblock_stack&) = delete;
|
||||||
|
|
||||||
|
memblock_stack& operator=(memblock_stack&& other) noexcept
|
||||||
|
{
|
||||||
|
head = other.head;
|
||||||
|
other.head = nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void push(uint8_t* block) noexcept
|
||||||
|
{
|
||||||
|
// printf("head: %ld\n", (long)head);
|
||||||
|
node* next = ::new (block) node(head);
|
||||||
|
head = next;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* try_pop() noexcept
|
||||||
|
{
|
||||||
|
if (is_empty()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
node* last_head = head;
|
||||||
|
head = head->prev;
|
||||||
|
count--;
|
||||||
|
return (uint8_t*)last_head;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_empty() const { return head == nullptr; }
|
||||||
|
|
||||||
|
size_t size() const { return count; }
|
||||||
|
|
||||||
|
void clear() { head = nullptr; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
node* head = nullptr;
|
||||||
|
size_t count = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// memblock stack that mutexes pushing/popping
|
||||||
|
class mutexed_memblock_stack
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
mutexed_memblock_stack() = default;
|
||||||
|
|
||||||
|
mutexed_memblock_stack(const mutexed_memblock_stack&) = delete;
|
||||||
|
|
||||||
|
mutexed_memblock_stack(mutexed_memblock_stack&& other) noexcept
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lk1(other.mutex, std::defer_lock);
|
||||||
|
std::unique_lock<std::mutex> lk2(mutex, std::defer_lock);
|
||||||
|
std::lock(lk1, lk2);
|
||||||
|
stack = std::move(other.stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
mutexed_memblock_stack& operator=(const mutexed_memblock_stack&) = delete;
|
||||||
|
|
||||||
|
mutexed_memblock_stack& operator=(mutexed_memblock_stack&& other) noexcept
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lk1(other.mutex, std::defer_lock);
|
||||||
|
std::unique_lock<std::mutex> lk2(mutex, std::defer_lock);
|
||||||
|
std::lock(lk1, lk2);
|
||||||
|
stack = std::move(other.stack);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void push(uint8_t* block) noexcept
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
|
stack.push(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* try_pop() noexcept
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
|
uint8_t* block = stack.try_pop();
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_empty() const noexcept { return stack.is_empty(); }
|
||||||
|
|
||||||
|
size_t size() const noexcept
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
|
return stack.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
|
stack.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
memblock_stack stack;
|
||||||
|
mutable std::mutex mutex;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pool specialized for big objects. Created objects are not contiguous in memory.
|
||||||
|
* Relevant methods:
|
||||||
|
* - ::allocate_node(sz) - allocate memory of sizeof(T), or reuse memory already present in cache
|
||||||
|
* - ::deallocate_node(void* p) - return memory addressed by p back to the pool to be cached.
|
||||||
|
* - ::reserve(N) - prereserve memory slots for faster object creation
|
||||||
|
* @tparam ObjSize object memory size
|
||||||
|
* @tparam ThreadSafe if object pool is thread-safe or not
|
||||||
|
*/
|
||||||
|
template <typename T, bool ThreadSafe = false>
|
||||||
|
class big_obj_pool
|
||||||
|
{
|
||||||
|
// memory stack type derivation (thread safe or not)
|
||||||
|
using stack_type = typename std::conditional<ThreadSafe, mutexed_memblock_stack, memblock_stack>::type;
|
||||||
|
|
||||||
|
// memory stack to cache allocate memory chunks
|
||||||
|
stack_type stack;
|
||||||
|
|
||||||
|
public:
|
||||||
|
~big_obj_pool() { clear(); }
|
||||||
|
|
||||||
|
/// alloc new object space. If no memory is pre-reserved in the pool, malloc is called.
|
||||||
|
void* allocate_node(size_t sz)
|
||||||
|
{
|
||||||
|
assert(sz == sizeof(T));
|
||||||
|
static const size_t blocksize = std::max(sizeof(T), memblock_stack::min_memblock_size());
|
||||||
|
uint8_t* block = stack.try_pop();
|
||||||
|
if (block == nullptr) {
|
||||||
|
block = new uint8_t[blocksize];
|
||||||
|
}
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
void deallocate_node(void* p)
|
||||||
|
{
|
||||||
|
if (p != nullptr) {
|
||||||
|
stack.push(static_cast<uint8_t*>(p));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pre-reserve N memory chunks for future object allocations
|
||||||
|
void reserve(size_t N)
|
||||||
|
{
|
||||||
|
static const size_t blocksize = std::max(sizeof(T), memblock_stack::min_memblock_size());
|
||||||
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
stack.push(new uint8_t[blocksize]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t capacity() const { return stack.size(); }
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
uint8_t* block = stack.try_pop();
|
||||||
|
while (block != nullptr) {
|
||||||
|
delete[] block;
|
||||||
|
block = stack.try_pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace srslte
|
||||||
|
|
||||||
|
#endif // SRSLTE_MEM_POOL_H
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,104 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_DMRS_PUCCH_H
|
||||||
|
#define SRSLTE_DMRS_PUCCH_H
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include "srslte/phy/ch_estimation/chest_ul.h"
|
||||||
|
#include "srslte/phy/phch/pucch_nr.h"
|
||||||
|
|
||||||
|
#define SRSLTE_DMRS_PUCCH_FORMAT_3_4_MAX_NSYMB 4
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Computes the symbol indexes carrying DMRS for NR-PUCCH formats 3 and 4
|
||||||
|
* @remark Implements TS 38.211 Table 6.4.1.3.3.2-1: DM-RS positions for PUCCH format 3 and 4.
|
||||||
|
* @param[in] resource Provides the format 3 or 4 resource
|
||||||
|
* @param[out] idx Destination data for storing the symbol indexes
|
||||||
|
* @return The number of DMRS symbols if the resource is valid, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_dmrs_pucch_format_3_4_get_symbol_idx(const srslte_pucch_nr_resource_t* resource,
|
||||||
|
uint32_t idx[SRSLTE_DMRS_PUCCH_FORMAT_3_4_MAX_NSYMB]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Puts NR-PUCCH format 1 DMRS in the provided resource grid
|
||||||
|
* @param[in] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Carrier configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 1 resource
|
||||||
|
* @param[out] slot_symbols Resource grid of the given slot
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_dmrs_pucch_format1_put(const srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
const srslte_pucch_nr_resource_t* resource,
|
||||||
|
cf_t* slot_symbols);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Estimates NR-PUCCH format 1 resource elements from their DMRS in the provided resource grid
|
||||||
|
* @param[in] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Carrier configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 1 resource
|
||||||
|
* @param[in] slot_symbols Resource grid of the given slot
|
||||||
|
* @param[out] res UL Channel estimator result
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_dmrs_pucch_format1_estimate(const srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
const srslte_pucch_nr_resource_t* resource,
|
||||||
|
const cf_t* slot_symbols,
|
||||||
|
srslte_chest_ul_res_t* res);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Puts NR-PUCCH format 2 DMRS in the provided resource grid
|
||||||
|
* @param[in] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Carrier configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 2 resource
|
||||||
|
* @param[out] slot_symbols Resource grid of the given slot
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
int srslte_dmrs_pucch_format2_put(const srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
const srslte_pucch_nr_resource_t* resource,
|
||||||
|
cf_t* slot_symbols);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Estimates NR-PUCCH format 2 resource elements from their DMRS in the provided resource grid
|
||||||
|
* @param[in] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Carrier configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 2 resource
|
||||||
|
* @param[in] slot_symbols Resource grid of the given slot
|
||||||
|
* @param[out] res UL Channel estimator result
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
int srslte_dmrs_pucch_format2_estimate(const srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
const srslte_pucch_nr_resource_t* resource,
|
||||||
|
const cf_t* slot_symbols,
|
||||||
|
srslte_chest_ul_res_t* res);
|
||||||
|
|
||||||
|
#endif // SRSLTE_DMRS_PUCCH_H
|
@ -1,91 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright 2013-2020 Software Radio Systems Limited
|
|
||||||
*
|
|
||||||
* This file is part of srsLTE.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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/.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SRSLTE_UL_RS_TABLES_H
|
|
||||||
#define SRSLTE_UL_RS_TABLES_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
// Phi values for M_sc=12 Table 5.5.1.2-1 in 36.211
|
|
||||||
static const int phi_M_sc_12[30][12] = {{-1, 1, 3, -3, 3, 3, 1, 1, 3, 1, -3, 3}, {1, 1, 3, 3, 3, -1, 1, -3, -3, 1, -3, 3},
|
|
||||||
{1, 1, -3, -3, -3, -1, -3, -3, 1, -3, 1, -1}, {-1, 1, 1, 1, 1, -1, -3, -3, 1, -3, 3, -1},
|
|
||||||
{-1, 3, 1, -1, 1, -1, -3, -1, 1, -1, 1, 3}, {1, -3, 3, -1, -1, 1, 1, -1, -1, 3, -3, 1},
|
|
||||||
{-1, 3, -3, -3, -3, 3, 1, -1, 3, 3, -3, 1}, {-3, -1, -1, -1, 1, -3, 3, -1, 1, -3, 3, 1},
|
|
||||||
{1, -3, 3, 1, -1, -1, -1, 1, 1, 3, -1, 1}, {1, -3, -1, 3, 3, -1, -3, 1, 1, 1, 1, 1},
|
|
||||||
{-1, 3, -1, 1, 1, -3, -3, -1, -3, -3, 3, -1}, {3, 1, -1, -1, 3, 3, -3, 1, 3, 1, 3, 3},
|
|
||||||
{1, -3, 1, 1, -3, 1, 1, 1, -3, -3, -3, 1}, {3, 3, -3, 3, -3, 1, 1, 3, -1, -3, 3, 3},
|
|
||||||
{-3, 1, -1, -3, -1, 3, 1, 3, 3, 3, -1, 1}, {3, -1, 1, -3, -1, -1, 1, 1, 3, 1, -1, -3},
|
|
||||||
{1, 3, 1, -1, 1, 3, 3, 3, -1, -1, 3, -1}, {-3, 1, 1, 3, -3, 3, -3, -3, 3, 1, 3, -1},
|
|
||||||
{-3, 3, 1, 1, -3, 1, -3, -3, -1, -1, 1, -3}, {-1, 3, 1, 3, 1, -1, -1, 3, -3, -1, -3, -1},
|
|
||||||
{-1, -3, 1, 1, 1, 1, 3, 1, -1, 1, -3, -1}, {-1, 3, -1, 1, -3, -3, -3, -3, -3, 1, -1, -3},
|
|
||||||
{1, 1, -3, -3, -3, -3, -1, 3, -3, 1, -3, 3}, {1, 1, -1, -3, -1, -3, 1, -1, 1, 3, -1, 1},
|
|
||||||
{1, 1, 3, 1, 3, 3, -1, 1, -1, -3, -3, 1}, {1, -3, 3, 3, 1, 3, 3, 1, -3, -1, -1, 3},
|
|
||||||
{1, 3, -3, -3, 3, -3, 1, -1, -1, 3, -1, -3}, {-3, -1, -3, -1, -3, 3, 1, -1, 1, 3, -3, -3},
|
|
||||||
{-1, 3, -3, 3, -1, 3, 3, -3, 3, 3, -1, -1}, {3, -3, -3, -1, -1, -3, -1, 3, -3, 3, 1, -1}};
|
|
||||||
|
|
||||||
// Phi values for M_sc=24 Table 5.5.1.2-2 in 36.211
|
|
||||||
static const int phi_M_sc_24[30][24] = {{-1, 3, 1, -3, 3, -1, 1, 3, -3, 3, 1, 3, -3, 3, 1, 1, -1, 1, 3, -3, 3, -3, -1, -3},
|
|
||||||
{-3, 3, -3, -3, -3, 1, -3, -3, 3, -1, 1, 1, 1, 3, 1, -1, 3, -3, -3, 1, 3, 1, 1, -3},
|
|
||||||
{3, -1, 3, 3, 1, 1, -3, 3, 3, 3, 3, 1, -1, 3, -1, 1, 1, -1, -3, -1, -1, 1, 3, 3},
|
|
||||||
{-1, -3, 1, 1, 3, -3, 1, 1, -3, -1, -1, 1, 3, 1, 3, 1, -1, 3, 1, 1, -3, -1, -3, -1},
|
|
||||||
{-1, -1, -1, -3, -3, -1, 1, 1, 3, 3, -1, 3, -1, 1, -1, -3, 1, -1, -3, -3, 1, -3, -1, -1},
|
|
||||||
{-3, 1, 1, 3, -1, 1, 3, 1, -3, 1, -3, 1, 1, -1, -1, 3, -1, -3, 3, -3, -3, -3, 1, 1},
|
|
||||||
{1, 1, -1, -1, 3, -3, -3, 3, -3, 1, -1, -1, 1, -1, 1, 1, -1, -3, -1, 1, -1, 3, -1, -3},
|
|
||||||
{-3, 3, 3, -1, -1, -3, -1, 3, 1, 3, 1, 3, 1, 1, -1, 3, 1, -1, 1, 3, -3, -1, -1, 1},
|
|
||||||
{-3, 1, 3, -3, 1, -1, -3, 3, -3, 3, -1, -1, -1, -1, 1, -3, -3, -3, 1, -3, -3, -3, 1, -3},
|
|
||||||
{1, 1, -3, 3, 3, -1, -3, -1, 3, -3, 3, 3, 3, -1, 1, 1, -3, 1, -1, 1, 1, -3, 1, 1},
|
|
||||||
{-1, 1, -3, -3, 3, -1, 3, -1, -1, -3, -3, -3, -1, -3, -3, 1, -1, 1, 3, 3, -1, 1, -1, 3},
|
|
||||||
{1, 3, 3, -3, -3, 1, 3, 1, -1, -3, -3, -3, 3, 3, -3, 3, 3, -1, -3, 3, -1, 1, -3, 1},
|
|
||||||
{1, 3, 3, 1, 1, 1, -1, -1, 1, -3, 3, -1, 1, 1, -3, 3, 3, -1, -3, 3, -3, -1, -3, -1},
|
|
||||||
{3, -1, -1, -1, -1, -3, -1, 3, 3, 1, -1, 1, 3, 3, 3, -1, 1, 1, -3, 1, 3, -1, -3, 3},
|
|
||||||
{-3, -3, 3, 1, 3, 1, -3, 3, 1, 3, 1, 1, 3, 3, -1, -1, -3, 1, -3, -1, 3, 1, 1, 3},
|
|
||||||
{-1, -1, 1, -3, 1, 3, -3, 1, -1, -3, -1, 3, 1, 3, 1, -1, -3, -3, -1, -1, -3, -3, -3, -1},
|
|
||||||
{-1, -3, 3, -1, -1, -1, -1, 1, 1, -3, 3, 1, 3, 3, 1, -1, 1, -3, 1, -3, 1, 1, -3, -1},
|
|
||||||
{1, 3, -1, 3, 3, -1, -3, 1, -1, -3, 3, 3, 3, -1, 1, 1, 3, -1, -3, -1, 3, -1, -1, -1},
|
|
||||||
{1, 1, 1, 1, 1, -1, 3, -1, -3, 1, 1, 3, -3, 1, -3, -1, 1, 1, -3, -3, 3, 1, 1, -3},
|
|
||||||
{1, 3, 3, 1, -1, -3, 3, -1, 3, 3, 3, -3, 1, -1, 1, -1, -3, -1, 1, 3, -1, 3, -3, -3},
|
|
||||||
{-1, -3, 3, -3, -3, -3, -1, -1, -3, -1, -3, 3, 1, 3, -3, -1, 3, -1, 1, -1, 3, -3, 1, -1},
|
|
||||||
{-3, -3, 1, 1, -1, 1, -1, 1, -1, 3, 1, -3, -1, 1, -1, 1, -1, -1, 3, 3, -3, -1, 1, -3},
|
|
||||||
{-3, -1, -3, 3, 1, -1, -3, -1, -3, -3, 3, -3, 3, -3, -1, 1, 3, 1, -3, 1, 3, 3, -1, -3},
|
|
||||||
{-1, -1, -1, -1, 3, 3, 3, 1, 3, 3, -3, 1, 3, -1, 3, -1, 3, 3, -3, 3, 1, -1, 3, 3},
|
|
||||||
{1, -1, 3, 3, -1, -3, 3, -3, -1, -1, 3, -1, 3, -1, -1, 1, 1, 1, 1, -1, -1, -3, -1, 3},
|
|
||||||
{1, -1, 1, -1, 3, -1, 3, 1, 1, -1, -1, -3, 1, 1, -3, 1, 3, -3, 1, 1, -3, -3, -1, -1},
|
|
||||||
{-3, -1, 1, 3, 1, 1, -3, -1, -1, -3, 3, -3, 3, 1, -3, 3, -3, 1, -1, 1, -3, 1, 1, 1},
|
|
||||||
{-1, -3, 3, 3, 1, 1, 3, -1, -3, -1, -1, -1, 3, 1, -3, -3, -1, 3, -3, -1, -3, -1, -3, -1},
|
|
||||||
{-1, -3, -1, -1, 1, -3, -1, -1, 1, -1, -3, 1, 1, -3, 1, -3, -3, 3, 1, 1, -1, 3, -1, -1},
|
|
||||||
{1, 1, -1, -1, -3, -1, 3, -1, 3, -1, 1, 3, 1, -1, 3, 1, 3, -3, -3, 1, -1, -1, 1, 3}};
|
|
||||||
|
|
||||||
// Prime numbers used for Section 5.5.1.1 of 36.211
|
|
||||||
#define NOF_PRIME_NUMBERS 196
|
|
||||||
static const uint32_t prime_numbers[NOF_PRIME_NUMBERS] = {
|
|
||||||
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
|
|
||||||
67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
|
|
||||||
157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251,
|
|
||||||
257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359,
|
|
||||||
367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
|
|
||||||
467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593,
|
|
||||||
599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
|
|
||||||
709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827,
|
|
||||||
829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953,
|
|
||||||
967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069,
|
|
||||||
1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193};
|
|
||||||
|
|
||||||
#endif
|
|
@ -0,0 +1,102 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_ZC_SEQUENCE_H
|
||||||
|
#define SRSLTE_ZC_SEQUENCE_H
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Defines the maximum number of ZC sequence groups (u)
|
||||||
|
*/
|
||||||
|
#define SRSLTE_ZC_SEQUENCE_NOF_GROUPS 30
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Defines the maximum number of base sequences (v)
|
||||||
|
*/
|
||||||
|
#define SRSLTE_ZC_SEQUENCE_NOF_BASE 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates ZC sequences given the required parameters used in the TS 36 series (LTE)
|
||||||
|
*
|
||||||
|
* @remark Implemented as defined in TS 36.211 section 5.5.1 Generation of the reference signal sequence
|
||||||
|
*
|
||||||
|
* @param[in] u Group number {0,1,...29}
|
||||||
|
* @param[in] v Base sequence
|
||||||
|
* @param[in] alpha Phase shift
|
||||||
|
* @param[in] nof_prb Number of PRB
|
||||||
|
* @param[out] sequence Output sequence
|
||||||
|
* @return SRSLTE_SUCCESS if the generation is successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_zc_sequence_generate_lte(uint32_t u, uint32_t v, float alpha, uint32_t nof_prb, cf_t* sequence);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generates ZC sequences given the required parameters used in the TS 38 series (NR)
|
||||||
|
*
|
||||||
|
* @remark Implemented as defined in TS 38.211 section 5.2.2 Low-PAPR sequence generation
|
||||||
|
*
|
||||||
|
* @param u Group number {0,1,...29}
|
||||||
|
* @param v base sequence
|
||||||
|
* @param alpha Phase shift
|
||||||
|
* @param m Number of PRB
|
||||||
|
* @param delta Delta parameter described in specification
|
||||||
|
* @param sequence Output sequence
|
||||||
|
* @return SRSLTE_SUCCESS if the generation is successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int
|
||||||
|
srslte_zc_sequence_generate_nr(uint32_t u, uint32_t v, float alpha, uint32_t m, uint32_t delta, cf_t* sequence);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Low-PAPR ZC sequence look-up-table
|
||||||
|
*/
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
uint32_t M_zc;
|
||||||
|
uint32_t nof_alphas;
|
||||||
|
cf_t* sequence[SRSLTE_ZC_SEQUENCE_NOF_GROUPS][SRSLTE_ZC_SEQUENCE_NOF_BASE];
|
||||||
|
} srslte_zc_sequence_lut_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialises a Low-PAPR sequence look-up-table object using NR tables
|
||||||
|
*
|
||||||
|
* @param q Object pointer
|
||||||
|
* @param m Number of PRB
|
||||||
|
* @param delta Delta parameter described in specification
|
||||||
|
* @param alphas Vector with the alpha shift parameters
|
||||||
|
* @param nof_alphas Number alpha shifts to generate
|
||||||
|
* @return SRSLTE_SUCCESS if the initialization is successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_zc_sequence_lut_init_nr(srslte_zc_sequence_lut_t* q,
|
||||||
|
uint32_t m,
|
||||||
|
uint32_t delta,
|
||||||
|
float* alphas,
|
||||||
|
uint32_t nof_alphas);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deallocates a Low-PAPR sequence look-up-table object
|
||||||
|
* @param q Object pointer
|
||||||
|
*/
|
||||||
|
SRSLTE_API void srslte_zc_sequence_lut_free(srslte_zc_sequence_lut_t* q);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get a Low-PAPR sequence from the LUT
|
||||||
|
* @param q Object pointer
|
||||||
|
* @param u Group number {0,1,...29}
|
||||||
|
* @param v base sequence
|
||||||
|
* @param alpha_idx Phase shift index
|
||||||
|
* @return SRSLTE_SUCCESS if the generation is successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API const cf_t*
|
||||||
|
srslte_zc_sequence_lut_get(const srslte_zc_sequence_lut_t* q, uint32_t u, uint32_t v, uint32_t alpha_idx);
|
||||||
|
|
||||||
|
#endif // SRSLTE_ZC_SEQUENCE_H
|
@ -0,0 +1,136 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_PUCCH_CFG_NR_H
|
||||||
|
#define SRSLTE_PUCCH_CFG_NR_H
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NR-PUCCH Format 0 ranges
|
||||||
|
*/
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT0_MAX_CS 11
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT0_MIN_NSYMB 1
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT0_MAX_NSYMB 2
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT0_MAX_STARTSYMB 13
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NR-PUCCH Format 1 ranges
|
||||||
|
*/
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT1_MAX_CS 11
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT1_MAX_TOCC 6
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT1_MIN_NSYMB 4
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT1_MAX_NSYMB 14
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT1_MAX_STARTSYMB 10
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT1_MAX_NOF_BITS 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NR-PUCCH Format 2 ranges
|
||||||
|
*/
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT2_MIN_NPRB 1
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT2_MAX_NPRB 16
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT2_MIN_NSYMB 1
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT2_MAX_NSYMB 2
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT2_MAX_STARTSYMB 13
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT2_MIN_NOF_BITS 3
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NR-PUCCH Format 3 ranges
|
||||||
|
*/
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT3_MIN_NPRB 1
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT3_MAX_NPRB 16
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT3_MIN_NSYMB 4
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT3_MAX_NSYMB 14
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT3_MAX_STARTSYMB 10
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NR-PUCCH Format 4 ranges
|
||||||
|
*/
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT4_NPRB 1
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT4_MIN_NSYMB 4
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT4_MAX_NSYMB 14
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT4_MAX_STARTSYMB 10
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NR-PUCCH Formats 2, 3 and 4 code rate range
|
||||||
|
*/
|
||||||
|
#define SRSLTE_PUCCH_NR_MAX_CODE_RATE 7
|
||||||
|
|
||||||
|
typedef enum SRSLTE_API {
|
||||||
|
SRSLTE_PUCCH_NR_FORMAT_0 = 0,
|
||||||
|
SRSLTE_PUCCH_NR_FORMAT_1,
|
||||||
|
SRSLTE_PUCCH_NR_FORMAT_2,
|
||||||
|
SRSLTE_PUCCH_NR_FORMAT_3,
|
||||||
|
SRSLTE_PUCCH_NR_FORMAT_4,
|
||||||
|
SRSLTE_PUCCH_NR_FORMAT_ERROR,
|
||||||
|
} srslte_pucch_nr_format_t;
|
||||||
|
|
||||||
|
typedef enum SRSLTE_API {
|
||||||
|
SRSLTE_PUCCH_NR_GROUP_HOPPING_NEITHER = 0,
|
||||||
|
SRSLTE_PUCCH_NR_GROUP_HOPPING_ENABLE,
|
||||||
|
SRSLTE_PUCCH_NR_GROUP_HOPPING_DISABLE
|
||||||
|
} srslte_pucch_nr_group_hopping_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief PUCCH Common configuration
|
||||||
|
* @remark Defined in TS 38.331 PUCCH-ConfigCommon
|
||||||
|
*/
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
uint32_t resource_common; ///< Configures a set of cell-specific PUCCH resources/parameters
|
||||||
|
srslte_pucch_nr_group_hopping_t group_hopping; ///< Configuration of group and sequence hopping
|
||||||
|
uint32_t hopping_id; ///< Cell-specific scrambling ID for group hopping and sequence hopping if enabled
|
||||||
|
bool hopping_id_present;
|
||||||
|
float p0_nominal; ///< Power control parameter P0 for PUCCH transmissions. Value in dBm. (-202..24)
|
||||||
|
|
||||||
|
// From PUSCH-config
|
||||||
|
bool scrambling_id_present;
|
||||||
|
uint32_t scambling_id; // Identifier used to initialize data scrambling (dataScramblingIdentityPUSCH, 0-1023)
|
||||||
|
} srslte_pucch_nr_common_cfg_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generic PUCCH Resource configuration
|
||||||
|
* @remark Defined in TS 38.331 PUCCH-Config
|
||||||
|
*/
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
// Common PUCCH-Resource parameter
|
||||||
|
uint32_t starting_prb;
|
||||||
|
bool intra_slot_hopping;
|
||||||
|
uint32_t second_hop_prb;
|
||||||
|
|
||||||
|
// Common PUCCH-Resource parameters among all formats
|
||||||
|
srslte_pucch_nr_format_t format; ///< PUCCH format this configuration belongs
|
||||||
|
uint32_t nof_symbols; ///< Number of symbols
|
||||||
|
uint32_t start_symbol_idx; ///< Starting symbol index
|
||||||
|
|
||||||
|
// Specific PUCCH-Resource
|
||||||
|
uint32_t initial_cyclic_shift; ///< Used by formats 0, 1
|
||||||
|
uint32_t time_domain_occ; ///< Used by format 1
|
||||||
|
uint32_t nof_prb; ///< Used by formats 2, 3
|
||||||
|
uint32_t occ_lenth; ///< Spreading factor, used by format 4 (2, 4). Also called N_PUCCH4_SF
|
||||||
|
uint32_t occ_index; ///< Used by format 4
|
||||||
|
|
||||||
|
// PUCCH Format common parameters
|
||||||
|
bool enable_pi_bpsk; ///< Enables PI-BPSK
|
||||||
|
uint32_t max_code_rate; ///< Maximum code rate r (0..7)
|
||||||
|
bool additional_dmrs; ///< UE enables 2 DMRS symbols per hop of a PUCCH Format 3 or 4
|
||||||
|
} srslte_pucch_nr_resource_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Validates an NR-PUCCH resource configuration provided by upper layers
|
||||||
|
* @param resource Resource configuration to validate
|
||||||
|
* @return SRSLTE_SUCCESS if valid, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_cfg_resource_valid(const srslte_pucch_nr_resource_t* resource);
|
||||||
|
|
||||||
|
#endif // SRSLTE_PUCCH_CFG_NR_H
|
@ -0,0 +1,244 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_PUCCH_NR_H
|
||||||
|
#define SRSLTE_PUCCH_NR_H
|
||||||
|
|
||||||
|
#include "srslte/phy/ch_estimation/chest_ul.h"
|
||||||
|
#include "srslte/phy/common/phy_common_nr.h"
|
||||||
|
#include "srslte/phy/common/zc_sequence.h"
|
||||||
|
#include "srslte/phy/modem/modem_table.h"
|
||||||
|
#include "srslte/phy/phch/uci_nr.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum number of symbols (without DMRS) that NR-PUCCH format 1 can transmit
|
||||||
|
*/
|
||||||
|
#define SRSLTE_PUCCH_NR_FORMAT1_N_MAX 7
|
||||||
|
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
srslte_uci_nr_args_t uci;
|
||||||
|
uint32_t max_nof_prb;
|
||||||
|
} srslte_pucch_nr_args_t;
|
||||||
|
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
float rsrp;
|
||||||
|
float rsrp_dBfs;
|
||||||
|
float epre;
|
||||||
|
float epre_dBfs;
|
||||||
|
float norm_corr;
|
||||||
|
} srslte_pucch_nr_measure_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief NR-PUCCH encoder/decoder object
|
||||||
|
*/
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
uint32_t max_prb;
|
||||||
|
srslte_zc_sequence_lut_t r_uv_1prb;
|
||||||
|
cf_t format1_w_i_m[SRSLTE_PUCCH_NR_FORMAT1_N_MAX][SRSLTE_PUCCH_NR_FORMAT1_N_MAX][SRSLTE_PUCCH_NR_FORMAT1_N_MAX];
|
||||||
|
srslte_modem_table_t bpsk;
|
||||||
|
srslte_modem_table_t qpsk;
|
||||||
|
srslte_uci_nr_t uci;
|
||||||
|
uint8_t* b;
|
||||||
|
cf_t* d;
|
||||||
|
cf_t* ce;
|
||||||
|
} srslte_pucch_nr_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialises an NR-PUCCH encoder/decoder object
|
||||||
|
* @param q Object
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_init(srslte_pucch_nr_t* q, const srslte_pucch_nr_args_t* args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deallocates an NR-PUCCH encoder/decoder object
|
||||||
|
* @param q Object
|
||||||
|
*/
|
||||||
|
SRSLTE_API void srslte_pucch_nr_free(srslte_pucch_nr_t* q);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Computes the NR-PUCCH group sequence
|
||||||
|
* @remark Implemented according to TS 38.211 clause 6.3.2.2.1 Group and sequence hopping
|
||||||
|
* @param[in] carrier Serving cell and UL BWP configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[out] u_ Group sequence (u)
|
||||||
|
* @param[out] v_ Base sequence (v)
|
||||||
|
* @return SRSLTE_SUCCESS if provide arguments are right, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_group_sequence(const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
uint32_t* u_,
|
||||||
|
uint32_t* v_);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Computes the NR alpha index (1-NRE)
|
||||||
|
* @param[in] carrier Serving cell and UL BWP configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] l OFDM Symbol, relative to the NR-PUCCH transmission start
|
||||||
|
* @param[in] l_prime Initial OFDM symbol, relative to the transmission slot start
|
||||||
|
* @param[in] m0 Initial cyclic shift
|
||||||
|
* @param[in] m_cs Set to zero expect for format 0
|
||||||
|
* @param[out] alpha_idx Computed alpha index
|
||||||
|
* @return SRSLTE_SUCCESS if provide arguments are right, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_alpha_idx(const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
uint32_t l,
|
||||||
|
uint32_t l_prime,
|
||||||
|
uint32_t m0,
|
||||||
|
uint32_t m_cs,
|
||||||
|
uint32_t* alpha_idx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encode and writes NR-PUCCH format 0 in the resource grid
|
||||||
|
* @remark Described in TS 38.211 clause 6.3.2.3 PUCCH format 0
|
||||||
|
* @param[in,out] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Serving cell and Uplink BWP configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 0 resource
|
||||||
|
* @param[in] m_cs Cyclic shift according to TS 38.213 clause 5
|
||||||
|
* @param[out] slot_symbols Resource grid of the given slot
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_format0_encode(const srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
srslte_pucch_nr_resource_t* resource,
|
||||||
|
uint32_t m_cs,
|
||||||
|
cf_t* slot_symbols);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Measures PUCCH format 0 in the resource grid
|
||||||
|
* @param[in,out] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Serving cell and Uplink BWP configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 0 resource
|
||||||
|
* @param[in] m_cs Cyclic shift according to TS 38.213 clause 5
|
||||||
|
* @param[in] slot_symbols Resource grid of the given slot
|
||||||
|
* @param[out] measure Measurement structure
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_format0_measure(const srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
srslte_pucch_nr_resource_t* resource,
|
||||||
|
uint32_t m_cs,
|
||||||
|
const cf_t* slot_symbols,
|
||||||
|
srslte_pucch_nr_measure_t* measure);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get NR-PUCCH orthogonal sequence w
|
||||||
|
* @remark Defined by TS 38.211 Table 6.3.2.4.1-2: Orthogonal sequences ... for PUCCH format 1
|
||||||
|
* @param[in,out] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] n_pucch Number of PUCCH symbols
|
||||||
|
* @param[in] i sequence index
|
||||||
|
* @param m OFDM symbol index
|
||||||
|
* @return Orthogonal sequence complex number if valid, NAN otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API cf_t srslte_pucch_nr_format1_w(const srslte_pucch_nr_t* q, uint32_t n_pucch, uint32_t i, uint32_t m);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encodes and puts NR-PUCCH format 1 in the resource grid
|
||||||
|
* @remark Described in TS 38.211 clause 6.3.2.4 PUCCH format 1
|
||||||
|
* @param[in,out] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Serving cell and Uplink BWP configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 1 resource
|
||||||
|
* @param[in] b Bits to encode in the message
|
||||||
|
* @param[in] nof_bits Number of bits to encode in the message
|
||||||
|
* @param[out] slot_symbols Resource grid of the given slot
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_format1_encode(const srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
const srslte_pucch_nr_resource_t* resource,
|
||||||
|
uint8_t* b,
|
||||||
|
uint32_t nof_bits,
|
||||||
|
cf_t* slot_symbols);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Decodes NR-PUCCH format 1
|
||||||
|
* @param[in,out] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Serving cell and Uplink BWP configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 2-4 resource
|
||||||
|
* @param[in] chest_res Channel estimator result
|
||||||
|
* @param[in] slot_symbols Resource grid of the given slot
|
||||||
|
* @param[out] b Bits to decode
|
||||||
|
* @param[in] nof_bits Number of bits to decode in the message
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_format1_decode(srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
const srslte_pucch_nr_resource_t* resource,
|
||||||
|
srslte_chest_ul_res_t* chest_res,
|
||||||
|
cf_t* slot_symbols,
|
||||||
|
uint8_t b[SRSLTE_PUCCH_NR_FORMAT1_MAX_NOF_BITS],
|
||||||
|
uint32_t nof_bits);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encoder NR-PUCCH formats 2, 3 and 4. The NR-PUCCH format is selected by resource->format.
|
||||||
|
* @param[in,out] q NR-PUCCH encoder/decoder object
|
||||||
|
* @param[in] carrier Serving cell and Uplink BWP configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 1 resource
|
||||||
|
* @param[in] uci_cfg Uplink Control Information configuration
|
||||||
|
* @param[in] uci_value Uplink Control Information data
|
||||||
|
* @param[out] slot_symbols Resource grid of the given slot
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_format_2_3_4_encode(srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
const srslte_pucch_nr_resource_t* resource,
|
||||||
|
const srslte_uci_cfg_nr_t* uci_cfg,
|
||||||
|
const srslte_uci_value_nr_t* uci_value,
|
||||||
|
cf_t* slot_symbols);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Decode NR-PUCCH format 2, 3, and 4. The NR-PUCCH format is selected by resource->format.
|
||||||
|
* @param q[in,out] q NR-PUCCH encoder/decoder
|
||||||
|
* @param[in] carrier Serving cell and Uplink BWP configuration
|
||||||
|
* @param[in] cfg PUCCH common configuration
|
||||||
|
* @param[in] slot slot configuration
|
||||||
|
* @param[in] resource PUCCH format 2-4 resource
|
||||||
|
* @param[in] uci_cfg Uplink Control Information configuration
|
||||||
|
* @param[in] chest_res Channel estimator result
|
||||||
|
* @param[in] slot_symbols Resource grid of the given slot
|
||||||
|
* @param[out] uci_value Uplink Control Information data
|
||||||
|
* @return SRSLTE_SUCCESS if successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_pucch_nr_format_2_3_4_decode(srslte_pucch_nr_t* q,
|
||||||
|
const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_pucch_nr_common_cfg_t* cfg,
|
||||||
|
const srslte_dl_slot_cfg_t* slot,
|
||||||
|
const srslte_pucch_nr_resource_t* resource,
|
||||||
|
const srslte_uci_cfg_nr_t* uci_cfg,
|
||||||
|
srslte_chest_ul_res_t* chest_res,
|
||||||
|
cf_t* slot_symbols,
|
||||||
|
srslte_uci_value_nr_t* uci_value);
|
||||||
|
|
||||||
|
#endif // SRSLTE_PUCCH_NR_H
|
@ -0,0 +1,95 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_PUSCH_NR_H
|
||||||
|
#define SRSLTE_PUSCH_NR_H
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include "srslte/phy/ch_estimation/dmrs_sch.h"
|
||||||
|
#include "srslte/phy/modem/evm.h"
|
||||||
|
#include "srslte/phy/modem/modem_table.h"
|
||||||
|
#include "srslte/phy/phch/phch_cfg_nr.h"
|
||||||
|
#include "srslte/phy/phch/regs.h"
|
||||||
|
#include "srslte/phy/phch/sch_nr.h"
|
||||||
|
#include "srslte/phy/scrambling/scrambling.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief PUSCH encoder and decoder initialization arguments
|
||||||
|
*/
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
srslte_sch_nr_args_t sch;
|
||||||
|
bool measure_evm;
|
||||||
|
bool measure_time;
|
||||||
|
} srslte_pusch_nr_args_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief PDSCH NR object
|
||||||
|
*/
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
uint32_t max_prb; ///< Maximum number of allocated prb
|
||||||
|
uint32_t max_layers; ///< Maximum number of allocated layers
|
||||||
|
uint32_t max_cw; ///< Maximum number of allocated code words
|
||||||
|
srslte_carrier_nr_t carrier; ///< NR carrier configuration
|
||||||
|
srslte_sch_nr_t sch; ///< SCH Encoder/Decoder Object
|
||||||
|
uint8_t* b[SRSLTE_MAX_CODEWORDS]; ///< SCH Encoded and scrambled data
|
||||||
|
cf_t* d[SRSLTE_MAX_CODEWORDS]; ///< PDSCH modulated bits
|
||||||
|
cf_t* x[SRSLTE_MAX_LAYERS_NR]; ///< PDSCH modulated bits
|
||||||
|
srslte_modem_table_t modem_tables[SRSLTE_MOD_NITEMS]; ///< Modulator tables
|
||||||
|
srslte_evm_buffer_t* evm_buffer;
|
||||||
|
bool meas_time_en;
|
||||||
|
uint32_t meas_time_us;
|
||||||
|
} srslte_pusch_nr_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
uint8_t* payload;
|
||||||
|
bool crc;
|
||||||
|
float evm;
|
||||||
|
} srslte_pusch_res_nr_t;
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pusch_nr_init_enb(srslte_pusch_nr_t* q, const srslte_pusch_nr_args_t* args);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pusch_nr_init_ue(srslte_pusch_nr_t* q, const srslte_pusch_nr_args_t* args);
|
||||||
|
|
||||||
|
SRSLTE_API void srslte_pusch_nr_free(srslte_pusch_nr_t* q);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pusch_nr_set_carrier(srslte_pusch_nr_t* q, const srslte_carrier_nr_t* carrier);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pusch_nr_encode(srslte_pusch_nr_t* q,
|
||||||
|
const srslte_sch_cfg_nr_t* cfg,
|
||||||
|
const srslte_sch_grant_nr_t* grant,
|
||||||
|
uint8_t* data[SRSLTE_MAX_TB],
|
||||||
|
cf_t* sf_symbols[SRSLTE_MAX_PORTS]);
|
||||||
|
|
||||||
|
SRSLTE_API int srslte_pusch_nr_decode(srslte_pusch_nr_t* q,
|
||||||
|
const srslte_sch_cfg_nr_t* cfg,
|
||||||
|
const srslte_sch_grant_nr_t* grant,
|
||||||
|
srslte_chest_dl_res_t* channel,
|
||||||
|
cf_t* sf_symbols[SRSLTE_MAX_PORTS],
|
||||||
|
srslte_pusch_res_nr_t data[SRSLTE_MAX_TB]);
|
||||||
|
|
||||||
|
SRSLTE_API uint32_t srslte_pusch_nr_rx_info(const srslte_pusch_nr_t* q,
|
||||||
|
const srslte_sch_cfg_nr_t* cfg,
|
||||||
|
const srslte_sch_grant_nr_t* grant,
|
||||||
|
const srslte_pusch_res_nr_t* res,
|
||||||
|
char* str,
|
||||||
|
uint32_t str_len);
|
||||||
|
|
||||||
|
SRSLTE_API uint32_t srslte_pusch_nr_tx_info(const srslte_pusch_nr_t* q,
|
||||||
|
const srslte_sch_cfg_nr_t* cfg,
|
||||||
|
const srslte_sch_grant_nr_t* grant,
|
||||||
|
char* str,
|
||||||
|
uint32_t str_len);
|
||||||
|
|
||||||
|
#endif // SRSLTE_PUSCH_NR_H
|
@ -0,0 +1,91 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* @file ue_dl_nr.h
|
||||||
|
*
|
||||||
|
* Description: NR UE downlink physical layer procedures for data
|
||||||
|
*
|
||||||
|
* This module is a frontend to all the downlink data channel processing modules.
|
||||||
|
*
|
||||||
|
* Reference:
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_RA_DL_NR_H
|
||||||
|
#define SRSLTE_RA_DL_NR_H
|
||||||
|
|
||||||
|
#include "srslte/phy/common/phy_common_nr.h"
|
||||||
|
#include "srslte/phy/phch/dci_nr.h"
|
||||||
|
#include "srslte/phy/phch/phch_cfg_nr.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates the PDSCH time resource allocation and stores it in the provided PDSCH NR grant.
|
||||||
|
*
|
||||||
|
* @remark Defined by TS 38.214 V15.10.0 section 5.1.2.1.1 Determination of the resource allocation table to be used for
|
||||||
|
* PDSCH
|
||||||
|
*
|
||||||
|
* @param pdsch_cfg Flattened PDSCH configuration provided from higher layers
|
||||||
|
* @param rnti_type Type of the RNTI of the corresponding DCI
|
||||||
|
* @param ss_type Type of the SS for PDCCH
|
||||||
|
* @param m Time domain resource assignment field value m provided in DCI
|
||||||
|
* @param[out] Provides grant pointer to fill
|
||||||
|
* @return Returns SRSLTE_SUCCESS if the provided allocation is valid, otherwise it returns SRSLTE_ERROR code
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_ra_dl_nr_time(const srslte_sch_cfg_nr_t* pdsch_cfg,
|
||||||
|
const srslte_rnti_type_t rnti_type,
|
||||||
|
const srslte_search_space_type_t ss_type,
|
||||||
|
const uint8_t m,
|
||||||
|
srslte_sch_grant_nr_t* grant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates the PDSCH time resource default A and stores it in the provided PDSCH NR grant. This can be used by
|
||||||
|
* SI-RNTI, RA-RNTI, P-RNTI and C-RNTI. See Table 5.1.2.1.1-1 for more details about the usage.
|
||||||
|
*
|
||||||
|
* @remark Defined by TS 38.214 V15.10.0 Table 5.1.2.1.1-2: Default PDSCH time domain resource allocation A for normal
|
||||||
|
* CP
|
||||||
|
*
|
||||||
|
* @param m Time domain resource assignment field value m of the DCI
|
||||||
|
* @param dmrs_typeA_pos DMRS TypeA position provided by higher layers
|
||||||
|
* @param[out] grant PDSCH mapping type
|
||||||
|
* @return Returns SRSLTE_SUCCESS if the provided allocation is valid, otherwise it returns SRSLTE_ERROR code
|
||||||
|
*/
|
||||||
|
SRSLTE_API int
|
||||||
|
srslte_ra_dl_nr_time_default_A(uint32_t m, srslte_dmrs_sch_typeA_pos_t dmrs_typeA_pos, srslte_sch_grant_nr_t* grant);
|
||||||
|
/**
|
||||||
|
* @brief Calculates the number of PDSCH-DMRS CDM groups without data for DCI format 1_0
|
||||||
|
*
|
||||||
|
* @remark Defined by TS 38.214 V15.10.0 5.1.6.1.3 CSI-RS for mobility
|
||||||
|
*
|
||||||
|
* @param pdsch_cfg PDSCH NR configuration by upper layers
|
||||||
|
* @param[out] grant Provides grant pointer to fill
|
||||||
|
* @return Returns SRSLTE_SUCCESS if the provided data is valid, otherwise it returns SRSLTE_ERROR code
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_ra_dl_nr_nof_dmrs_cdm_groups_without_data_format_1_0(const srslte_sch_cfg_nr_t* pdsch_cfg,
|
||||||
|
srslte_sch_grant_nr_t* grant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates the PDSCH frequency resource allocation and stores it in the provided PDSCH NR grant.
|
||||||
|
*
|
||||||
|
* @remark Defined by TS 38.214 V15.10.0 section 5.1.2.2
|
||||||
|
* @param carrier Carrier information
|
||||||
|
* @param cfg PDSCH NR configuration by upper layers
|
||||||
|
* @param dci_dl Unpacked DCI used to schedule the PDSCH grant
|
||||||
|
* @param[out] grant Provides grant pointer to fill
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_ra_dl_nr_freq(const srslte_carrier_nr_t* carrier,
|
||||||
|
const srslte_sch_cfg_nr_t* cfg,
|
||||||
|
const srslte_dci_dl_nr_t* dci_dl,
|
||||||
|
srslte_sch_grant_nr_t* grant);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SRSLTE_RA_DL_NR_H
|
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_RA_UL_NR_H
|
||||||
|
#define SRSLTE_RA_UL_NR_H
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include "srslte/phy/phch/pucch_cfg_nr.h"
|
||||||
|
#include "uci_cfg_nr.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates the minimum number of PRB required for transmitting NR-PUCCH Format 2, 3 or 4
|
||||||
|
* @remark Based in TS 38.213 9.2.5.1 UE procedure for multiplexing HARQ-ACK or CSI and SR in a PUCCH
|
||||||
|
* @return The number of PRB if the provided configuration is valid, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_ra_ul_nr_pucch_format_2_3_min_prb(const srslte_pucch_nr_resource_t* resource,
|
||||||
|
const srslte_uci_cfg_nr_t* uci_cfg);
|
||||||
|
|
||||||
|
#endif // SRSLTE_RA_UL_NR_H
|
@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_UCI_CFG_NR_H
|
||||||
|
#define SRSLTE_UCI_CFG_NR_H
|
||||||
|
|
||||||
|
#include "srslte/phy/common/phy_common.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum number of HARQ ACK feedback bits that can be carried in Uplink Control Information (UCI) message
|
||||||
|
*/
|
||||||
|
#define SRSLTE_UCI_NR_MAX_ACK_BITS 360
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum number of Scheduling Request (SR) bits that can be carried in Uplink Control Information (UCI) message
|
||||||
|
*/
|
||||||
|
#define SRSLTE_UCI_NR_MAX_SR_BITS 10
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum number of Channel State Information part 1 (CSI1) bits that can be carried in Uplink Control
|
||||||
|
* Information (UCI) message
|
||||||
|
*/
|
||||||
|
#define SRSLTE_UCI_NR_MAX_CSI1_BITS 10
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Maximum number of Channel State Information part 2 (CSI2) bits that can be carried in Uplink Control
|
||||||
|
* Information (UCI) message
|
||||||
|
*/
|
||||||
|
#define SRSLTE_UCI_NR_MAX_CSI2_BITS 10
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Uplink Control Information (UCI) message configuration
|
||||||
|
*/
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
uint32_t o_ack; ///< Number of HARQ-ACK bits
|
||||||
|
uint32_t o_sr; ///< Number of SR bits
|
||||||
|
uint32_t o_csi1; ///< Number of CSI1 report number of bits
|
||||||
|
uint32_t o_csi2; ///< Number of CSI2 report number of bits
|
||||||
|
srslte_mod_t modulation; ///< Modulation (PUSCH only)
|
||||||
|
uint16_t rnti; ///< RNTI
|
||||||
|
} srslte_uci_cfg_nr_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Uplink Control Information (UCI) message packed information
|
||||||
|
*/
|
||||||
|
typedef struct SRSLTE_API {
|
||||||
|
uint8_t ack[SRSLTE_UCI_NR_MAX_ACK_BITS]; ///< HARQ ACK feedback bits
|
||||||
|
uint8_t sr[SRSLTE_UCI_NR_MAX_SR_BITS]; ///< Scheduling Request bits
|
||||||
|
uint8_t csi1[SRSLTE_UCI_NR_MAX_CSI1_BITS]; ///< Channel State Information part 1
|
||||||
|
uint8_t csi2[SRSLTE_UCI_NR_MAX_CSI2_BITS]; ///< Channel State Information part 2
|
||||||
|
bool valid; ///< Indicates whether the message has been decoded successfully, ignored in the transmitter
|
||||||
|
} srslte_uci_value_nr_t;
|
||||||
|
|
||||||
|
#endif // SRSLTE_UCI_CFG_NR_H
|
@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_UCI_NR_H
|
||||||
|
#define SRSLTE_UCI_NR_H
|
||||||
|
|
||||||
|
#include "srslte/phy/fec/crc.h"
|
||||||
|
#include "srslte/phy/fec/polar/polar_code.h"
|
||||||
|
#include "srslte/phy/fec/polar/polar_decoder.h"
|
||||||
|
#include "srslte/phy/fec/polar/polar_encoder.h"
|
||||||
|
#include "srslte/phy/fec/polar/polar_rm.h"
|
||||||
|
#include "srslte/phy/phch/pucch_cfg_nr.h"
|
||||||
|
#include "uci_cfg.h"
|
||||||
|
#include "uci_cfg_nr.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief NR-UCI Encoder/decoder initialization arguments
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
bool disable_simd; ///< Disable Polar code SIMD
|
||||||
|
float block_code_threshold; ///< Set normalised block code threshold (receiver only)
|
||||||
|
} srslte_uci_nr_args_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
srslte_polar_rm_t rm_tx;
|
||||||
|
srslte_polar_rm_t rm_rx;
|
||||||
|
srslte_polar_encoder_t encoder;
|
||||||
|
srslte_polar_decoder_t decoder;
|
||||||
|
srslte_crc_t crc6;
|
||||||
|
srslte_crc_t crc11;
|
||||||
|
srslte_polar_code_t code;
|
||||||
|
uint8_t* bit_sequence; ///< UCI bit sequence
|
||||||
|
uint8_t* c; ///< UCI code-block prior encoding or after decoding
|
||||||
|
uint8_t* allocated; ///< Polar code intermediate
|
||||||
|
uint8_t* d; ///< Polar code encoded intermediate
|
||||||
|
float block_code_threshold;
|
||||||
|
} srslte_uci_nr_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates the number of bits carried by PUCCH formats 2, 3 and 4 from the PUCCH resource
|
||||||
|
* @remark Defined in TS 38.212 Table 6.3.1.4-1: Total rate matching output sequence length Etot
|
||||||
|
* @param resource PUCCH format 2, 3 or 4 Resource provided by upper layers
|
||||||
|
* @return The number of bits if the provided resource is valid, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_uci_nr_pucch_format_2_3_4_E(const srslte_pucch_nr_resource_t* resource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates in advance how many CRC bits will be appended for a given amount of UCI bits (A)
|
||||||
|
* @remark Defined in TS 38.212 section 6.3.1.2 Code block segmentation and CRC attachment
|
||||||
|
* @param A Number of UCI bits to transmit
|
||||||
|
*/
|
||||||
|
SRSLTE_API uint32_t srslte_uci_nr_crc_len(uint32_t A);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialises NR-UCI encoder/decoder object
|
||||||
|
* @param[in,out] q NR-UCI object
|
||||||
|
* @param[in] args Configuration arguments
|
||||||
|
* @return SRSLTE_SUCCESS if initialization is successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_uci_nr_init(srslte_uci_nr_t* q, const srslte_uci_nr_args_t* args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deallocates NR-UCI encoder/decoder object
|
||||||
|
* @param[in,out] q NR-UCI object
|
||||||
|
*/
|
||||||
|
SRSLTE_API void srslte_uci_nr_free(srslte_uci_nr_t* q);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encodes UCI bits
|
||||||
|
*
|
||||||
|
* @attention Compatible only with PUCCH formats 2, 3 and 4
|
||||||
|
*
|
||||||
|
* @remark Defined in TS 38.212 section 6.3.1.1
|
||||||
|
*
|
||||||
|
* @param[in,out] q NR-UCI object
|
||||||
|
* @param[in] pucch_cfg Higher layers PUCCH configuration
|
||||||
|
* @param[in] uci_cfg UCI configuration
|
||||||
|
* @param[in] uci_value UCI values
|
||||||
|
* @param[out] o Output encoded bits
|
||||||
|
* @return Number of encoded bits if encoding is successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_uci_nr_encode_pucch(srslte_uci_nr_t* q,
|
||||||
|
const srslte_pucch_nr_resource_t* pucch_resource,
|
||||||
|
const srslte_uci_cfg_nr_t* uci_cfg,
|
||||||
|
const srslte_uci_value_nr_t* value,
|
||||||
|
uint8_t* o);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Decoder UCI bits
|
||||||
|
*
|
||||||
|
* @attention Compatible only with PUCCH formats 2, 3 and 4
|
||||||
|
*
|
||||||
|
* @param[in,out] q NR-UCI object
|
||||||
|
* @param[in] pucch_resource_cfg
|
||||||
|
* @param[in] uci_cfg
|
||||||
|
* @param[in] llr
|
||||||
|
* @param[out] value
|
||||||
|
* @return SRSLTE_SUCCESSFUL if it is successful, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_uci_nr_decode_pucch(srslte_uci_nr_t* q,
|
||||||
|
const srslte_pucch_nr_resource_t* pucch_resource_cfg,
|
||||||
|
const srslte_uci_cfg_nr_t* uci_cfg,
|
||||||
|
int8_t* llr,
|
||||||
|
srslte_uci_value_nr_t* value);
|
||||||
|
|
||||||
|
#endif // SRSLTE_UCI_NR_H
|
@ -1,75 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright 2013-2020 Software Radio Systems Limited
|
|
||||||
*
|
|
||||||
* This file is part of srsLTE.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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/.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* @file ue_dl_nr.h
|
|
||||||
*
|
|
||||||
* Description: NR UE downlink physical layer procedures for data
|
|
||||||
*
|
|
||||||
* This module is a frontend to all the downlink data channel processing modules.
|
|
||||||
*
|
|
||||||
* Reference:
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef SRSLTE_UE_DL_NR_DATA_H
|
|
||||||
#define SRSLTE_UE_DL_NR_DATA_H
|
|
||||||
|
|
||||||
#include "srslte/phy/common/phy_common_nr.h"
|
|
||||||
#include "srslte/phy/phch/pdsch_cfg_nr.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Calculates the PDSCH time resource provided by higher layers and stores it in the provided PDSCH NR grant.
|
|
||||||
*
|
|
||||||
* @remark Defined by TS 38.214 V15.10.0 section 5.1.2.1.1 Determination of the resource allocation table to be used for
|
|
||||||
* PDSCH
|
|
||||||
*
|
|
||||||
* @param pdsch_alloc Flattened PHY PDSCH allocation configuration provided from higher layers
|
|
||||||
* @param[out] grant PDSCH mapping type
|
|
||||||
* @return Returns SRSLTE_SUCCESS if the provided allocation is valid, otherwise it returns SRSLTE_ERROR code
|
|
||||||
*/
|
|
||||||
SRSLTE_API int srslte_ue_dl_nr_pdsch_time_resource_hl(const srslte_pdsch_allocation_t* pdsch_alloc,
|
|
||||||
srslte_pdsch_grant_nr_t* grant);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Calculates the PDSCH time resource default A and stores it in the provided PDSCH NR grant. This can be used by
|
|
||||||
* SI-RNTI, RA-RNTI, P-RNTI and C-RNTI. See Table 5.1.2.1.1-1 for more details about the usage.
|
|
||||||
*
|
|
||||||
* @remark Defined by TS 38.214 V15.10.0 Table 5.1.2.1.1-2: Default PDSCH time domain resource allocation A for normal
|
|
||||||
* CP
|
|
||||||
*
|
|
||||||
* @param m Time domain resource assignment field value m of the DCI
|
|
||||||
* @param dmrs_typeA_pos DMRS TypeA position provided by higher layers
|
|
||||||
* @param[out] grant PDSCH mapping type
|
|
||||||
* @return Returns SRSLTE_SUCCESS if the provided allocation is valid, otherwise it returns SRSLTE_ERROR code
|
|
||||||
*/
|
|
||||||
SRSLTE_API int srslte_ue_dl_nr_pdsch_time_resource_default_A(uint32_t m,
|
|
||||||
srslte_dmrs_pdsch_typeA_pos_t dmrs_typeA_pos,
|
|
||||||
srslte_pdsch_grant_nr_t* grant);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // SRSLTE_UE_DL_NR_DATA_H
|
|
@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* @file ue_dl_nr.h
|
||||||
|
*
|
||||||
|
* Description: NR UE uplink physical layer procedures for data
|
||||||
|
*
|
||||||
|
* This module is a frontend to all the uplink data channel processing modules.
|
||||||
|
*
|
||||||
|
* Reference:
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_UE_UL_DATA_H
|
||||||
|
#define SRSLTE_UE_UL_DATA_H
|
||||||
|
|
||||||
|
#include "srslte/phy/common/phy_common_nr.h"
|
||||||
|
#include "srslte/phy/phch/phch_cfg_nr.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates the PUSCH time resource default A and stores it in the provided PUSCH NR grant.
|
||||||
|
*
|
||||||
|
* @remark Defined by TS 38.214 V15.10.0 Table 6.1.2.1.1-2: Default PUSCH time domain resource allocation A for normal
|
||||||
|
* CP
|
||||||
|
*
|
||||||
|
* @param m Time domain resource assignment field value m of the DCI
|
||||||
|
* @param[out] grant PUSCH grant
|
||||||
|
* @return Returns SRSLTE_SUCCESS if the provided allocation is valid, otherwise it returns SRSLTE_ERROR code
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_ue_ul_nr_pdsch_time_resource_default_A(uint32_t m, srslte_sch_grant_nr_t* grant);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculates the number of PUSCH-DMRS CDM groups without data for DCI format 0_0
|
||||||
|
*
|
||||||
|
* @remark Defined by TS 38.214 V15.10.0 6.2.2 UE DM-RS transmission procedure
|
||||||
|
*
|
||||||
|
* @param cfg PUSCH NR configuration by upper layers
|
||||||
|
* @param[out] grant Provides grant pointer to fill
|
||||||
|
* @return Returns SRSLTE_SUCCESS if the provided data is valid, otherwise it returns SRSLTE_ERROR code
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_ue_ul_nr_nof_dmrs_cdm_groups_without_data_format_0_0(const srslte_sch_cfg_nr_t* cfg,
|
||||||
|
srslte_sch_grant_nr_t* grant);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SRSLTE_UE_UL_DATA_H
|
@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||||||
|
*
|
||||||
|
* By using this file, you agree to the terms and conditions set
|
||||||
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
|
* the distribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRSLTE_PRIMES_H
|
||||||
|
#define SRSLTE_PRIMES_H
|
||||||
|
|
||||||
|
#include "srslte/config.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Finds the smallest prime number greater than n
|
||||||
|
* @param[in] n Provide the number
|
||||||
|
* @return A prime number below 1193, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_prime_greater_than(uint32_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Finds the biggest prime number lesser than n
|
||||||
|
* @attention the maximum prime number it can return is 1193
|
||||||
|
* @param[in] n Provide the number
|
||||||
|
* @return A prime number below 1193, SRSLTE_ERROR code otherwise
|
||||||
|
*/
|
||||||
|
SRSLTE_API int srslte_prime_lower_than(uint32_t n);
|
||||||
|
|
||||||
|
#endif // SRSLTE_PRIMES_H
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue