edge: Add init functions for gprs_rlc_data_info
Add the functions gprs_rlc_data_info_init_dl/ul which initialise a gprs_rlc_data_info structure depending on the coding scheme. The fields num_data_blocks, data_offs_bits, cs, and the data_blocks are valid after this call. The other fields are set to 0. The data blocks are initialised to the correct data_len, e == 1 (no extension header field), cv == 15 (not a final block). The other data block fields are set to 0. The gprs_rlc_data_block_info can also be initialised separately by using the gprs_rlc_data_block_info_init function. Sponsored-by: On-Waves ehf
This commit is contained in:
parent
92ae6d19c9
commit
64a16384c9
46
src/rlc.cpp
46
src/rlc.cpp
|
@ -265,3 +265,49 @@ bool gprs_rlc_ul_window::invalidate_bsn(const uint16_t bsn)
|
|||
|
||||
return was_valid;
|
||||
}
|
||||
|
||||
static void gprs_rlc_data_header_init(struct gprs_rlc_data_info *rlc,
|
||||
GprsCodingScheme cs, unsigned int header_bits)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
memset(rlc, 0, sizeof(*rlc));
|
||||
|
||||
rlc->cs = cs;
|
||||
rlc->num_data_blocks = cs.numDataBlocks();
|
||||
|
||||
OSMO_ASSERT(rlc->num_data_blocks <= ARRAY_SIZE(rlc->block_info));
|
||||
|
||||
for (i = 0; i < rlc->num_data_blocks; i++) {
|
||||
gprs_rlc_data_block_info_init(&rlc->block_info[i], cs);
|
||||
|
||||
rlc->data_offs_bits[i] =
|
||||
header_bits +
|
||||
(i+1) * cs.numDataBlockHeaderBits() +
|
||||
i * 8 * rlc->block_info[0].data_len;
|
||||
}
|
||||
}
|
||||
|
||||
void gprs_rlc_data_info_init_dl(struct gprs_rlc_data_info *rlc,
|
||||
GprsCodingScheme cs)
|
||||
{
|
||||
return gprs_rlc_data_header_init(rlc, cs, cs.numDataHeaderBitsDL());
|
||||
}
|
||||
|
||||
void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
|
||||
GprsCodingScheme cs)
|
||||
{
|
||||
return gprs_rlc_data_header_init(rlc, cs, cs.numDataHeaderBitsUL());
|
||||
}
|
||||
|
||||
void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
|
||||
GprsCodingScheme cs)
|
||||
{
|
||||
rdbi->data_len = cs.maxDataBlockBytes();
|
||||
rdbi->bsn = 0;
|
||||
rdbi->ti = 0;
|
||||
rdbi->e = 1;
|
||||
rdbi->cv = 15;
|
||||
rdbi->pi = 0;
|
||||
rdbi->spb = 0;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,13 @@ struct gprs_rlc_data {
|
|||
GprsCodingScheme cs;
|
||||
};
|
||||
|
||||
void gprs_rlc_data_info_init_dl(struct gprs_rlc_data_info *rlc,
|
||||
GprsCodingScheme cs);
|
||||
void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
|
||||
GprsCodingScheme cs);
|
||||
void gprs_rlc_data_block_info_init(struct gprs_rlc_data_block_info *rdbi,
|
||||
GprsCodingScheme cs);
|
||||
|
||||
/*
|
||||
* I hold the currently transferred blocks and will provide
|
||||
* the routines to manipulate these arrays.
|
||||
|
|
|
@ -481,7 +481,6 @@ static void test_rlc_unit_decoder()
|
|||
printf("=== end %s ===\n", __func__);
|
||||
}
|
||||
|
||||
|
||||
static const struct log_info_cat default_categories[] = {
|
||||
{"DCSN1", "\033[1;31m", "Concrete Syntax Notation One (CSN1)", LOGL_INFO, 0},
|
||||
{"DL1IF", "\033[1;32m", "GPRS PCU L1 interface (L1IF)", LOGL_DEBUG, 1},
|
||||
|
|
Loading…
Reference in New Issue