Bluetooth: Controller: df: Fix IQ sample data saturation info drop

Nordic Semiconductor Radio peripheral provides IQ samples as
12 bits signed integer with sign extended to 16 bits.
Where out of range IQ samples (saturated) have value -32768.

Due to conversion of IQ samples to 8 bit signed integer, required by
BT 5.3 Core Vol 4, Part E sections 7.7.65.21 and 7.7.65.22 the
saturation information was lost.

The PR fixes that issue by use of value -128 to mark saturated
IQ samples. Note that BT 5.3 Core does not give any particular
value of IQ sample a special meaning.

This is a vendor specific solution and does not affect other
implementations of lower link layer.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
This commit is contained in:
Piotr Pryga 2022-02-04 15:11:36 +01:00 committed by Carles Cufí
commit d04456f4d9
2 changed files with 19 additions and 5 deletions

View file

@ -2846,8 +2846,8 @@ static void le_df_connectionless_iq_report(struct pdu_data *pdu_rx,
sep->sample_count = 0U;
} else {
for (uint8_t idx = 0U; idx < samples_cnt; ++idx) {
sep->sample[idx].i = IQ_SHIFT_12_TO_8_BIT(iq_report->sample[idx].i);
sep->sample[idx].q = IQ_SHIFT_12_TO_8_BIT(iq_report->sample[idx].q);
sep->sample[idx].i = IQ_CONVERT_12_TO_8_BIT(iq_report->sample[idx].i);
sep->sample[idx].q = IQ_CONVERT_12_TO_8_BIT(iq_report->sample[idx].q);
}
sep->sample_count = samples_cnt;
@ -2969,8 +2969,8 @@ static void le_df_connection_iq_report(struct node_rx_pdu *node_rx, struct net_b
sep->sample_count = 0U;
} else {
for (uint8_t idx = 0U; idx < samples_cnt; ++idx) {
sep->sample[idx].i = IQ_SHIFT_12_TO_8_BIT(iq_report->sample[idx].i);
sep->sample[idx].q = IQ_SHIFT_12_TO_8_BIT(iq_report->sample[idx].q);
sep->sample[idx].i = IQ_CONVERT_12_TO_8_BIT(iq_report->sample[idx].i);
sep->sample[idx].q = IQ_CONVERT_12_TO_8_BIT(iq_report->sample[idx].q);
}
sep->sample_count = samples_cnt;
}