mirror of https://github.com/PentHertz/srsLTE.git
Added Scheduling Request Procedure
This commit is contained in:
parent
0b3c611f38
commit
ae5316ae92
|
@ -33,6 +33,7 @@
|
||||||
#include "srsapps/common/timers.h"
|
#include "srsapps/common/timers.h"
|
||||||
#include "srsapps/ue/mac/mac_params.h"
|
#include "srsapps/ue/mac/mac_params.h"
|
||||||
#include "srsapps/ue/mac/pdu.h"
|
#include "srsapps/ue/mac/pdu.h"
|
||||||
|
#include "srsapps/ue/mac/sdu_handler.h"
|
||||||
|
|
||||||
#ifndef DEMUX_H
|
#ifndef DEMUX_H
|
||||||
#define DEMUX_H
|
#define DEMUX_H
|
||||||
|
@ -48,6 +49,8 @@ public:
|
||||||
demux();
|
demux();
|
||||||
void init(phy* phy_h_, log* log_h_, mac_io* mac_io_h_, timers* timers_db_);
|
void init(phy* phy_h_, log* log_h_, mac_io* mac_io_h_, timers* timers_db_);
|
||||||
|
|
||||||
|
void add_sdu_handler(sdu_handler *handler);
|
||||||
|
|
||||||
void push_pdu(uint8_t *mac_pdu, uint32_t nof_bits);
|
void push_pdu(uint8_t *mac_pdu, uint32_t nof_bits);
|
||||||
void push_pdu_bcch(uint8_t *mac_pdu, uint32_t nof_bits);
|
void push_pdu_bcch(uint8_t *mac_pdu, uint32_t nof_bits);
|
||||||
void push_pdu_temp_crnti(uint8_t *mac_pdu, uint32_t nof_bits);
|
void push_pdu_temp_crnti(uint8_t *mac_pdu, uint32_t nof_bits);
|
||||||
|
@ -73,6 +76,7 @@ private:
|
||||||
log *log_h;
|
log *log_h;
|
||||||
mac_io *mac_io_h;
|
mac_io *mac_io_h;
|
||||||
timers *timers_db;
|
timers *timers_db;
|
||||||
|
sdu_handler *sdu_handler_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "srsapps/ue/mac/proc_phr.h"
|
#include "srsapps/ue/mac/proc_phr.h"
|
||||||
#include "srsapps/ue/mac/mux.h"
|
#include "srsapps/ue/mac/mux.h"
|
||||||
#include "srsapps/ue/mac/demux.h"
|
#include "srsapps/ue/mac/demux.h"
|
||||||
|
#include "srsapps/ue/mac/sdu_handler.h"
|
||||||
|
|
||||||
#ifndef UEMAC_H
|
#ifndef UEMAC_H
|
||||||
#define UEMAC_H
|
#define UEMAC_H
|
||||||
|
@ -62,10 +63,14 @@ public:
|
||||||
int get_tti();
|
int get_tti();
|
||||||
void main_radio_loop(); // called after thread creation
|
void main_radio_loop(); // called after thread creation
|
||||||
|
|
||||||
|
void add_sdu_handler(sdu_handler *handler);
|
||||||
|
|
||||||
|
bool send_sdu(uint32_t lcid, uint8_t *sdu_payload, uint32_t nbytes);
|
||||||
bool send_ccch_sdu(uint8_t *sdu_payload, uint32_t nbytes);
|
bool send_ccch_sdu(uint8_t *sdu_payload, uint32_t nbytes);
|
||||||
bool send_dtch0_sdu(uint8_t *sdu_payload, uint32_t nbytes); // SRB0
|
bool send_dtch0_sdu(uint8_t *sdu_payload, uint32_t nbytes); // SRB0
|
||||||
bool send_dcch0_sdu(uint8_t *sdu_payload, uint32_t nbytes); // DRB0
|
bool send_dcch0_sdu(uint8_t *sdu_payload, uint32_t nbytes); // DRB0
|
||||||
|
|
||||||
|
int recv_sdu(uint32_t lcid, uint8_t *sdu_payload, uint32_t nbytes);
|
||||||
int recv_bcch_sdu(uint8_t *sdu_payload, uint32_t buffer_len_nbytes);
|
int recv_bcch_sdu(uint8_t *sdu_payload, uint32_t buffer_len_nbytes);
|
||||||
int recv_ccch_sdu(uint8_t *sdu_payload, uint32_t buffer_len_nbytes);
|
int recv_ccch_sdu(uint8_t *sdu_payload, uint32_t buffer_len_nbytes);
|
||||||
int recv_dtch0_sdu(uint8_t *sdu_payload, uint32_t buffer_len_nbytes); // SRB0
|
int recv_dtch0_sdu(uint8_t *sdu_payload, uint32_t buffer_len_nbytes); // SRB0
|
||||||
|
@ -129,7 +134,7 @@ private:
|
||||||
|
|
||||||
/* Other procedures */
|
/* Other procedures */
|
||||||
void process_dl_grants(uint32_t tti);
|
void process_dl_grants(uint32_t tti);
|
||||||
void process_ul_grants(uint32_t tti);
|
bool process_ul_grants(uint32_t tti);
|
||||||
void receive_pch(uint32_t tti);
|
void receive_pch(uint32_t tti);
|
||||||
|
|
||||||
/* Functions for MAC Timers */
|
/* Functions for MAC Timers */
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace ue {
|
||||||
RA_INITRECEIVEDPOWER,
|
RA_INITRECEIVEDPOWER,
|
||||||
RA_CONTENTIONTIMER,
|
RA_CONTENTIONTIMER,
|
||||||
|
|
||||||
|
SR_PUCCH_CONFIGURED,
|
||||||
SR_PUCCH_RESINDEX,
|
SR_PUCCH_RESINDEX,
|
||||||
SR_CONFIG_INDEX,
|
SR_CONFIG_INDEX,
|
||||||
SR_TRANS_MAX,
|
SR_TRANS_MAX,
|
||||||
|
|
|
@ -48,7 +48,8 @@ public:
|
||||||
void reset();
|
void reset();
|
||||||
void init(log *log_h, mac_io *mac_io_h);
|
void init(log *log_h, mac_io *mac_io_h);
|
||||||
|
|
||||||
bool is_pending_sdu();
|
bool is_pending_ccch_sdu();
|
||||||
|
bool is_pending_any_sdu();
|
||||||
|
|
||||||
uint8_t* pdu_pop(uint32_t pdu_sz);
|
uint8_t* pdu_pop(uint32_t pdu_sz);
|
||||||
bool pdu_move_to_msg3(uint32_t pdu_sz);
|
bool pdu_move_to_msg3(uint32_t pdu_sz);
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "srsapps/ue/mac/proc.h"
|
#include "srsapps/ue/mac/proc.h"
|
||||||
|
#include "srsapps/ue/phy/phy.h"
|
||||||
|
#include "srsapps/ue/mac/mac_params.h"
|
||||||
|
|
||||||
#ifndef PROCSR_H
|
#ifndef PROCSR_H
|
||||||
#define PROCSR_H
|
#define PROCSR_H
|
||||||
|
|
||||||
/* Scheduling Request procedure */
|
/* Scheduling Request procedure as defined in 5.4.4 of 36.321 */
|
||||||
|
|
||||||
namespace srslte {
|
namespace srslte {
|
||||||
namespace ue {
|
namespace ue {
|
||||||
|
@ -42,15 +44,20 @@ namespace ue {
|
||||||
class sr_proc : public proc
|
class sr_proc : public proc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void step(uint32_t tti) {
|
sr_proc();
|
||||||
if (is_running()) {
|
void init(log *log_h, mac_params *params_db, phy *phy_h);
|
||||||
fprintf(stderr, "SR procedure not implemented\n");
|
void step(uint32_t tti);
|
||||||
}
|
void reset();
|
||||||
}
|
void start();
|
||||||
void reset() {
|
bool need_random_access();
|
||||||
|
private:
|
||||||
}
|
uint32_t sr_counter;
|
||||||
|
uint32_t dsr_transmax;
|
||||||
|
bool is_pending_sr;
|
||||||
|
mac_params *params_db;
|
||||||
|
phy *phy_h;
|
||||||
|
log *log_h;
|
||||||
|
bool initiated;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 The srsLTE Developers. See the
|
||||||
|
* COPYRIGHT file at the top-level directory of this distribution.
|
||||||
|
*
|
||||||
|
* \section LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of the srsLTE library.
|
||||||
|
*
|
||||||
|
* 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 SDUHANDLER_H
|
||||||
|
#define SDUHANDLER_H
|
||||||
|
|
||||||
|
class sdu_handler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void notify_new_sdu(uint32_t lcid) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -37,6 +37,7 @@ demux::demux() : mac_msg(20),pending_mac_msg(20)
|
||||||
contention_resolution_id = 0;
|
contention_resolution_id = 0;
|
||||||
pending_temp_rnti = false;
|
pending_temp_rnti = false;
|
||||||
has_pending_contention_resolution_id = false;
|
has_pending_contention_resolution_id = false;
|
||||||
|
sdu_handler_ = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void demux::init(phy* phy_h_, log* log_h_, mac_io* mac_io_h_, timers* timers_db_)
|
void demux::init(phy* phy_h_, log* log_h_, mac_io* mac_io_h_, timers* timers_db_)
|
||||||
|
@ -47,6 +48,10 @@ void demux::init(phy* phy_h_, log* log_h_, mac_io* mac_io_h_, timers* timers_db_
|
||||||
timers_db = timers_db_;
|
timers_db = timers_db_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void demux::add_sdu_handler(sdu_handler* handler)
|
||||||
|
{
|
||||||
|
sdu_handler_ = handler;
|
||||||
|
}
|
||||||
|
|
||||||
bool demux::is_temp_crnti_pending()
|
bool demux::is_temp_crnti_pending()
|
||||||
{
|
{
|
||||||
|
@ -158,6 +163,15 @@ void demux::process_pdu(sch_pdu *pdu_msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* notify handler if registred */
|
||||||
|
if (sdu_handler_) {
|
||||||
|
pdu_msg->reset();
|
||||||
|
while(pdu_msg->next()) {
|
||||||
|
if (pdu_msg->get()->is_sdu()) {
|
||||||
|
sdu_handler_->notify_new_sdu(pdu_msg->get()->get_sdu_lcid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ bool mac::init(phy *phy_h_, tti_sync* ttisync_, log* log_h_)
|
||||||
mux_unit.init(log_h, &mac_io_lch);
|
mux_unit.init(log_h, &mac_io_lch);
|
||||||
demux_unit.init(phy_h, log_h, &mac_io_lch, &timers_db);
|
demux_unit.init(phy_h, log_h, &mac_io_lch, &timers_db);
|
||||||
ra_procedure.init(¶ms_db, phy_h, log_h, &timers_db, &mux_unit, &demux_unit);
|
ra_procedure.init(¶ms_db, phy_h, log_h, &timers_db, &mux_unit, &demux_unit);
|
||||||
|
sr_procedure.init(log_h, ¶ms_db, phy_h);
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
@ -168,16 +168,23 @@ void mac::main_radio_loop() {
|
||||||
}
|
}
|
||||||
if (is_synchronized) {
|
if (is_synchronized) {
|
||||||
/* Warning: Here order of invocation of procedures is important!! */
|
/* Warning: Here order of invocation of procedures is important!! */
|
||||||
|
bool ul_resources_available;
|
||||||
tti = ttisync->wait();
|
tti = ttisync->wait();
|
||||||
log_h->step(tti);
|
log_h->step(tti);
|
||||||
|
|
||||||
// Step all procedures
|
// Step all procedures
|
||||||
ra_procedure.step(tti);
|
ra_procedure.step(tti);
|
||||||
sr_procedure.step(tti);
|
//sr_procedure.step(tti);
|
||||||
bsr_procedure.step(tti);
|
bsr_procedure.step(tti);
|
||||||
phr_procedure.step(tti);
|
phr_procedure.step(tti);
|
||||||
|
|
||||||
|
// Check SR if we need to start RA
|
||||||
|
/*
|
||||||
|
if (sr_procedure.need_random_access()) {
|
||||||
|
ra_procedure.start_mac_order();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Receive PCH, if requested
|
// Receive PCH, if requested
|
||||||
receive_pch(tti);
|
receive_pch(tti);
|
||||||
|
|
||||||
|
@ -186,11 +193,11 @@ void mac::main_radio_loop() {
|
||||||
|
|
||||||
// Process UL grants if RA procedure is done and we have pending data or in contention resolution
|
// Process UL grants if RA procedure is done and we have pending data or in contention resolution
|
||||||
if (ra_procedure.is_contention_resolution() ||
|
if (ra_procedure.is_contention_resolution() ||
|
||||||
ra_procedure.is_successful() && mux_unit.is_pending_sdu())
|
ra_procedure.is_successful() && mux_unit.is_pending_ccch_sdu())
|
||||||
{
|
{
|
||||||
process_ul_grants(tti);
|
ul_resources_available = process_ul_grants(tti);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send pending HARQ ACK, if any, and contention resolution is resolved
|
// Send pending HARQ ACK, if any, and contention resolution is resolved
|
||||||
if (dl_harq.is_ack_pending_resolution()) {
|
if (dl_harq.is_ack_pending_resolution()) {
|
||||||
ra_procedure.step(tti);
|
ra_procedure.step(tti);
|
||||||
|
@ -203,17 +210,27 @@ void mac::main_radio_loop() {
|
||||||
timers_db.step_all();
|
timers_db.step_all();
|
||||||
|
|
||||||
// Check if there is pending CCCH SDU in Multiplexing Unit
|
// Check if there is pending CCCH SDU in Multiplexing Unit
|
||||||
if (mux_unit.is_pending_sdu()) {
|
if (mux_unit.is_pending_ccch_sdu()) {
|
||||||
// Start RA procedure
|
// Start RA procedure
|
||||||
if (!ra_procedure.in_progress() && !ra_procedure.is_successful()) {
|
if (!ra_procedure.in_progress() && !ra_procedure.is_successful()) {
|
||||||
Info("Starting RA procedure by RLC order\n");
|
Info("Starting RA procedure by RLC order\n");
|
||||||
ra_procedure.start_rlc_order();
|
ra_procedure.start_rlc_order();
|
||||||
}
|
}
|
||||||
}
|
} /*else if (mux_unit.is_pending_any_sdu()) {
|
||||||
|
// Sart SR if no PUSCH resources available for TTI+4
|
||||||
|
if (!ul_resources_available) {
|
||||||
|
sr_procedure.start();
|
||||||
|
Info("Starting Scheduling Request procedure\n");
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mac::add_sdu_handler(sdu_handler *handler) {
|
||||||
|
demux_unit.add_sdu_handler(handler);
|
||||||
|
}
|
||||||
|
|
||||||
void mac::setup_timers()
|
void mac::setup_timers()
|
||||||
{
|
{
|
||||||
if (params_db.get_param(mac_params::TIMER_TIMEALIGN) > 0) {
|
if (params_db.get_param(mac_params::TIMER_TIMEALIGN) > 0) {
|
||||||
|
@ -376,7 +393,7 @@ void mac::process_dl_grants(uint32_t tti) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* UL Grant reception and processin as defined in Section 5.4.1 in 36.321 */
|
/* UL Grant reception and processin as defined in Section 5.4.1 in 36.321 */
|
||||||
void mac::process_ul_grants(uint32_t tti) {
|
bool mac::process_ul_grants(uint32_t tti) {
|
||||||
// Get DL buffer for this TTI to look for DCI grants
|
// Get DL buffer for this TTI to look for DCI grants
|
||||||
dl_buffer *dl_buffer = phy_h->get_dl_buffer(tti);
|
dl_buffer *dl_buffer = phy_h->get_dl_buffer(tti);
|
||||||
|
|
||||||
|
@ -399,7 +416,7 @@ void mac::process_ul_grants(uint32_t tti) {
|
||||||
}
|
}
|
||||||
Info("Found UL Grant TBS=%d RNTI=%d is_from_rar=%d\n", ul_grant.get_tbs(), params_db.get_param(i), ul_grant.is_from_rar());
|
Info("Found UL Grant TBS=%d RNTI=%d is_from_rar=%d\n", ul_grant.get_tbs(), params_db.get_param(i), ul_grant.is_from_rar());
|
||||||
ul_harq.run_tti(tti, &ul_grant, phy_h);
|
ul_harq.run_tti(tti, &ul_grant, phy_h);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
else if (i == mac_params::RNTI_SPS) {
|
else if (i == mac_params::RNTI_SPS) {
|
||||||
if (ul_grant.get_ndi()) {
|
if (ul_grant.get_ndi()) {
|
||||||
|
@ -412,7 +429,7 @@ void mac::process_ul_grants(uint32_t tti) {
|
||||||
ul_sps_assig.reset(tti, &ul_grant);
|
ul_sps_assig.reset(tti, &ul_grant);
|
||||||
ul_grant.set_ndi(true);
|
ul_grant.set_ndi(true);
|
||||||
ul_harq.run_tti(tti, &ul_grant, phy_h);
|
ul_harq.run_tti(tti, &ul_grant, phy_h);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,13 +441,24 @@ void mac::process_ul_grants(uint32_t tti) {
|
||||||
if (sps_grant != NULL) {
|
if (sps_grant != NULL) {
|
||||||
sps_grant->set_ndi(true);
|
sps_grant->set_ndi(true);
|
||||||
ul_harq.run_tti(tti, sps_grant, phy_h);
|
ul_harq.run_tti(tti, sps_grant, phy_h);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ul_harq.run_tti(tti, phy_h);
|
ul_harq.run_tti(tti, phy_h);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int mac::recv_sdu(uint32_t lcid, uint8_t* sdu_payload, uint32_t nbytes)
|
||||||
|
{
|
||||||
|
if (lcid <= mac_io::MAC_LCH_PCCH_DL) {
|
||||||
|
return mac_io_lch.get(lcid)->recv(sdu_payload, nbytes);
|
||||||
|
} else {
|
||||||
|
Error("Receiving SDU: Invalid lcid=%d\n", lcid);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int mac::recv_bcch_sdu(uint8_t* sdu_payload, uint32_t buffer_len_nbytes)
|
int mac::recv_bcch_sdu(uint8_t* sdu_payload, uint32_t buffer_len_nbytes)
|
||||||
{
|
{
|
||||||
return mac_io_lch.get(mac_io::MAC_LCH_BCCH_DL)->recv(sdu_payload, buffer_len_nbytes);
|
return mac_io_lch.get(mac_io::MAC_LCH_BCCH_DL)->recv(sdu_payload, buffer_len_nbytes);
|
||||||
|
@ -452,6 +480,17 @@ int mac::recv_dcch0_sdu(uint8_t* sdu_payload, uint32_t buffer_len_nbytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool mac::send_sdu(uint32_t lcid, uint8_t* sdu_payload, uint32_t nbytes)
|
||||||
|
{
|
||||||
|
lcid += mac_io::MAC_LCH_CCCH_UL;
|
||||||
|
if (lcid <= mac_io::MAC_LCH_DTCH2_UL) {
|
||||||
|
return mac_io_lch.get(lcid)->send(sdu_payload, nbytes);
|
||||||
|
} else {
|
||||||
|
Error("Receiving SDU: Invalid lcid=%d\n", lcid);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool mac::send_ccch_sdu(uint8_t* sdu_payload, uint32_t nbytes)
|
bool mac::send_ccch_sdu(uint8_t* sdu_payload, uint32_t nbytes)
|
||||||
{
|
{
|
||||||
return mac_io_lch.get(mac_io::MAC_LCH_CCCH_UL)->send(sdu_payload, nbytes);
|
return mac_io_lch.get(mac_io::MAC_LCH_CCCH_UL)->send(sdu_payload, nbytes);
|
||||||
|
|
|
@ -65,7 +65,17 @@ void mux::reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mux::is_pending_sdu()
|
bool mux::is_pending_any_sdu()
|
||||||
|
{
|
||||||
|
for (int i=0;i<mac_io::NOF_UL_LCH;i++) {
|
||||||
|
if (!mac_io_h->get(i)->isempty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mux::is_pending_ccch_sdu()
|
||||||
{
|
{
|
||||||
return !mac_io_h->get(mac_io::MAC_LCH_CCCH_UL)->isempty();
|
return !mac_io_h->get(mac_io::MAC_LCH_CCCH_UL)->isempty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* \section COPYRIGHT
|
||||||
|
*
|
||||||
|
* Copyright 2013-2015 The srsLTE Developers. See the
|
||||||
|
* COPYRIGHT file at the top-level directory of this distribution.
|
||||||
|
*
|
||||||
|
* \section LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of the srsLTE library.
|
||||||
|
*
|
||||||
|
* 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/.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "srsapps/ue/mac/proc_sr.h"
|
||||||
|
#include "srsapps/ue/mac/mac_params.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace srslte {
|
||||||
|
namespace ue {
|
||||||
|
|
||||||
|
sr_proc::sr_proc() {
|
||||||
|
initiated = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sr_proc::init(log* log_h_, mac_params* params_db_, phy* phy_h_)
|
||||||
|
{
|
||||||
|
log_h = log_h_;
|
||||||
|
params_db = params_db_;
|
||||||
|
phy_h = phy_h_;
|
||||||
|
initiated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sr_proc::reset()
|
||||||
|
{
|
||||||
|
is_pending_sr = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sr_proc::step(uint32_t tti)
|
||||||
|
{
|
||||||
|
if (initiated) {
|
||||||
|
if (is_pending_sr) {
|
||||||
|
if (sr_counter < dsr_transmax) {
|
||||||
|
sr_counter++;
|
||||||
|
phy_h->get_ul_buffer(tti+4)->generate_sr();
|
||||||
|
} else {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool sr_proc::need_random_access() {
|
||||||
|
if (initiated) {
|
||||||
|
if (sr_counter == dsr_transmax && dsr_transmax > 0 ||
|
||||||
|
!params_db->get_param(mac_params::SR_PUCCH_CONFIGURED)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sr_proc::start()
|
||||||
|
{
|
||||||
|
if (initiated) {
|
||||||
|
if (params_db->get_param(mac_params::SR_PUCCH_CONFIGURED)) {
|
||||||
|
if (!is_pending_sr) {
|
||||||
|
sr_counter = 0;
|
||||||
|
dsr_transmax = params_db->get_param(mac_params::SR_TRANS_MAX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -201,9 +201,12 @@ void process_connsetup(LIBLTE_RRC_CONNECTION_SETUP_STRUCT *msg, srslte::ue::mac
|
||||||
mac->set_param(srslte::ue::mac_params::HARQ_MAXTX,
|
mac->set_param(srslte::ue::mac_params::HARQ_MAXTX,
|
||||||
liblte_rrc_max_harq_tx_num[msg->rr_cnfg.mac_main_cnfg.explicit_value.ulsch_cnfg.max_harq_tx]);
|
liblte_rrc_max_harq_tx_num[msg->rr_cnfg.mac_main_cnfg.explicit_value.ulsch_cnfg.max_harq_tx]);
|
||||||
|
|
||||||
mac->set_param(srslte::ue::mac_params::SR_PUCCH_RESINDEX, msg->rr_cnfg.phy_cnfg_ded.sched_request_cnfg.sr_pucch_resource_idx);
|
mac->set_param(srslte::ue::mac_params::SR_PUCCH_RESINDEX,
|
||||||
mac->set_param(srslte::ue::mac_params::SR_CONFIG_INDEX, msg->rr_cnfg.phy_cnfg_ded.sched_request_cnfg.sr_cnfg_idx);
|
msg->rr_cnfg.phy_cnfg_ded.sched_request_cnfg.sr_pucch_resource_idx);
|
||||||
mac->set_param(srslte::ue::mac_params::SR_TRANS_MAX, liblte_rrc_dsr_trans_max_num[msg->rr_cnfg.phy_cnfg_ded.sched_request_cnfg.dsr_trans_max]);
|
mac->set_param(srslte::ue::mac_params::SR_CONFIG_INDEX,
|
||||||
|
msg->rr_cnfg.phy_cnfg_ded.sched_request_cnfg.sr_cnfg_idx);
|
||||||
|
mac->set_param(srslte::ue::mac_params::SR_TRANS_MAX,
|
||||||
|
liblte_rrc_dsr_trans_max_num[msg->rr_cnfg.phy_cnfg_ded.sched_request_cnfg.dsr_trans_max]);
|
||||||
|
|
||||||
phy->set_param(srslte::ue::phy_params::UCI_I_OFFSET_ACK, msg->rr_cnfg.phy_cnfg_ded.pusch_cnfg_ded.beta_offset_ack_idx);
|
phy->set_param(srslte::ue::phy_params::UCI_I_OFFSET_ACK, msg->rr_cnfg.phy_cnfg_ded.pusch_cnfg_ded.beta_offset_ack_idx);
|
||||||
phy->set_param(srslte::ue::phy_params::UCI_I_OFFSET_CQI, msg->rr_cnfg.phy_cnfg_ded.pusch_cnfg_ded.beta_offset_cqi_idx);
|
phy->set_param(srslte::ue::phy_params::UCI_I_OFFSET_CQI, msg->rr_cnfg.phy_cnfg_ded.pusch_cnfg_ded.beta_offset_cqi_idx);
|
||||||
|
|
|
@ -96,6 +96,7 @@ bool ul_buffer::generate_cqi_report()
|
||||||
bool ul_buffer::generate_sr() {
|
bool ul_buffer::generate_sr() {
|
||||||
uci_data.scheduling_request = true;
|
uci_data.scheduling_request = true;
|
||||||
uci_pending = true;
|
uci_pending = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ul_buffer::uci_ready() {
|
bool ul_buffer::uci_ready() {
|
||||||
|
|
Loading…
Reference in New Issue