summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2010-02-11 12:05:40 +0000
committerschodet2010-02-11 12:05:40 +0000
commitd8bac1642e902a67badc563e329471b01cd57b8b (patch)
treef4d7ae48c0b4c2b273aa40123d471c8288f78246
parentb9f184566d88c94ee79c01a1842310fb691d8cc4 (diff)
cesar/mac/common: add tcc_halfit tonemap characteristic, refs #517
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6695 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/mac/common/src/tonemap.c24
-rw-r--r--cesar/mac/common/src/tonemask.c4
-rw-r--r--cesar/mac/common/test/tonemap/src/test_tonemap.c31
-rw-r--r--cesar/mac/common/tonemap.h12
4 files changed, 71 insertions, 0 deletions
diff --git a/cesar/mac/common/src/tonemap.c b/cesar/mac/common/src/tonemap.c
index 2cf2872aa6..bf025d7b17 100644
--- a/cesar/mac/common/src/tonemap.c
+++ b/cesar/mac/common/src/tonemap.c
@@ -241,6 +241,27 @@ tonemap_bits_per_pb (phy_mod_t mod, phy_fecrate_t fecrate,
return bits;
}
+uint
+tonemap_tcc_halfit (uint bits_per_symbol, uint bits_per_pb, phy_gil_t gil)
+{
+ dbg_assert (bits_per_symbol);
+ dbg_assert (bits_per_pb);
+ dbg_assert (gil < PHY_GIL_NB);
+ uint data_symbol_tck[] = { MAC_DX417_TCK, MAC_DX567_TCK, MAC_DX3534_TCK };
+ uint tcc_time_tck;
+ /* Compute time available for TCC work. */
+ if (bits_per_pb > bits_per_symbol)
+ tcc_time_tck = bits_per_pb / bits_per_symbol * data_symbol_tck[gil];
+ else
+ tcc_time_tck = data_symbol_tck[gil]
+ / CEIL_DIV (bits_per_symbol, bits_per_pb);
+ /* Compute number of half iterations. */
+ uint tcc_time_cycles = tcc_time_tck
+ * (PHY_DSP_CLOCK_MHZ / MAC_US_TO_TCK (1));
+ uint halfit = 2 * (tcc_time_cycles - 50) / 1064 - 1;
+ return MIN (halfit, 31u);
+}
+
u8
tonemap_ble (uint bits_per_symbol, phy_fecrate_t fecrate, u32 p_pberror_uf32,
phy_gil_t gil)
@@ -307,6 +328,9 @@ tonemap_update (tonemap_t *tm, u32 p_pberror_uf32)
PHY_COMBO_PARAMS (PHY_MOD_TM, tm->fecrate, PHY_PB_SIZE_136);
tm->phy_combo_params[PHY_PB_SIZE_520] =
PHY_COMBO_PARAMS (PHY_MOD_TM, tm->fecrate, PHY_PB_SIZE_520);
+ tm->tcc_halfit =
+ tonemap_tcc_halfit (tm->bits_per_symbol,
+ tm->bits_per_pb[PHY_PB_SIZE_520], tm->gil);
}
tonemaps_t *
diff --git a/cesar/mac/common/src/tonemask.c b/cesar/mac/common/src/tonemask.c
index f7018a6fcc..e3b7603ef4 100644
--- a/cesar/mac/common/src/tonemask.c
+++ b/cesar/mac/common/src/tonemask.c
@@ -80,6 +80,10 @@ tonemask_update (tonemask_info_t *ti)
tm->phy_combo_params[PHY_PB_SIZE_520] = 0;
tm->phy_combo_params[robo_pb_size[m]] =
PHY_COMBO_PARAMS (m, tm->fecrate, robo_pb_size[m]);
+ tm->tcc_halfit = robo_pb_size[m] == PHY_PB_SIZE_136 ? 1
+ : tonemap_tcc_halfit (tm->bits_per_symbol,
+ tm->bits_per_pb[PHY_PB_SIZE_520],
+ robo_gil[m]);
}
}
diff --git a/cesar/mac/common/test/tonemap/src/test_tonemap.c b/cesar/mac/common/test/tonemap/src/test_tonemap.c
index bb8dc436a5..b3d3cc63bc 100644
--- a/cesar/mac/common/test/tonemap/src/test_tonemap.c
+++ b/cesar/mac/common/test/tonemap/src/test_tonemap.c
@@ -272,6 +272,27 @@ tonemap_comp_test_case (test_t t)
PHY_PB_SIZE_520, bits / 3)
== bits / 3 * 4); /* bits / 3 * 3 < bits */
} test_end;
+ test_begin (t, "tcc half it")
+ {
+ uint reft[][2] = {
+ { 1821, 31, }, /* Means: 31 until 1821 bits per symbol. */
+ { 2731, 25, },
+ { 5461, 12, },
+ { 10921, 5, },
+ { 10 * 1536 + 1, 3, },
+ };
+ uint (*ref)[2] = &reft[0];
+ uint i;
+ uint bits_per_pb = tonemap_bits_per_pb (
+ PHY_MOD_TM, PHY_FEC_RATE_16_21, PHY_PB_SIZE_520, 0);
+ for (i = 1; i <= 10 * 1536; i++)
+ {
+ if (i >= (*ref)[0])
+ ref++;
+ uint res = tonemap_tcc_halfit (i, bits_per_pb, PHY_GIL_417);
+ test_fail_unless (res == (*ref)[1]);
+ }
+ } test_end;
test_begin (t, "update")
{
tonemap_t tm;
@@ -296,6 +317,9 @@ tonemap_comp_test_case (test_t t)
test_fail_unless (tm.phy_combo_params[PHY_PB_SIZE_520] ==
PHY_COMBO_PARAMS (PHY_MOD_TM, tm.fecrate,
PHY_PB_SIZE_520));
+ test_fail_unless (tm.tcc_halfit == tonemap_tcc_halfit (
+ tm.bits_per_symbol, tm.bits_per_pb[PHY_PB_SIZE_520],
+ tm.gil));
} test_end;
}
@@ -377,6 +401,7 @@ tonemap_tonemask_test_case (test_t t)
uint bits_per_symbol;
uint bits_per_pb_136 = 0, bits_per_pb_520 = 0;
u32 phy_combo_params_136 = 0, phy_combo_params_520 = 0;
+ uint tcc_halfit;
u8 ble;
switch (mod)
{
@@ -389,6 +414,8 @@ tonemap_tonemask_test_case (test_t t)
phy_combo_params_520 =
PHY_COMBO_PARAMS (PHY_MOD_ROBO, PHY_FEC_RATE_1_2,
PHY_PB_SIZE_520);
+ tcc_halfit = tonemap_tcc_halfit (
+ bits_per_symbol, bits_per_pb_520, PHY_GIL_417);
break;
case PHY_MOD_HS_ROBO:
bits_per_symbol = carrier_nb / 2 * 2;
@@ -399,6 +426,8 @@ tonemap_tonemask_test_case (test_t t)
phy_combo_params_520 =
PHY_COMBO_PARAMS (PHY_MOD_HS_ROBO, PHY_FEC_RATE_1_2,
PHY_PB_SIZE_520);
+ tcc_halfit = tonemap_tcc_halfit (
+ bits_per_symbol, bits_per_pb_520, PHY_GIL_417);
break;
case PHY_MOD_MINI_ROBO:
bits_per_symbol = carrier_nb / 5 * 2;
@@ -409,6 +438,7 @@ tonemap_tonemask_test_case (test_t t)
phy_combo_params_136 =
PHY_COMBO_PARAMS (PHY_MOD_MINI_ROBO, PHY_FEC_RATE_1_2,
PHY_PB_SIZE_136);
+ tcc_halfit = 1;
break;
default:
dbg_assert_default ();
@@ -429,6 +459,7 @@ tonemap_tonemask_test_case (test_t t)
phy_combo_params_136
&& tm->phy_combo_params[PHY_PB_SIZE_520] ==
phy_combo_params_520
+ && tm->tcc_halfit == tcc_halfit
);
}
} test_end;
diff --git a/cesar/mac/common/tonemap.h b/cesar/mac/common/tonemap.h
index ac82e5db0d..934cced62c 100644
--- a/cesar/mac/common/tonemap.h
+++ b/cesar/mac/common/tonemap.h
@@ -169,6 +169,8 @@ struct tonemap_t
uint bits_per_pb[PHY_PB_SIZE_NONE];
/** Phy parameters (modulation, FEC rate, PB size). */
u32 phy_combo_params[PHY_PB_SIZE_NONE];
+ /** Number of TCC half iterations for PB 520. */
+ uint tcc_halfit;
/**
* Tone map marked as released.
* This flag is used in the CE RX. When the CE RX decides to stop using a
@@ -611,6 +613,16 @@ tonemap_bits_per_pb (phy_mod_t mod, phy_fecrate_t fecrate,
phy_pb_size_t pb_size, uint bits_per_symbol);
/**
+ * Compute number of half iterations for the given tonemap characteristics.
+ * \param bits_per_symbol number of bits per data symbol
+ * \param bits_per_pb number of bits per Physical Block
+ * \param gil guard interval
+ * \return TCC half iteration number to be used by hardware
+ */
+uint
+tonemap_tcc_halfit (uint bits_per_symbol, uint bits_per_pb, phy_gil_t gil);
+
+/**
* Compute floating point representation of BLE for frame control field.
* \param bits_per_symbol number of bits per symbol
* \param fecrate FEC encoding rate