Keep timeslot number in range 1-4 instead of 0-3 in parsing of SYNC frame

According to the tetra_tdma_time struct definition, the tn should be in range 1-4. Also, tetra_burst_sync_in increments the timeslot number when in a synchronized state. The timeslot is then normalized with normalize_tn which also expects the tn to be within the 1-4 range.

Change-Id: Ib0967fdeef3bf37c612124626a74d240aa571a66
This commit is contained in:
wbokslag 2022-09-16 15:11:09 +02:00
parent 16713cab01
commit 1b7ebde55d
2 changed files with 3 additions and 3 deletions

View File

@ -273,7 +273,7 @@ void tp_sap_udata_ind(enum tp_sap_data_type type, int blk_num, const uint8_t *bi
switch (type) { switch (type) {
case TPSAP_T_SB1: case TPSAP_T_SB1:
printf("TMB-SAP SYNC CC %s(0x%02x) ", osmo_ubit_dump(type2+4, 6), bits_to_uint(type2+4, 6)); printf("TMB-SAP SYNC CC %s(0x%02x) ", osmo_ubit_dump(type2+4, 6), bits_to_uint(type2+4, 6));
printf("TN %s(%u) ", osmo_ubit_dump(type2+10, 2), bits_to_uint(type2+10, 2)); printf("TN %s(%u) ", osmo_ubit_dump(type2+10, 2), bits_to_uint(type2+10, 2) + 1);
printf("FN %s(%2u) ", osmo_ubit_dump(type2+12, 5), bits_to_uint(type2+12, 5)); printf("FN %s(%2u) ", osmo_ubit_dump(type2+12, 5), bits_to_uint(type2+12, 5));
printf("MN %s(%2u) ", osmo_ubit_dump(type2+17, 6), bits_to_uint(type2+17, 6)); printf("MN %s(%2u) ", osmo_ubit_dump(type2+17, 6), bits_to_uint(type2+17, 6));
printf("MCC %s(%u) ", osmo_ubit_dump(type2+31, 10), bits_to_uint(type2+31, 10)); printf("MCC %s(%u) ", osmo_ubit_dump(type2+31, 10), bits_to_uint(type2+31, 10));
@ -281,7 +281,7 @@ void tp_sap_udata_ind(enum tp_sap_data_type type, int blk_num, const uint8_t *bi
/* obtain information from SYNC PDU */ /* obtain information from SYNC PDU */
if (tup->crc_ok) { if (tup->crc_ok) {
tcd->colour_code = bits_to_uint(type2+4, 6); tcd->colour_code = bits_to_uint(type2+4, 6);
tcd->time.tn = bits_to_uint(type2+10, 2); tcd->time.tn = bits_to_uint(type2+10, 2) + 1;
tcd->time.fn = bits_to_uint(type2+12, 5); tcd->time.fn = bits_to_uint(type2+12, 5);
tcd->time.mn = bits_to_uint(type2+17, 6); tcd->time.mn = bits_to_uint(type2+17, 6);
tcd->mcc = bits_to_uint(type2+31, 10); tcd->mcc = bits_to_uint(type2+31, 10);

View File

@ -276,7 +276,7 @@ static int rx_tmv_unitdata_ind(struct tetra_tmvsap_prim *tmvp, struct tetra_mac_
return 0; return 0;
gsmtap_msg = tetra_gsmtap_makemsg(&tup->tdma_time, tup->lchan, gsmtap_msg = tetra_gsmtap_makemsg(&tup->tdma_time, tup->lchan,
tup->tdma_time.tn, tup->tdma_time.tn-1, /* expects timeslot in 0-3 range */
/* FIXME: */ 0, 0, 0, /* FIXME: */ 0, 0, 0,
msg->l1h, msgb_l1len(msg), tms); msg->l1h, msgb_l1len(msg), tms);
if (gsmtap_msg) if (gsmtap_msg)