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.
104 lines
2.9 KiB
C
104 lines
2.9 KiB
C
6 years ago
|
/*
|
||
|
* Copyright 2013-2019 Software Radio Systems Limited
|
||
8 years ago
|
*
|
||
6 years ago
|
* This file is part of srsLTE.
|
||
8 years ago
|
*
|
||
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/.
|
||
|
*
|
||
|
*/
|
||
|
|
||
7 years ago
|
#ifndef SRSUE_PROC_BSR_H
|
||
|
#define SRSUE_PROC_BSR_H
|
||
8 years ago
|
|
||
6 years ago
|
#include <map>
|
||
8 years ago
|
#include <stdint.h>
|
||
|
|
||
8 years ago
|
#include "srslte/common/log.h"
|
||
8 years ago
|
#include "srslte/interfaces/ue_interfaces.h"
|
||
8 years ago
|
#include "srslte/common/timers.h"
|
||
8 years ago
|
|
||
|
/* Buffer status report procedure */
|
||
|
|
||
|
namespace srsue {
|
||
|
|
||
8 years ago
|
class bsr_proc : public srslte::timer_callback, public bsr_interface_mux
|
||
8 years ago
|
{
|
||
|
public:
|
||
|
bsr_proc();
|
||
6 years ago
|
void init(rlc_interface_mac* rlc, srslte::log* log_h, srslte::timers* timers_db);
|
||
8 years ago
|
void step(uint32_t tti);
|
||
|
void reset();
|
||
6 years ago
|
void set_config(mac_interface_rrc::bsr_cfg_t& bsr_cfg);
|
||
|
|
||
|
void setup_lcid(uint32_t lcid, uint32_t lcg, uint32_t priority);
|
||
8 years ago
|
void timer_expired(uint32_t timer_id);
|
||
|
uint32_t get_buffer_state();
|
||
|
bool need_to_send_bsr_on_ul_grant(uint32_t grant_size, bsr_t *bsr);
|
||
|
bool generate_padding_bsr(uint32_t nof_padding_bytes, bsr_t *bsr);
|
||
6 years ago
|
bool need_to_send_sr(uint32_t tti);
|
||
|
bool need_to_reset_sr();
|
||
|
|
||
8 years ago
|
private:
|
||
6 years ago
|
const static int QUEUE_STATUS_PERIOD_MS = 1000;
|
||
|
|
||
|
pthread_mutex_t mutex;
|
||
|
|
||
8 years ago
|
bool reset_sr;
|
||
|
srslte::timers *timers_db;
|
||
|
srslte::log *log_h;
|
||
|
rlc_interface_mac *rlc;
|
||
6 years ago
|
|
||
|
mac_interface_rrc::bsr_cfg_t bsr_cfg;
|
||
|
|
||
8 years ago
|
bool initiated;
|
||
6 years ago
|
|
||
|
const static int NOF_LCG = 4;
|
||
|
|
||
|
typedef struct {
|
||
|
int priority;
|
||
|
uint32_t old_buffer;
|
||
|
uint32_t new_buffer;
|
||
|
} lcid_t;
|
||
|
|
||
|
std::map<uint32_t, lcid_t> lcgs[NOF_LCG]; // groups LCID in LCG
|
||
|
|
||
|
uint32_t find_max_priority_lcg();
|
||
8 years ago
|
typedef enum {NONE, REGULAR, PADDING, PERIODIC} triggered_bsr_type_t;
|
||
|
triggered_bsr_type_t triggered_bsr_type;
|
||
|
|
||
|
bool sr_is_sent;
|
||
|
uint32_t last_print;
|
||
6 years ago
|
uint32_t current_tti;
|
||
|
uint32_t trigger_tti;
|
||
|
|
||
|
void set_trigger(triggered_bsr_type_t new_trigger);
|
||
|
void update_new_data();
|
||
|
void update_buffer_state();
|
||
|
bool check_highest_channel();
|
||
|
bool check_new_data();
|
||
|
bool check_any_channel();
|
||
|
uint32_t get_buffer_state_lcg(uint32_t lcg);
|
||
|
bool generate_bsr(bsr_t* bsr, uint32_t nof_padding_bytes);
|
||
8 years ago
|
char* bsr_type_tostring(triggered_bsr_type_t type);
|
||
|
char* bsr_format_tostring(bsr_format_t format);
|
||
7 years ago
|
|
||
|
uint32_t timer_periodic_id;
|
||
|
uint32_t timer_retx_id;
|
||
8 years ago
|
};
|
||
|
|
||
|
} // namespace srsue
|
||
|
|
||
7 years ago
|
#endif // SRSUE_PROC_BSR_H
|