summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading
diff options
context:
space:
mode:
authorCyril Jourdan2013-04-18 14:40:34 +0200
committerCyril Jourdan2013-04-18 16:35:48 +0200
commit277d149f4d5e5ccd3b6a2cf666db75d83bf77539 (patch)
treef127ab7f79bf51af6edbe73b294b7bd160457d2a /cesar/ce/rx/bitloading
parent2a7437cb3982974c67f57e016f8dbae1a17735b8 (diff)
cesar/ce/rx/bl/fsm: check SRC to generate sound events, closes #3886
With this modification, sound frames with non interval specific SRCs are directed to global FSM. When in INTERVALS state, this causes a complete CE restart, what avoid sync issues between transmitter and receiver.
Diffstat (limited to 'cesar/ce/rx/bitloading')
-rw-r--r--cesar/ce/rx/bitloading/fsm/src/fsm.c27
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_intervals.c38
2 files changed, 56 insertions, 9 deletions
diff --git a/cesar/ce/rx/bitloading/fsm/src/fsm.c b/cesar/ce/rx/bitloading/fsm/src/fsm.c
index ef9df8bc1d..9f9e3dba56 100644
--- a/cesar/ce/rx/bitloading/fsm/src/fsm.c
+++ b/cesar/ce/rx/bitloading/fsm/src/fsm.c
@@ -109,16 +109,25 @@ ce_rx_bl_fsm_measure_to_event (sta_t *sta,
/* Global by default. */
has_interval = CE_RX_FSM_MEASURE_TO_EVENT_TYPE_GLOBAL;
measure->fsm_id = CE_RX_MEASURE_NO_INTERVAL;
- ce_rx_bl_intervals_measure_to_date (&measure->rx_params,&start_date_atu,
- &end_date_atu);
- interval = ce_rx_bl_intervals_measure_to_interval (sta->rx_tonemaps,
- start_date_atu,
- end_date_atu);
- if (interval != CE_RX_MEASURE_NO_INTERVAL)
+ /* Interval's research is only done if received measure is a data or a
+ * sound or sound complete with a SRC indicating that it is directed to
+ * an interval. Other SRCs should be handled by global FSM, even if they
+ * are received on a specific interval. */
+ if (type == CE_RX_FSM_MEASURE_TO_EVENT_TYPE_DATA
+ || measure->rx_params.sound_src == TONEMAP_SRC_INTERVAL_UNAVAILABLE
+ || measure->rx_params.sound_src == TONEMAP_SRC_INTERVAL_UNUSABLE)
{
- /* We are on an interval. */
- has_interval = CE_RX_FSM_MEASURE_TO_EVENT_TYPE_INTERVAL;
- measure->fsm_id = interval % mac_interval_fsm_count_;
+ ce_rx_bl_intervals_measure_to_date (&measure->rx_params,
+ &start_date_atu, &end_date_atu);
+ interval = ce_rx_bl_intervals_measure_to_interval (sta->rx_tonemaps,
+ start_date_atu,
+ end_date_atu);
+ if (interval != CE_RX_MEASURE_NO_INTERVAL)
+ {
+ /* We are on an interval. */
+ has_interval = CE_RX_FSM_MEASURE_TO_EVENT_TYPE_INTERVAL;
+ measure->fsm_id = interval % mac_interval_fsm_count_;
+ }
}
return event_tab[has_interval][type];
diff --git a/cesar/ce/rx/bitloading/test/src/test_intervals.c b/cesar/ce/rx/bitloading/test/src/test_intervals.c
index c319e2688e..4fb5f23f4e 100644
--- a/cesar/ce/rx/bitloading/test/src/test_intervals.c
+++ b/cesar/ce/rx/bitloading/test/src/test_intervals.c
@@ -228,6 +228,7 @@ test_suite_ce_rx_bl_intervals_measure_to_event_master_test (
int sound,
bool intervals,
bool mea_interval,
+ bool src_interval,
ce_rx_bl_fsm_event_type_t *event,
int *fsm_id)
{
@@ -255,6 +256,10 @@ test_suite_ce_rx_bl_intervals_measure_to_event_master_test (
/* Configure measure. */
measure.rx_params.sound = sound;
measure.rx_params.sound_complete = 0;
+ if (src_interval)
+ measure.rx_params.sound_src = TONEMAP_SRC_INTERVAL_UNAVAILABLE;
+ else
+ measure.rx_params.sound_src = TONEMAP_SRC_INITIAL;
measure.rx_params.preamble_ntb = 0;
measure.rx_params.beacon_period_start_ntb = 0;
/* Measure is global. */
@@ -288,6 +293,8 @@ test_suite_ce_rx_bl_intervals_measure_to_event (test_t t)
false,
/* Measure is positioned on an interval ? */
false,
+ /* SRC is interval specific ? */
+ false,
&out, &fsm_id);
test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_sound);
test_fail_if (fsm_id != -1);
@@ -303,6 +310,8 @@ test_suite_ce_rx_bl_intervals_measure_to_event (test_t t)
false,
/* Measure is positioned on an interval ? */
true,
+ /* SRC is interval specific ? */
+ false,
&out, &fsm_id);
test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_sound);
test_fail_if (fsm_id != -1);
@@ -318,6 +327,8 @@ test_suite_ce_rx_bl_intervals_measure_to_event (test_t t)
true,
/* Measure is positioned on an interval ? */
false,
+ /* SRC is interval specific ? */
+ true,
&out, &fsm_id);
test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_sound);
test_fail_if (fsm_id != -1);
@@ -333,10 +344,29 @@ test_suite_ce_rx_bl_intervals_measure_to_event (test_t t)
true,
/* Measure is positioned on an interval ? */
true,
+ /* SRC is interval specific ? */
+ true,
&out, &fsm_id);
test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_interval_sound);
test_fail_if (fsm_id != 0);
} test_end;
+ test_begin (t, "Measure to event conversion, sound, intervals, "
+ "small measure, SRC is global")
+ {
+ test_suite_ce_rx_bl_intervals_measure_to_event_master_test (
+ t,
+ /* Sound ? */
+ 1,
+ /* RX contains intervals ? */
+ true,
+ /* Measure is positioned on an interval ? */
+ true,
+ /* SRC is interval specific ? */
+ false,
+ &out, &fsm_id);
+ test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_sound);
+ test_fail_if (fsm_id != -1);
+ } test_end;
test_begin (t, "Measure to event conversion, not sound, no interval, "
"big measure")
{
@@ -348,6 +378,8 @@ test_suite_ce_rx_bl_intervals_measure_to_event (test_t t)
false,
/* Measure is positioned on an interval ? */
false,
+ /* SRC is interval specific ? */
+ false,
&out, &fsm_id);
test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_data);
test_fail_if (fsm_id != -1);
@@ -363,6 +395,8 @@ test_suite_ce_rx_bl_intervals_measure_to_event (test_t t)
false,
/* Measure is positioned on an interval ? */
true,
+ /* SRC is interval specific ? */
+ false,
&out, &fsm_id);
test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_data);
test_fail_if (fsm_id != -1);
@@ -378,6 +412,8 @@ test_suite_ce_rx_bl_intervals_measure_to_event (test_t t)
true,
/* Measure is positioned on an interval ? */
false,
+ /* SRC is interval specific ? */
+ true,
&out, &fsm_id);
test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_data);
test_fail_if (fsm_id != -1);
@@ -393,6 +429,8 @@ test_suite_ce_rx_bl_intervals_measure_to_event (test_t t)
true,
/* Measure is positioned on an interval ? */
true,
+ /* SRC is interval specific ? */
+ true,
&out, &fsm_id);
test_fail_if (out != CE_RX_BL_FSM_EVENT_TYPE_interval_data);
test_fail_if (fsm_id != 0);