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.
109 lines
2.8 KiB
C
109 lines
2.8 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_MUX_H
|
||
|
#define SRSUE_MUX_H
|
||
8 years ago
|
|
||
|
#include <pthread.h>
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
8 years ago
|
#include "srslte/common/log.h"
|
||
8 years ago
|
#include "srslte/interfaces/ue_interfaces.h"
|
||
8 years ago
|
#include "srslte/common/pdu.h"
|
||
7 years ago
|
#include "proc_bsr.h"
|
||
|
#include "proc_phr.h"
|
||
8 years ago
|
|
||
|
/* Logical Channel Multiplexing and Prioritization + Msg3 Buffer */
|
||
|
|
||
|
|
||
|
typedef struct {
|
||
8 years ago
|
uint32_t id;
|
||
8 years ago
|
int Bj;
|
||
|
int PBR; // -1 sets to infinity
|
||
|
uint32_t BSD;
|
||
|
uint32_t priority;
|
||
|
int sched_len;
|
||
|
int buffer_len;
|
||
|
} lchid_t;
|
||
|
|
||
|
namespace srsue {
|
||
|
|
||
|
class mux
|
||
|
{
|
||
|
public:
|
||
6 years ago
|
mux();
|
||
8 years ago
|
void reset();
|
||
8 years ago
|
void init(rlc_interface_mac *rlc, srslte::log *log_h, bsr_interface_mux *bsr_procedure, phr_proc *phr_procedure_);
|
||
8 years ago
|
|
||
|
bool is_pending_any_sdu();
|
||
6 years ago
|
bool is_pending_sdu(uint32_t lcid);
|
||
|
|
||
|
uint8_t* pdu_get(uint8_t* payload, uint32_t pdu_sz, uint32_t pid);
|
||
8 years ago
|
uint8_t* msg3_get(uint8_t* payload, uint32_t pdu_sz);
|
||
|
|
||
|
void msg3_flush();
|
||
|
bool msg3_is_transmitted();
|
||
7 years ago
|
|
||
|
void msg3_prepare();
|
||
|
bool msg3_is_pending();
|
||
8 years ago
|
|
||
|
void append_crnti_ce_next_tx(uint16_t crnti);
|
||
|
|
||
|
void set_priority(uint32_t lcid, uint32_t priority, int PBR_x_tti, uint32_t BSD);
|
||
6 years ago
|
void clear_lch(uint32_t lch_id);
|
||
|
|
||
8 years ago
|
private:
|
||
|
int find_lchid(uint32_t lch_id);
|
||
|
bool pdu_move_to_msg3(uint32_t pdu_sz);
|
||
|
bool allocate_sdu(uint32_t lcid, srslte::sch_pdu *pdu, int max_sdu_sz);
|
||
|
bool sched_sdu(lchid_t *ch, int *sdu_space, int max_sdu_sz);
|
||
|
|
||
|
const static int MIN_RLC_SDU_LEN = 0;
|
||
6 years ago
|
const static int MAX_NOF_SUBHEADERS = 20;
|
||
|
|
||
|
std::vector<lchid_t> lch;
|
||
7 years ago
|
|
||
8 years ago
|
// Mutex for exclusive access
|
||
|
pthread_mutex_t mutex;
|
||
|
|
||
|
srslte::log *log_h;
|
||
|
rlc_interface_mac *rlc;
|
||
8 years ago
|
bsr_interface_mux *bsr_procedure;
|
||
8 years ago
|
phr_proc *phr_procedure;
|
||
|
uint16_t pending_crnti_ce;
|
||
6 years ago
|
|
||
8 years ago
|
/* Msg3 Buffer */
|
||
7 years ago
|
static const uint32_t MSG3_BUFF_SZ = 1024;
|
||
8 years ago
|
uint8_t msg3_buff[MSG3_BUFF_SZ];
|
||
7 years ago
|
uint8_t *msg3_buff_start_pdu;
|
||
|
|
||
8 years ago
|
/* PDU Buffer */
|
||
|
srslte::sch_pdu pdu_msg;
|
||
|
bool msg3_has_been_transmitted;
|
||
7 years ago
|
bool msg3_pending;
|
||
8 years ago
|
};
|
||
|
|
||
|
} // namespace srsue
|
||
|
|
||
7 years ago
|
#endif // SRSUE_MUX_H
|
||
8 years ago
|
|