summaryrefslogtreecommitdiff
path: root/hal
diff options
context:
space:
mode:
authorburet2007-09-24 17:06:55 +0000
committerburet2007-09-24 17:06:55 +0000
commite8100093526b6e8d8f3784fd2f2ffca7b7871b09 (patch)
tree8e86d72fab7193d66acfd2001d99d1c97c3acd5c /hal
parent3c04f0b6c8ef92bb804fa670f0d33f34e91adc75 (diff)
Maximus HAL Phy: fixes #26.
Modify phy_tx_param and phy_rx_prepare functions and their unitary tests. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@734 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'hal')
-rw-r--r--hal/phy/maximus/src/maximus_phy_ctrl.c131
-rw-r--r--hal/phy/maximus/test/src/test_phy_ctrl.c135
2 files changed, 226 insertions, 40 deletions
diff --git a/hal/phy/maximus/src/maximus_phy_ctrl.c b/hal/phy/maximus/src/maximus_phy_ctrl.c
index 7355812498..cd14c6207c 100644
--- a/hal/phy/maximus/src/maximus_phy_ctrl.c
+++ b/hal/phy/maximus/src/maximus_phy_ctrl.c
@@ -421,12 +421,10 @@ maximus_phy_recv_fc_av_only_mode (phy_t *ctx, sci_msg_t *msg)
// if the RX FC mode is different from the TX FC mode, the FC AV FCCS_AV should be wrong => send fc_av = NULL
if (ctx->control.rx_param.fc_mode != ctx->control.next_tx_param.fc_mode)
{
- //dsr_requested = (*ctx->control.rx_fc_cb)(ctx->control.user_data, rx_date, NULL);
ctx->control.rx_fc_param.fc_av = NULL;
}
else
{
- //dsr_requested = (*ctx->control.rx_fc_cb)(ctx->control.user_data, rx_date, ctx->control.rx_param.fc_av);
ctx->control.rx_fc_param.fc_av = ctx->control.rx_param.fc_av;
}
@@ -1211,9 +1209,29 @@ phy_tx_param (phy_t *ctx, phy_fc_mode_t fc_mode, bool short_ppdu,
* Set the tonemap_index value of PHY context. */
dbg_assert_ptr(ctx);
- dbg_assert(PHY_TONEMAP_MAX_NB > tonemap_index);
+ dbg_assert(PHY_FC_MODE_NB > fc_mode);
+ dbg_assert(short_ppdu
+ || (!short_ppdu
+ && (PHY_MOD_NONE > mod)));
+ dbg_assert(short_ppdu
+ || (!short_ppdu
+ && (PHY_MOD_TM != mod))
+ || (!short_ppdu
+ && (PHY_MOD_TM == mod)
+ && (PHY_FEC_RATE_NONE > fecrate)
+ && (PHY_PB_SIZE_NONE > pb_size)
+ && (PHY_GIL_NB > gil)
+ && (PHY_TONEMAP_MAX_NB > tonemap_index)));
if ((NULL == ctx)
- || (PHY_TONEMAP_MAX_NB <= tonemap_index))
+ || (PHY_FC_MODE_NB <= fc_mode)
+ || (!short_ppdu
+ && (PHY_MOD_NONE <= mod))
+ || (!short_ppdu
+ && (PHY_MOD_TM == mod)
+ && ((PHY_FEC_RATE_NONE <= fecrate)
+ || (PHY_PB_SIZE_NONE <= pb_size)
+ || (PHY_GIL_NB <= gil)
+ || (PHY_TONEMAP_MAX_NB <= tonemap_index))))
{
errno = EINVAL;
}
@@ -1222,19 +1240,40 @@ phy_tx_param (phy_t *ctx, phy_fc_mode_t fc_mode, bool short_ppdu,
ctx->control.next_tx_param.fc_mode = fc_mode;
ctx->control.next_tx_param.short_ppdu = short_ppdu;
- if (!short_ppdu) // else no data symbols will be sent
+ if (!short_ppdu)
{
ctx->control.next_tx_param.mod = mod;
- if (PHY_MOD_TM == mod) // else tonemap is not used
+ if (PHY_MOD_TM == mod)
{
- /* Set phy context values. */
-
ctx->control.next_tx_param.fecrate = fecrate;
ctx->control.next_tx_param.pb_size = pb_size;
ctx->control.next_tx_param.gil = gil;
ctx->control.next_tx_param.tonemap_index = tonemap_index;
}
+ else // tonemap is not used
+ {
+ ctx->control.next_tx_param.fecrate = PHY_FEC_RATE_1_2;
+ ctx->control.next_tx_param.tonemap_index = 0;
+ if (PHY_MOD_MINI_ROBO == mod)
+ {
+ ctx->control.next_tx_param.pb_size = PHY_PB_SIZE_136;
+ ctx->control.next_tx_param.gil = PHY_GIL_567;
+ }
+ else
+ {
+ ctx->control.next_tx_param.pb_size = PHY_PB_SIZE_520;
+ ctx->control.next_tx_param.gil = PHY_GIL_417;
+ }
+ }
+ }
+ else // no data symbols will be sent
+ {
+ ctx->control.next_tx_param.mod = PHY_MOD_NONE;
+ ctx->control.next_tx_param.fecrate = PHY_FEC_RATE_NONE;
+ ctx->control.next_tx_param.pb_size = PHY_PB_SIZE_NONE;
+ ctx->control.next_tx_param.gil = PHY_GIL_NB;
+ ctx->control.next_tx_param.tonemap_index = 0;
}
}
}
@@ -1356,7 +1395,9 @@ phy_rx_param (phy_t *ctx, phy_fc_mode_t fc_mode)
/* Set the fc_mode value of phy context. */
dbg_assert_ptr(ctx);
- if (NULL == ctx)
+ dbg_assert(PHY_FC_MODE_NB > fc_mode);
+ if ((NULL == ctx)
+ || (PHY_FC_MODE_NB <= fc_mode))
{
errno = EINVAL;
}
@@ -1455,30 +1496,82 @@ phy_rx_prepare (phy_t *ctx, bool short_ppdu, phy_mod_t mod,
* Set the symbol_nb value of PHY context. */
dbg_assert_ptr(ctx);
- if (NULL == ctx)
+ dbg_assert(short_ppdu
+ || (!short_ppdu
+ && (PHY_MOD_NONE > mod)));
+ dbg_assert(short_ppdu
+ || (!short_ppdu
+ && (PHY_MOD_TM != mod))
+ || (!short_ppdu
+ && (PHY_MOD_TM == mod)
+ && (PHY_FEC_RATE_NONE > fecrate)
+ && (PHY_PB_SIZE_NONE > pb_size)
+ && (PHY_GIL_NB > gil)
+ && (PHY_TONEMAP_MAX_NB > tonemap_index)));
+ if ((NULL == ctx)
+ || (!short_ppdu
+ && (PHY_MOD_NONE <= mod))
+ || (!short_ppdu
+ && (PHY_MOD_TM == mod)
+ && ((PHY_FEC_RATE_NONE <= fecrate)
+ || (PHY_PB_SIZE_NONE <= pb_size)
+ || (PHY_GIL_NB <= gil)
+ || (PHY_TONEMAP_MAX_NB <= tonemap_index))))
{
errno = EINVAL;
}
else
{
// set phy context values
+
ctx->control.rx_param.short_ppdu = short_ppdu;
- ctx->control.rx_param.mod = mod; // set modulation mode
- ctx->control.rx_param.fecrate = fecrate;
- ctx->control.rx_param.pb_size = pb_size;
- ctx->control.rx_param.gil = gil;
- ctx->control.rx_param.tonemap_index = tonemap_index;
ctx->control.rx_param.symbol_nb = symbol_nb;
-
+
+ if (!short_ppdu)
+ {
+ ctx->control.rx_param.mod = mod; // set modulation mode
+
+ if (PHY_MOD_TM == mod)
+ {
+ ctx->control.rx_param.fecrate = fecrate;
+ ctx->control.rx_param.pb_size = pb_size;
+ ctx->control.rx_param.gil = gil;
+ ctx->control.rx_param.tonemap_index = tonemap_index;
+ }
+ else // tonemap is not used
+ {
+ ctx->control.rx_param.fecrate = PHY_FEC_RATE_1_2;
+ ctx->control.rx_param.tonemap_index = 0;
+ if (PHY_MOD_MINI_ROBO == mod)
+ {
+ ctx->control.rx_param.pb_size = PHY_PB_SIZE_136;
+ ctx->control.rx_param.gil = PHY_GIL_567;
+ }
+ else
+ {
+ ctx->control.rx_param.pb_size = PHY_PB_SIZE_520;
+ ctx->control.rx_param.gil = PHY_GIL_417;
+ }
+ }
+ }
+ else // no data symbols will be received
+ {
+ ctx->control.rx_param.mod = PHY_MOD_NONE;
+ ctx->control.rx_param.fecrate = PHY_FEC_RATE_NONE;
+ ctx->control.rx_param.pb_size = PHY_PB_SIZE_NONE;
+ ctx->control.rx_param.gil = PHY_GIL_NB;
+ ctx->control.rx_param.tonemap_index = 0;
+ }
+
// set rx mode
ctx->control.rx_tx_mode = true;
-
+
// reset internal PB counter
ctx->pbdma.index_current_pb = 0;
-
+
// reset current PB descriptor for Rx
ctx->pbdma.current_pb = &ctx->pbdma.first_pb->pb_rx;
-
+
// reset crc error
ctx->pbdma.pb_crc_error = false;
}
diff --git a/hal/phy/maximus/test/src/test_phy_ctrl.c b/hal/phy/maximus/test/src/test_phy_ctrl.c
index 607b66af1c..f8e69e4e1a 100644
--- a/hal/phy/maximus/test/src/test_phy_ctrl.c
+++ b/hal/phy/maximus/test/src/test_phy_ctrl.c
@@ -759,32 +759,68 @@ void phy_tx_fc10_test_case(test_t t)
void phy_tx_param_test_case(test_t t)
{
+ phy_fc_mode_t fc_mode = PHY_FC_MODE_HYBRID_1;
+ bool short_ppdu = false;
+ phy_mod_t mod;
+ phy_fecrate_t fecrate = PHY_FEC_RATE_16_21;
+ phy_pb_size_t pb_size = PHY_PB_SIZE_136;
+ phy_gil_t gil = PHY_GIL_417;
+ uint tonemap_index = 3;
+
printf("tx param\n");
test_case_begin(t, "tx param");
-
- test_begin(t, "tx param")
+
+ test_begin(t, "tx param with TM modulation")
{
- phy_fc_mode_t fc_mode = PHY_FC_MODE_HYBRID_1;
- bool short_ppdu = false;
- phy_mod_t mod = PHY_MOD_TM;
- phy_fecrate_t fecrate = PHY_FEC_RATE_1_2;
- phy_pb_size_t pb_size = PHY_PB_SIZE_136;
- phy_gil_t gil = PHY_GIL_417;
- uint tonemap_index = 3;
-
+ mod = PHY_MOD_TM;
+
phy_tx_param (ctx, fc_mode, short_ppdu,
mod, fecrate, pb_size,
gil, tonemap_index);
- test_fail_unless((fc_mode == ctx->control.next_tx_param.fc_mode)
+ test_fail_unless((EINVAL != errno)
+ && (fc_mode == ctx->control.next_tx_param.fc_mode)
&& (short_ppdu == ctx->control.next_tx_param.short_ppdu)
&& (mod == ctx->control.next_tx_param.mod)
&& (fecrate == ctx->control.next_tx_param.fecrate)
&& (pb_size == ctx->control.next_tx_param.pb_size)
&& (gil == ctx->control.next_tx_param.gil)
&& (tonemap_index == ctx->control.next_tx_param.tonemap_index));
-
} test_end;
-
+
+ test_begin(t, "tx param with HS ROBO modulation")
+ {
+ mod = PHY_MOD_HS_ROBO;
+
+ phy_tx_param (ctx, fc_mode, short_ppdu,
+ mod, fecrate, pb_size,
+ gil, tonemap_index);
+ test_fail_unless((EINVAL != errno)
+ && (fc_mode == ctx->control.next_tx_param.fc_mode)
+ && (short_ppdu == ctx->control.next_tx_param.short_ppdu)
+ && (mod == ctx->control.next_tx_param.mod)
+ && (PHY_FEC_RATE_1_2 == ctx->control.next_tx_param.fecrate)
+ && (PHY_PB_SIZE_520 == ctx->control.next_tx_param.pb_size)
+ && (PHY_GIL_417 == ctx->control.next_tx_param.gil)
+ && (0 == ctx->control.next_tx_param.tonemap_index));
+ } test_end;
+
+ test_begin(t, "tx param with MINI ROBO modulation")
+ {
+ mod = PHY_MOD_MINI_ROBO;
+
+ phy_tx_param (ctx, fc_mode, short_ppdu,
+ mod, fecrate, pb_size,
+ gil, tonemap_index);
+ test_fail_unless((EINVAL != errno)
+ && (fc_mode == ctx->control.next_tx_param.fc_mode)
+ && (short_ppdu == ctx->control.next_tx_param.short_ppdu)
+ && (mod == ctx->control.next_tx_param.mod)
+ && (PHY_FEC_RATE_1_2 == ctx->control.next_tx_param.fecrate)
+ && (PHY_PB_SIZE_136 == ctx->control.next_tx_param.pb_size)
+ && (PHY_GIL_567 == ctx->control.next_tx_param.gil)
+ && (0 == ctx->control.next_tx_param.tonemap_index));
+ } test_end;
+
return;
}
@@ -844,6 +880,7 @@ void phy_tx_frame_test_case(test_t t)
ctx->control.next_tx_param.pb_size = PHY_PB_SIZE_520;
ctx->pbdma.nb_total = 3;
ctx->control.next_tx_param.short_ppdu = false;
+ ctx->control.next_tx_param.tonemap_index = tonemap_index;
test_begin(t, "tx frame")
{
@@ -1806,18 +1843,20 @@ void phy_rx_activate_test_case(test_t t)
void phy_rx_prepare_test_case(test_t t)
{
+ bool short_ppdu = false;
+ phy_mod_t mod;
+ phy_fecrate_t fecrate = PHY_FEC_RATE_1_2;
+ phy_pb_size_t pb_size = PHY_PB_SIZE_136;
+ phy_gil_t gil = PHY_GIL_417;
+ uint tonemap_index = 3;
+ uint symbol_nb = 0;
+
printf("rx prepare\n");
test_case_begin(t, "rx prepare");
- test_begin(t, "rx prepare")
+ test_begin(t, "rx prepare with TM modulation")
{
- bool short_ppdu = false;
- phy_mod_t mod = PHY_MOD_NONE;
- phy_fecrate_t fecrate = PHY_FEC_RATE_NONE;
- phy_pb_size_t pb_size = PHY_PB_SIZE_136;
- phy_gil_t gil = PHY_GIL_417;
- uint tonemap_index = 1234567890;
- uint symbol_nb = 0;
+ mod = PHY_MOD_TM;
phy_rx_prepare (ctx,
short_ppdu,
@@ -1842,6 +1881,60 @@ void phy_rx_prepare_test_case(test_t t)
&& (!ctx->pbdma.pb_crc_error));
} test_end;
+ test_begin(t, "rx prepare with ROBO modulation")
+ {
+ mod = PHY_MOD_ROBO;
+
+ phy_rx_prepare (ctx,
+ short_ppdu,
+ mod,
+ fecrate,
+ pb_size,
+ gil,
+ tonemap_index,
+ symbol_nb);
+ test_fail_unless ((EINVAL != errno)
+ && (NULL != ctx)
+ && (short_ppdu == ctx->control.rx_param.short_ppdu)
+ && (mod == ctx->control.rx_param.mod)
+ && (PHY_FEC_RATE_1_2 == ctx->control.rx_param.fecrate)
+ && (PHY_PB_SIZE_520 == ctx->control.rx_param.pb_size)
+ && (PHY_GIL_417 == ctx->control.rx_param.gil)
+ && (0 == ctx->control.rx_param.tonemap_index)
+ && (symbol_nb == ctx->control.rx_param.symbol_nb)
+ && ctx->control.rx_tx_mode
+ && (0 == ctx->pbdma.index_current_pb)
+ && (ctx->pbdma.current_pb == &ctx->pbdma.first_pb->pb_rx)
+ && (!ctx->pbdma.pb_crc_error));
+ } test_end;
+
+ test_begin(t, "rx prepare with MINI ROBO modulation")
+ {
+ mod = PHY_MOD_MINI_ROBO;
+
+ phy_rx_prepare (ctx,
+ short_ppdu,
+ mod,
+ fecrate,
+ pb_size,
+ gil,
+ tonemap_index,
+ symbol_nb);
+ test_fail_unless ((EINVAL != errno)
+ && (NULL != ctx)
+ && (short_ppdu == ctx->control.rx_param.short_ppdu)
+ && (mod == ctx->control.rx_param.mod)
+ && (PHY_FEC_RATE_1_2 == ctx->control.rx_param.fecrate)
+ && (PHY_PB_SIZE_136 == ctx->control.rx_param.pb_size)
+ && (PHY_GIL_567 == ctx->control.rx_param.gil)
+ && (0 == ctx->control.rx_param.tonemap_index)
+ && (symbol_nb == ctx->control.rx_param.symbol_nb)
+ && ctx->control.rx_tx_mode
+ && (0 == ctx->pbdma.index_current_pb)
+ && (ctx->pbdma.current_pb == &ctx->pbdma.first_pb->pb_rx)
+ && (!ctx->pbdma.pb_crc_error));
+ } test_end;
+
return;
}