Unpack SRS report TLV not expecting padding to be present

Add a function pullx32 to pull x amount of bytes into uint32_t
Change the unpacking to pull only the needed bytes, and skip over the padding, when not Aerial
Change SRS.indication dumping function to also print the report TLV contents
Change SRS.indication unitary test to fill the last 4 byte block of the report TLV according to the length, with padding
This commit is contained in:
Rúben Soares Silva
2025-03-31 10:15:08 +01:00
parent 1d479b2aa9
commit d9e3725a21
7 changed files with 83 additions and 13 deletions
+6 -3
View File
@@ -24,11 +24,14 @@
static void fil_srs_indication_report_tlv(nfapi_srs_report_tlv_t *tlv)
{
tlv->tag = rand16_range(0,3);
tlv->length = rand32_range(0,sizeof(tlv->value));
for (int i = 0; i < (tlv->length + 3) / 4; ++i) {
tlv->tag = rand16_range(0, 3);
tlv->length = rand32_range(1, sizeof(tlv->value));
const uint16_t last_idx = ((tlv->length + 3) / 4) - 1;
for (int i = 0; i < last_idx; ++i) {
tlv->value[i] = rand32();
}
const uint8_t num_bytes = 4 - get_tlv_padding(tlv->length);
tlv->value[last_idx] = rand32_range(0, 1 << (8 * num_bytes));
}
static void fill_srs_indication_PDU(nfapi_nr_srs_indication_pdu_t *pdu)