add type setter to sch_subh and use it for MCH PDUs

master
Andre Puschmann 5 years ago
parent e60a4490d2
commit 09610ce788

@ -172,7 +172,7 @@ protected:
}
};
typedef enum { SCH_SUBH_TYPE = 0, MCH_SUBH_TYPE = 1, RAR_SUBH_TYPE = 2 } subh_type;
typedef enum { SCH_SUBH_TYPE = 0, MCH_SUBH_TYPE = 1 } subh_type;
template <class SubH>
class subh
@ -267,6 +267,7 @@ public:
bool set_phr(float phr);
void set_padding();
void set_padding(uint32_t padding_len);
void set_type(subh_type type_);
void init();
void fprint(FILE* stream);
@ -372,15 +373,6 @@ private:
uint8_t backoff_indicator;
};
class mch_subh : public sch_subh
{
public:
mch_subh() : sch_subh(MCH_SUBH_TYPE) {}
// Size of MAC CEs
const static int MAC_CE_CONTRES_LEN = 6;
};
class mch_pdu : public sch_pdu
{
public:
@ -398,8 +390,7 @@ private:
last_sdu_idx = -1;
reset();
for (uint32_t i = 0; i < max_subheaders; i++) {
mch_subh subh;
subheaders[i] = subh;
subheaders[i].set_type(MCH_SUBH_TYPE);
subheaders[i].parent = this;
subheaders[i].init();
}

@ -476,7 +476,7 @@ bool sch_subh::get_next_mch_sched_info(uint8_t* lcid_, uint16_t* mtch_stop)
mtch_stop_ce = ((uint16_t)(payload[cur_mch_sched_ce * 2] & 0x07)) << 8;
mtch_stop_ce += payload[cur_mch_sched_ce * 2 + 1];
cur_mch_sched_ce++;
*mtch_stop = (mtch_stop_ce == srslte::mch_subh::MTCH_STOP_EMPTY) ? (0) : (mtch_stop_ce);
*mtch_stop = (mtch_stop_ce == sch_subh::MTCH_STOP_EMPTY) ? (0) : (mtch_stop_ce);
return true;
}
}
@ -535,6 +535,11 @@ void sch_subh::set_padding(uint32_t padding_len)
nof_bytes = padding_len;
}
void sch_subh::set_type(subh_type type_)
{
type = type_;
};
void sch_subh::set_padding()
{
set_padding(0);
@ -625,7 +630,7 @@ bool sch_subh::set_ta_cmd(uint8_t ta_cmd)
bool sch_subh::set_next_mch_sched_info(uint8_t lcid_, uint16_t mtch_stop)
{
if (((sch_pdu*)parent)->has_space_ce(2, true)) {
uint16_t mtch_stop_ce = (mtch_stop) ? (mtch_stop) : (srslte::mch_subh::MTCH_STOP_EMPTY);
uint16_t mtch_stop_ce = (mtch_stop) ? (mtch_stop) : (sch_subh::MTCH_STOP_EMPTY);
w_payload_ce[nof_mch_sched_ce * 2] = (lcid_ & 0x1F) << 3 | (uint8_t)((mtch_stop_ce & 0x0700) >> 8);
w_payload_ce[nof_mch_sched_ce * 2 + 1] = (uint8_t)(mtch_stop_ce & 0xff);
nof_mch_sched_ce++;

@ -426,13 +426,13 @@ uint8_t* ue::generate_mch_pdu(uint32_t harq_pid,
mch_mac_msg_dl.init_tx(&tx_payload_buffer[harq_pid][0], grant_size);
for (uint32_t i = 0; i < nof_pdu_elems; i++) {
if (sched.pdu[i].lcid == srslte::mch_subh::MCH_SCHED_INFO) {
if (sched.pdu[i].lcid == srslte::sch_subh::MCH_SCHED_INFO) {
mch_mac_msg_dl.new_subh();
mch_mac_msg_dl.get()->set_next_mch_sched_info(sched.mtch_sched[i].lcid, sched.mtch_sched[i].stop);
} else if (sched.pdu[i].lcid == 0) {
mch_mac_msg_dl.new_subh();
mch_mac_msg_dl.get()->set_sdu(0, sched.pdu[i].nbytes, sched.mcch_payload);
} else if (sched.pdu[i].lcid <= srslte::mch_subh::MTCH_MAX_LCID) {
} else if (sched.pdu[i].lcid <= srslte::sch_subh::MTCH_MAX_LCID) {
mch_mac_msg_dl.new_subh();
mch_mac_msg_dl.get()->set_sdu(sched.pdu[i].lcid, sched.pdu[i].nbytes, sched.mtch_sched[i].mtch_payload);
}

@ -231,13 +231,13 @@ void demux::process_sch_pdu(srslte::sch_pdu *pdu_msg)
void demux::process_mch_pdu(srslte::mch_pdu *mch_msg){
//disgarding headers that have already been processed
while(mch_msg->next()){
if(srslte::mch_subh::MCH_SCHED_INFO == mch_msg->get()->ce_type()){
uint16_t stop;
uint8_t lcid;
if(mch_msg->get()->get_next_mch_sched_info(&lcid, &stop)) {
Info("MCH Sched Info: LCID: %d, Stop: %d, tti is %d \n", lcid, stop, phy_h->get_current_tti());
}
if (srslte::sch_subh::MCH_SCHED_INFO == mch_msg->get()->ce_type()) {
uint16_t stop;
uint8_t lcid;
if (mch_msg->get()->get_next_mch_sched_info(&lcid, &stop)) {
Info("MCH Sched Info: LCID: %d, Stop: %d, tti is %d \n", lcid, stop, phy_h->get_current_tti());
}
}
if(mch_msg->get()->is_sdu()) {
uint32_t lcid = mch_msg->get()->get_sdu_lcid();

@ -373,7 +373,7 @@ void mac::mch_decoded(uint32_t len, bool crc)
mch_msg.parse_packet(mch_payload_buffer);
while (mch_msg.next()) {
for (uint32_t i = 0; i < phy_mbsfn_cfg.nof_mbsfn_services; i++) {
if (srslte::mch_subh::MCH_SCHED_INFO == mch_msg.get()->ce_type()) {
if (srslte::sch_subh::MCH_SCHED_INFO == mch_msg.get()->ce_type()) {
uint16_t stop;
uint8_t lcid;
if (mch_msg.get()->get_next_mch_sched_info(&lcid, &stop)) {

Loading…
Cancel
Save