mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
4.4 KiB
C
154 lines
4.4 KiB
C
6 years ago
|
/*
|
||
|
* Copyright 2013-2019 Software Radio Systems Limited
|
||
8 years ago
|
*
|
||
|
* This file is part of srsLTE.
|
||
|
*
|
||
6 years ago
|
* srsLTE is free software: you can redistribute it and/or modify
|
||
8 years ago
|
* 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.
|
||
|
*
|
||
6 years ago
|
* srsLTE is distributed in the hope that it will be useful,
|
||
8 years ago
|
* 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/.
|
||
|
*
|
||
|
*/
|
||
8 years ago
|
|
||
7 years ago
|
#ifndef SRSENB_SCHEDULER_HARQ_H
|
||
|
#define SRSENB_SCHEDULER_HARQ_H
|
||
8 years ago
|
|
||
6 years ago
|
#include "srslte/common/bounded_bitset.h"
|
||
8 years ago
|
#include "srslte/common/log.h"
|
||
|
#include "srslte/interfaces/sched_interface.h"
|
||
6 years ago
|
#include <map>
|
||
8 years ago
|
|
||
|
namespace srsenb {
|
||
|
|
||
6 years ago
|
// MASK used for CCE allocations
|
||
|
typedef srslte::bounded_bitset<sched_interface::max_cce, true> pdcch_mask_t;
|
||
|
|
||
|
// Range of RBGs
|
||
|
class prb_range_t;
|
||
|
struct rbg_range_t {
|
||
|
uint32_t rbg_start = 0, rbg_end = 0;
|
||
|
rbg_range_t() = default;
|
||
|
rbg_range_t(uint32_t s, uint32_t e) : rbg_start(s), rbg_end(e) {}
|
||
|
rbg_range_t(const prb_range_t& rbgs, uint32_t P);
|
||
|
uint32_t length() const { return rbg_end - rbg_start; }
|
||
|
};
|
||
|
|
||
|
// Range of PRBs
|
||
|
struct prb_range_t {
|
||
|
uint32_t prb_start = 0, prb_end = 0;
|
||
|
prb_range_t() = default;
|
||
|
prb_range_t(uint32_t s, uint32_t e) : prb_start(s), prb_end(e) {}
|
||
|
prb_range_t(const rbg_range_t& rbgs, uint32_t P);
|
||
|
uint32_t length() { return prb_end - prb_start; }
|
||
|
static prb_range_t riv_to_prbs(uint32_t riv, uint32_t nof_prbs, int nof_vrbs = -1);
|
||
|
};
|
||
|
|
||
8 years ago
|
class harq_proc
|
||
|
{
|
||
|
public:
|
||
6 years ago
|
void config(uint32_t id, uint32_t max_retx, srslte::log* log_h);
|
||
7 years ago
|
void reset(uint32_t tb_idx);
|
||
6 years ago
|
uint32_t get_id() const;
|
||
|
bool is_empty() const;
|
||
|
bool is_empty(uint32_t tb_idx) const;
|
||
|
|
||
|
uint32_t nof_tx(uint32_t tb_idx) const;
|
||
|
uint32_t nof_retx(uint32_t tb_idx) const;
|
||
|
uint32_t get_tti() const;
|
||
|
bool get_ndi(uint32_t tb_idx) const;
|
||
6 years ago
|
uint32_t max_nof_retx() const;
|
||
6 years ago
|
|
||
8 years ago
|
protected:
|
||
|
|
||
7 years ago
|
void new_tx_common(uint32_t tb_idx, uint32_t tti, int mcs, int tbs);
|
||
6 years ago
|
void new_retx_common(uint32_t tb_idx, uint32_t tti, int* mcs, int* tbs);
|
||
|
bool has_pending_retx_common(uint32_t tb_idx) const;
|
||
6 years ago
|
void set_ack_common(uint32_t tb_idx, bool ack);
|
||
|
void reset_pending_data_common();
|
||
|
|
||
|
enum ack_t { NULL_ACK, NACK, ACK };
|
||
6 years ago
|
|
||
6 years ago
|
ack_t ack_state[SRSLTE_MAX_TB];
|
||
7 years ago
|
bool active[SRSLTE_MAX_TB];
|
||
7 years ago
|
bool ndi[SRSLTE_MAX_TB];
|
||
8 years ago
|
uint32_t id;
|
||
|
uint32_t max_retx;
|
||
7 years ago
|
uint32_t n_rtx[SRSLTE_MAX_TB];
|
||
|
uint32_t tx_cnt[SRSLTE_MAX_TB];
|
||
8 years ago
|
int tti;
|
||
7 years ago
|
int last_mcs[SRSLTE_MAX_TB];
|
||
|
int last_tbs[SRSLTE_MAX_TB];
|
||
8 years ago
|
|
||
6 years ago
|
srslte::log* log_h;
|
||
6 years ago
|
};
|
||
|
|
||
|
typedef srslte::bounded_bitset<25, true> rbgmask_t;
|
||
8 years ago
|
|
||
|
class dl_harq_proc : public harq_proc
|
||
|
{
|
||
|
public:
|
||
6 years ago
|
dl_harq_proc();
|
||
6 years ago
|
void new_tx(const rbgmask_t& new_mask, uint32_t tb_idx, uint32_t tti, int mcs, int tbs, uint32_t n_cce_);
|
||
|
void new_retx(const rbgmask_t& new_mask, uint32_t tb_idx, uint32_t tti_, int* mcs, int* tbs, uint32_t n_cce_);
|
||
|
void set_ack(uint32_t tb_idx, bool ack);
|
||
|
rbgmask_t get_rbgmask() const;
|
||
6 years ago
|
bool has_pending_retx(uint32_t tb_idx, uint32_t tti) const;
|
||
|
int get_tbs(uint32_t tb_idx) const;
|
||
6 years ago
|
uint32_t get_n_cce() const;
|
||
|
void reset_pending_data();
|
||
|
|
||
8 years ago
|
private:
|
||
6 years ago
|
rbgmask_t rbgmask;
|
||
|
uint32_t n_cce;
|
||
8 years ago
|
};
|
||
|
|
||
|
class ul_harq_proc : public harq_proc
|
||
|
{
|
||
|
public:
|
||
|
|
||
7 years ago
|
struct ul_alloc_t {
|
||
8 years ago
|
uint32_t RB_start;
|
||
|
uint32_t L;
|
||
6 years ago
|
void set(uint32_t start, uint32_t len)
|
||
|
{
|
||
|
RB_start = start;
|
||
|
L = len;
|
||
|
}
|
||
6 years ago
|
uint32_t RB_end() const { return RB_start + L; }
|
||
7 years ago
|
};
|
||
6 years ago
|
|
||
6 years ago
|
void new_tx(uint32_t tti, int mcs, int tbs, ul_alloc_t alloc, uint32_t max_retx_);
|
||
|
void new_retx(uint32_t tb_idx, uint32_t tti_, int* mcs, int* tbs, ul_alloc_t alloc);
|
||
|
void set_ack(uint32_t tb_idx, bool ack);
|
||
6 years ago
|
|
||
6 years ago
|
ul_alloc_t get_alloc() const;
|
||
|
bool has_pending_retx() const;
|
||
|
bool is_adaptive_retx() const;
|
||
7 years ago
|
|
||
|
void reset_pending_data();
|
||
6 years ago
|
bool has_pending_ack() const;
|
||
|
bool get_pending_ack() const;
|
||
|
uint32_t get_pending_data() const;
|
||
6 years ago
|
|
||
8 years ago
|
private:
|
||
6 years ago
|
ul_alloc_t allocation;
|
||
8 years ago
|
int pending_data;
|
||
|
bool is_adaptive;
|
||
6 years ago
|
ack_t pending_ack;
|
||
8 years ago
|
};
|
||
|
|
||
6 years ago
|
typedef srslte::bounded_bitset<100, true> prbmask_t;
|
||
6 years ago
|
|
||
|
} // namespace srsenb
|
||
8 years ago
|
|
||
7 years ago
|
#endif // SRSENB_SCHEDULER_HARQ_H
|