summaryrefslogtreecommitdiff
path: root/cesar/mac/common
diff options
context:
space:
mode:
authorNicolas Schodet2011-05-17 17:14:42 +0200
committerNicolas Schodet2011-05-18 12:39:20 +0200
commite7250f8135bd6c17b90c8c136fc1b5d45508f77a (patch)
treefc5b0e53667b321250509f4cad29d5b978808626 /cesar/mac/common
parent84bfeb0b6ebc8668b7f961316701a1e6436120fb (diff)
cesar/mac/common: use minimal frame length instead of strict flag, refs #2320
The condition in AV spec about non strict interval boundary can actually be explained by: Frames for which a PB can not fit in the interval tolerance are not required to strictly obey the interval boundaries. This commit prepares the minimal frame length for PBProc.
Diffstat (limited to 'cesar/mac/common')
-rw-r--r--cesar/mac/common/src/tonemap.c14
-rw-r--r--cesar/mac/common/src/tonemask.c8
-rw-r--r--cesar/mac/common/test/fcall/src/set_tonemap.c1
-rw-r--r--cesar/mac/common/test/tonemap/src/test_tonemap.c23
-rw-r--r--cesar/mac/common/tonemap.h5
5 files changed, 39 insertions, 12 deletions
diff --git a/cesar/mac/common/src/tonemap.c b/cesar/mac/common/src/tonemap.c
index 11c71c782f..8af17a23c5 100644
--- a/cesar/mac/common/src/tonemap.c
+++ b/cesar/mac/common/src/tonemap.c
@@ -20,6 +20,10 @@
/** Maximum encodable BLE value. */
#define TONEMAP_BLE_MAX (((31 + 32) << 3) + (1 << 2))
+/** Length of data symbols. */
+static uint tonemap_data_symbol_tck[] = {
+ MAC_DX417_TCK, MAC_DX567_TCK, MAC_DX3534_TCK };
+
/**
* Compute log2 for BLE values.
* \param n integer number
@@ -311,13 +315,13 @@ 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];
+ tcc_time_tck = bits_per_pb / bits_per_symbol
+ * tonemap_data_symbol_tck[gil];
else
- tcc_time_tck = data_symbol_tck[gil]
+ tcc_time_tck = tonemap_data_symbol_tck[gil]
/ CEIL_DIV (bits_per_symbol, bits_per_pb);
/* Compute number of half iterations. */
uint tcc_time_cycles = tcc_time_tck
@@ -403,6 +407,10 @@ tonemap_update (tonemap_t *tm, u32 p_pberror_uf32)
PHY_MOD_TM, tm->fecrate, PHY_PB_SIZE_136, tm->bits_per_symbol);
tm->bits_per_pb[PHY_PB_SIZE_520] = tonemap_bits_per_pb (
PHY_MOD_TM, tm->fecrate, PHY_PB_SIZE_520, tm->bits_per_symbol);
+ uint one_pb_symb_nb = CEIL_DIV (tm->bits_per_pb[PHY_PB_SIZE_520],
+ tm->bits_per_symbol);
+ tm->one_pb_data_tck = MAC_PAYLOAD_TCK (one_pb_symb_nb,
+ tonemap_data_symbol_tck[tm->gil]);
tm->phy_combo_params[PHY_PB_SIZE_136] =
PHY_COMBO_PARAMS (PHY_MOD_TM, tm->fecrate, PHY_PB_SIZE_136);
tm->phy_combo_params[PHY_PB_SIZE_520] =
diff --git a/cesar/mac/common/src/tonemask.c b/cesar/mac/common/src/tonemask.c
index a1e74117f5..0a47a6979b 100644
--- a/cesar/mac/common/src/tonemask.c
+++ b/cesar/mac/common/src/tonemask.c
@@ -13,6 +13,7 @@
#include "common/std.h"
#include "tonemask.h"
+#include "timings.h"
uint
tonemask_carrier_nb (const u32 *tonemask)
@@ -57,6 +58,8 @@ tonemask_update (tonemask_info_t *ti)
* QPSK. */
static const phy_gil_t robo_gil[] = {
PHY_GIL_417, PHY_GIL_417, PHY_GIL_567 };
+ static const uint robo_dx_tck[] = {
+ MAC_DX417_TCK, MAC_DX417_TCK, MAC_DX567_TCK };
static const phy_pb_size_t robo_pb_size[] = {
PHY_PB_SIZE_520, PHY_PB_SIZE_520, PHY_PB_SIZE_136 };
static const uint robo_nb_copies[] = { 4, 2, 5 };
@@ -64,7 +67,6 @@ tonemask_update (tonemask_info_t *ti)
for (m = PHY_MOD_ROBO; m < PHY_MOD_ROBO_NB; m++)
{
tonemap_t *tm = &ti->tonemap_robo[m];
- tm->strict = false;
tm->cpf = true;
tm->fecrate = PHY_FEC_RATE_1_2;
tm->gil = robo_gil[m];
@@ -78,6 +80,10 @@ tonemask_update (tonemask_info_t *ti)
tm->bits_per_pb[robo_pb_size[m]] =
tonemap_bits_per_pb (m, PHY_FEC_RATE_1_2, robo_pb_size[m],
tm->bits_per_symbol);
+ uint one_pb_symb_nb = CEIL_DIV (tm->bits_per_pb[robo_pb_size[m]],
+ tm->bits_per_symbol);
+ tm->one_pb_data_tck = MAC_PAYLOAD_TCK (one_pb_symb_nb,
+ robo_dx_tck[m]);
tm->phy_combo_params[PHY_PB_SIZE_136] = 0;
tm->phy_combo_params[PHY_PB_SIZE_520] = 0;
tm->phy_combo_params[robo_pb_size[m]] =
diff --git a/cesar/mac/common/test/fcall/src/set_tonemap.c b/cesar/mac/common/test/fcall/src/set_tonemap.c
index 56903ad5d3..aca051da2f 100644
--- a/cesar/mac/common/test/fcall/src/set_tonemap.c
+++ b/cesar/mac/common/test/fcall/src/set_tonemap.c
@@ -56,7 +56,6 @@ mac_test_fcall_set_tonemap (mac_test_fcall_set_tonemap_t *ctx,
/* Create a tonemap. */
tonemap_t *tm = tonemap_alloc ();
tms->tm[tmi] = tm;
- tm->strict = false;
tm->cpf = true;
tm->fecrate = PHY_FEC_RATE_16_21;
tm->gil = PHY_GIL_417;
diff --git a/cesar/mac/common/test/tonemap/src/test_tonemap.c b/cesar/mac/common/test/tonemap/src/test_tonemap.c
index 1604cdab1a..7cf48b5e2d 100644
--- a/cesar/mac/common/test/tonemap/src/test_tonemap.c
+++ b/cesar/mac/common/test/tonemap/src/test_tonemap.c
@@ -326,6 +326,10 @@ tonemap_comp_test_case (test_t t)
tonemap_bits_per_pb (
PHY_MOD_TM, tm.fecrate, PHY_PB_SIZE_520,
tm.bits_per_symbol));
+ uint one_pb_symb_nb = CEIL_DIV (tm.bits_per_pb[PHY_PB_SIZE_520],
+ tm.bits_per_symbol);
+ test_fail_unless (tm.one_pb_data_tck
+ == MAC_PAYLOAD_TCK (one_pb_symb_nb, MAC_DX417_TCK));
test_fail_unless (tm.phy_combo_params[PHY_PB_SIZE_136] ==
PHY_COMBO_PARAMS (PHY_MOD_TM, tm.fecrate,
PHY_PB_SIZE_136));
@@ -414,6 +418,7 @@ tonemap_tonemask_test_case (test_t t)
{
tonemap_t *tm = &ti.tonemap_robo[mod];
uint bits_per_symbol;
+ uint one_pb_data_tck;
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;
@@ -429,6 +434,9 @@ 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);
+ one_pb_data_tck = MAC_PAYLOAD_TCK (
+ CEIL_DIV (bits_per_pb_520, bits_per_symbol),
+ MAC_DX417_TCK);
tcc_halfit = tonemap_tcc_halfit (
bits_per_symbol, bits_per_pb_520, PHY_GIL_417);
break;
@@ -441,6 +449,9 @@ 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);
+ one_pb_data_tck = MAC_PAYLOAD_TCK (
+ CEIL_DIV (bits_per_pb_520, bits_per_symbol),
+ MAC_DX417_TCK);
tcc_halfit = tonemap_tcc_halfit (
bits_per_symbol, bits_per_pb_520, PHY_GIL_417);
break;
@@ -450,6 +461,9 @@ tonemap_tonemask_test_case (test_t t)
CONST_UF32 (0.0), PHY_GIL_567);
bits_per_pb_136 = (136 * 8 * 2 + bits_per_symbol - 1)
/ bits_per_symbol * bits_per_symbol;
+ one_pb_data_tck = MAC_PAYLOAD_TCK (
+ CEIL_DIV (bits_per_pb_136, bits_per_symbol),
+ MAC_DX567_TCK);
phy_combo_params_136 =
PHY_COMBO_PARAMS (PHY_MOD_MINI_ROBO, PHY_FEC_RATE_1_2,
PHY_PB_SIZE_136);
@@ -458,7 +472,7 @@ tonemap_tonemask_test_case (test_t t)
default:
dbg_assert_default ();
}
- test_fail_unless (!tm->strict && tm->cpf
+ test_fail_unless (tm->cpf
&& tm->fecrate == PHY_FEC_RATE_1_2
&& ((mod == PHY_MOD_MINI_ROBO
&& tm->gil == PHY_GIL_567)
@@ -470,6 +484,7 @@ tonemap_tonemask_test_case (test_t t)
bits_per_pb_136
&& tm->bits_per_pb[PHY_PB_SIZE_520] ==
bits_per_pb_520
+ && tm->one_pb_data_tck == one_pb_data_tck
&& tm->phy_combo_params[PHY_PB_SIZE_136] ==
phy_combo_params_136
&& tm->phy_combo_params[PHY_PB_SIZE_520] ==
@@ -496,7 +511,6 @@ tonemap_copy_test (test_t t)
/* Create a tone map. */
tonemap_t *tm = tonemap_alloc ();
/* Fill it with some values. */
- tm->strict = false;
tm->cpf = true;
tm->fecrate = PHY_FEC_RATE_1_2;
tm->gil = PHY_GIL_NONE;
@@ -504,6 +518,7 @@ tonemap_copy_test (test_t t)
tm->bits_per_symbol = 0x4242;
tm->bits_per_pb[0] = 24;
tm->bits_per_pb[1] = 42;
+ tm->one_pb_data_tck = 1234;
tm->phy_combo_params[0] = 42;
tm->phy_combo_params[1] = 24;
tm->tcc_halfit = 0x1234;
@@ -536,7 +551,6 @@ tonemap_copy_test (test_t t)
} test_end;
test_begin (t, "destination tone map is the same as source")
{
- test_fail_if (tm_copy->strict != false);
test_fail_if (tm_copy->cpf != true);
test_fail_if (tm_copy->fecrate != PHY_FEC_RATE_1_2);
test_fail_if (tm_copy->gil != PHY_GIL_NONE);
@@ -544,6 +558,7 @@ tonemap_copy_test (test_t t)
test_fail_if (tm_copy->bits_per_symbol != 0x4242);
test_fail_if (tm_copy->bits_per_pb[0] != 24);
test_fail_if (tm_copy->bits_per_pb[1] != 42);
+ test_fail_if (tm_copy->one_pb_data_tck != 1234);
test_fail_if (tm_copy->phy_combo_params[0] != 42);
test_fail_if (tm_copy->phy_combo_params[1] != 24);
test_fail_if (tm_copy->tcc_halfit != 0x1234);
@@ -560,7 +575,6 @@ tonemap_copy_test (test_t t)
} test_end;
test_begin (t, "source is not changed during copy")
{
- test_fail_if (tm->strict != false);
test_fail_if (tm->cpf != true);
test_fail_if (tm->fecrate != PHY_FEC_RATE_1_2);
test_fail_if (tm->gil != PHY_GIL_NONE);
@@ -568,6 +582,7 @@ tonemap_copy_test (test_t t)
test_fail_if (tm->bits_per_symbol != 0x4242);
test_fail_if (tm->bits_per_pb[0] != 24);
test_fail_if (tm->bits_per_pb[1] != 42);
+ test_fail_if (tm->one_pb_data_tck != 1234);
test_fail_if (tm->phy_combo_params[0] != 42);
test_fail_if (tm->phy_combo_params[1] != 24);
test_fail_if (tm->tcc_halfit != 0x1234);
diff --git a/cesar/mac/common/tonemap.h b/cesar/mac/common/tonemap.h
index e992ea6485..537e3596e1 100644
--- a/cesar/mac/common/tonemap.h
+++ b/cesar/mac/common/tonemap.h
@@ -149,9 +149,6 @@ typedef struct tonemap_intervals_t tonemap_intervals_t;
/** Define a tone map. */
struct tonemap_t
{
- /** Does interval rules must be strictly enforced for this tone map. Non
- * strict can be used if phy rate at the FEC input is less than 15Mbps. */
- bool strict;
/** Can be used in the contention period. */
bool cpf;
/** FEC type, 1/2 or 16/21. */
@@ -167,6 +164,8 @@ struct tonemap_t
uint bits_per_symbol;
/** Number of bits per PB. */
uint bits_per_pb[PHY_PB_SIZE_NONE];
+ /** Data length of a frame with one PB. */
+ uint one_pb_data_tck;
/** Phy parameters (modulation, FEC rate, PB size). */
u32 phy_combo_params[PHY_PB_SIZE_NONE];
/** Number of TCC half iterations for PB 520. */