summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authordufour2009-09-16 11:06:40 +0000
committerdufour2009-09-16 11:06:40 +0000
commit57a47ea71e9833d0360b90b395fc52343574d3f2 (patch)
tree062a4f5e3ebb997206cec0463f76c7931953ba92 /cesar
parent54293dedaaf1f2a454132a84444fca74ba986d07 (diff)
* mac/common, ce/rx/cp, test_general/station/fcall:
- add a function to construct the list of TMI enabled in a bitfield, - use this function where needed. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@5571 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar')
-rw-r--r--cesar/ce/rx/cp/src/mbox.c18
-rw-r--r--cesar/mac/common/src/tonemap.c18
-rw-r--r--cesar/mac/common/tonemap.h10
-rw-r--r--cesar/test_general/station/fcall/src/tonemap.c10
4 files changed, 34 insertions, 22 deletions
diff --git a/cesar/ce/rx/cp/src/mbox.c b/cesar/ce/rx/cp/src/mbox.c
index 6b508de229..225e9f6905 100644
--- a/cesar/ce/rx/cp/src/mbox.c
+++ b/cesar/ce/rx/cp/src/mbox.c
@@ -55,13 +55,8 @@ ce_rx_cp_mbox_node_tonemap (ce_rx_t *ce_rx, cp_tei_t tei, tonemaps_t *tms,
/* Check parameters. */
dbg_assert (tms);
- /* Build TMI list. */
- uint i, tmi_list = 0;
- for (i = NEGOCIATED_TONEMAP_INDEX_FIRST; i < TONEMAP_INDEX_NB; i++)
- {
- if (tms->tm[i])
- tmi_list |= (1 << i);
- }
+ /* Get TMI list. */
+ u32 tmi_list = tonemaps_get_tonemap_enabled_list (tms);
/* Return allocated node. */
return ce_rx_cp_mbox_new_node (ce_rx, tei, tms->default_tmi, tmi_list,
@@ -75,13 +70,8 @@ ce_rx_cp_mbox_node_refresh_tmi (ce_rx_t *ce_rx, cp_tei_t tei, tonemaps_t *tms)
/* Check parameters. */
dbg_assert (tms);
- /* Build TMI list. */
- uint i, tmi_list = 0;
- for (i = NEGOCIATED_TONEMAP_INDEX_FIRST; i < TONEMAP_INDEX_NB; i++)
- {
- if (tms->tm[i])
- tmi_list |= (1 << i);
- }
+ /* Get TMI list. */
+ u32 tmi_list = tonemaps_get_tonemap_enabled_list (tms);
/* Return allocated node. */
return ce_rx_cp_mbox_new_node (ce_rx, tei, tms->default_tmi, tmi_list,
diff --git a/cesar/mac/common/src/tonemap.c b/cesar/mac/common/src/tonemap.c
index 704731fda6..f86e48e5e5 100644
--- a/cesar/mac/common/src/tonemap.c
+++ b/cesar/mac/common/src/tonemap.c
@@ -240,6 +240,24 @@ tonemaps_clean (tonemaps_t *tms)
return counter;
}
+u32
+tonemaps_get_tonemap_enabled_list (tonemaps_t *tms)
+{
+ /* Check parameters. */
+ u32 i, result = 0;
+
+ /* Go through each tone maps. */
+ for (i = NEGOCIATED_TONEMAP_INDEX_FIRST; i < TONEMAP_INDEX_NB; i++)
+ {
+ /* If tone maps is allocated and must be deleted now. */
+ if (tms->tm[i] && (tms->tm[i]->released == MAC_COMMON_TONEMAP_IN_USE))
+ {
+ result |= (1 << i);
+ }
+ }
+ return result;
+}
+
/**
* Compute log2 for BLE values.
* \param n integer number
diff --git a/cesar/mac/common/tonemap.h b/cesar/mac/common/tonemap.h
index ac1841d75e..cff3068c7c 100644
--- a/cesar/mac/common/tonemap.h
+++ b/cesar/mac/common/tonemap.h
@@ -340,6 +340,16 @@ u8
tonemaps_clean (tonemaps_t *tms);
/**
+ * Get the list of tone maps enabled.
+ * \param tms the set of tone map where we want the list of enabled tone
+ * maps.
+ * \return a bit field list with a one when the tone is enabled and zero when
+ * it is disabled.
+ */
+u32
+tonemaps_get_tonemap_enabled_list (tonemaps_t *tms);
+
+/**
* Set the tone map to the first free TMI (not in use) into a tone maps
* structure.
* \param tms the set of tone map where to look for a TMI not in use.
diff --git a/cesar/test_general/station/fcall/src/tonemap.c b/cesar/test_general/station/fcall/src/tonemap.c
index ae9bbfdfe8..2324d48a8d 100644
--- a/cesar/test_general/station/fcall/src/tonemap.c
+++ b/cesar/test_general/station/fcall/src/tonemap.c
@@ -54,17 +54,11 @@ fc_ce_rx_initial_ce_started (fcall_ctx_t *fcall, fcall_param_t **param,
uint i;
/* Get TMI list in RX. */
dbg_assert (sta->rx_tonemaps);
- uint tmi_list_rx = 0;
- for (i = NEGOCIATED_TONEMAP_INDEX_FIRST; i < TONEMAP_INDEX_NB; i++)
- if (sta->rx_tonemaps->tm[i])
- tmi_list_rx |= (1 << i);
+ uint tmi_list_rx = tonemaps_get_tonemap_enabled_list (sta->rx_tonemaps);
/* Get TMI list in RX. */
dbg_assert (sta->tx_tonemaps);
- uint tmi_list_tx = 0;
- for (i = NEGOCIATED_TONEMAP_INDEX_FIRST; i < TONEMAP_INDEX_NB; i++)
- if (sta->tx_tonemaps->tm[i])
- tmi_list_tx |= (1 << i);
+ uint tmi_list_tx = tonemaps_get_tonemap_enabled_list (sta->tx_tonemaps);
blk_release (sta);