|
|
@ -826,15 +826,12 @@ uint8_t sch_subh::phr_report_table(float phr_value)
|
|
|
|
void rar_pdu::fprint(FILE* stream)
|
|
|
|
void rar_pdu::fprint(FILE* stream)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fprintf(stream, "MAC PDU for RAR. ");
|
|
|
|
fprintf(stream, "MAC PDU for RAR. ");
|
|
|
|
if (has_backoff_indicator) {
|
|
|
|
|
|
|
|
fprintf(stream, "Backoff Indicator %d. ", backoff_indicator);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pdu::fprint(stream);
|
|
|
|
pdu::fprint(stream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rar_pdu::rar_pdu(uint32_t max_rars_) : pdu(max_rars_)
|
|
|
|
rar_pdu::rar_pdu(uint32_t max_rars_) : pdu(max_rars_)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
backoff_indicator = 0;
|
|
|
|
backoff_indicator = 0;
|
|
|
|
has_backoff_indicator = false;
|
|
|
|
has_backoff_indicator = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -861,7 +858,7 @@ bool rar_pdu::write_packet(uint8_t* ptr)
|
|
|
|
if (has_backoff_indicator) {
|
|
|
|
if (has_backoff_indicator) {
|
|
|
|
*(ptr) = backoff_indicator&0xf;
|
|
|
|
*(ptr) = backoff_indicator&0xf;
|
|
|
|
if (nof_subheaders > 0) {
|
|
|
|
if (nof_subheaders > 0) {
|
|
|
|
*(ptr) = 1<<7;
|
|
|
|
*(ptr) |= 1 << 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ptr++;
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -882,7 +879,12 @@ bool rar_pdu::write_packet(uint8_t* ptr)
|
|
|
|
|
|
|
|
|
|
|
|
void rar_subh::fprint(FILE* stream)
|
|
|
|
void rar_subh::fprint(FILE* stream)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fprintf(stream, "RAPID: %d, Temp C-RNTI: %d, TA: %d, UL Grant: ", preamble, temp_rnti, ta);
|
|
|
|
if (type == RAPID) {
|
|
|
|
|
|
|
|
fprintf(stream, "RAPID: %d, Temp C-RNTI: %d, TA: %d, UL Grant: ", preamble, temp_rnti, ta);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fprintf(stream, "Backoff Indicator %d. ", ((rar_pdu*)parent)->get_backoff());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
srslte_vec_fprint_hex(stream, grant, 20);
|
|
|
|
srslte_vec_fprint_hex(stream, grant, 20);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -898,6 +900,11 @@ uint32_t rar_subh::get_rapid()
|
|
|
|
return preamble;
|
|
|
|
return preamble;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool rar_subh::has_rapid()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return (type == RAPID);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rar_subh::get_sched_grant(uint8_t grant_[RAR_GRANT_LEN])
|
|
|
|
void rar_subh::get_sched_grant(uint8_t grant_[RAR_GRANT_LEN])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
memcpy(grant_, grant, sizeof(uint8_t)*RAR_GRANT_LEN);
|
|
|
|
memcpy(grant_, grant, sizeof(uint8_t)*RAR_GRANT_LEN);
|
|
|
@ -954,23 +961,25 @@ void rar_subh::write_payload(uint8_t** ptr)
|
|
|
|
|
|
|
|
|
|
|
|
void rar_subh::read_payload(uint8_t** ptr)
|
|
|
|
void rar_subh::read_payload(uint8_t** ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ta = ((uint32_t) *(*ptr + 0)&0x7f)<<4 | (*(*ptr + 1)&0xf0)>>4;
|
|
|
|
if (type == RAPID) {
|
|
|
|
grant[0] = *(*ptr + 1)&0x8?1:0;
|
|
|
|
ta = ((uint32_t) * (*ptr + 0) & 0x7f) << 4 | (*(*ptr + 1) & 0xf0) >> 4;
|
|
|
|
grant[1] = *(*ptr + 1)&0x4?1:0;
|
|
|
|
grant[0] = *(*ptr + 1) & 0x8 ? 1 : 0;
|
|
|
|
grant[2] = *(*ptr + 1)&0x2?1:0;
|
|
|
|
grant[1] = *(*ptr + 1) & 0x4 ? 1 : 0;
|
|
|
|
grant[3] = *(*ptr + 1)&0x1?1:0;
|
|
|
|
grant[2] = *(*ptr + 1) & 0x2 ? 1 : 0;
|
|
|
|
uint8_t *x = &grant[4];
|
|
|
|
grant[3] = *(*ptr + 1) & 0x1 ? 1 : 0;
|
|
|
|
srslte_bit_unpack(*(*ptr+2), &x, 8);
|
|
|
|
uint8_t* x = &grant[4];
|
|
|
|
srslte_bit_unpack(*(*ptr+3), &x, 8);
|
|
|
|
srslte_bit_unpack(*(*ptr + 2), &x, 8);
|
|
|
|
temp_rnti = ((uint16_t) *(*ptr + 4))<<8 | *(*ptr + 5);
|
|
|
|
srslte_bit_unpack(*(*ptr + 3), &x, 8);
|
|
|
|
*ptr += 6;
|
|
|
|
temp_rnti = ((uint16_t) * (*ptr + 4)) << 8 | *(*ptr + 5);
|
|
|
|
|
|
|
|
*ptr += 6;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool rar_subh::read_subheader(uint8_t** ptr)
|
|
|
|
bool rar_subh::read_subheader(uint8_t** ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool e_bit = *(*ptr) & 0x80?true:false;
|
|
|
|
bool e_bit = *(*ptr) & 0x80?true:false;
|
|
|
|
bool type = *(*ptr) & 0x40?true:false;
|
|
|
|
type = *(*ptr) & 0x40 ? RAPID : BACKOFF;
|
|
|
|
if (type) {
|
|
|
|
if (type == RAPID) {
|
|
|
|
preamble = *(*ptr) & 0x3f;
|
|
|
|
preamble = *(*ptr) & 0x3f;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
((rar_pdu*)parent)->set_backoff(*(*ptr) & 0xf);
|
|
|
|
((rar_pdu*)parent)->set_backoff(*(*ptr) & 0xf);
|
|
|
|