summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/maximus
diff options
context:
space:
mode:
authorschodet2009-12-22 16:14:49 +0000
committerschodet2009-12-22 16:14:49 +0000
commit8d292d3436612073c81d45f16d28adc1748049fe (patch)
tree18da4e3af78434e4fffd8c47321172bd417eda2e /cesar/hal/phy/maximus
parentb4b326474eb5767b53a78afe4bb2a79e59561df1 (diff)
cesar/hal/phy: phy_{tx_param,rx_prepare}* interface changes, closes #1007
This includes: - replace mod, fecrate and pb_size with a combo parameter ; - remove unused tonemap_index ; - use specialised short_ppdu functions. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6574 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/hal/phy/maximus')
-rw-r--r--cesar/hal/phy/maximus/src/maximus_phy_ctrl.c87
-rw-r--r--cesar/hal/phy/maximus/src/maximus_tmdma.c4
-rw-r--r--cesar/hal/phy/maximus/test/src/test_phy_ctrl.c79
-rw-r--r--cesar/hal/phy/maximus/test/src/test_tmdma.c4
4 files changed, 93 insertions, 81 deletions
diff --git a/cesar/hal/phy/maximus/src/maximus_phy_ctrl.c b/cesar/hal/phy/maximus/src/maximus_phy_ctrl.c
index b3c62e8f9f..9bde0efa47 100644
--- a/cesar/hal/phy/maximus/src/maximus_phy_ctrl.c
+++ b/cesar/hal/phy/maximus/src/maximus_phy_ctrl.c
@@ -2371,7 +2371,7 @@ phy_tx_fc10 (phy_t *ctx, u32 date, u32 fc_10)
/**
- * Set TX parameters.
+ * Set TX parameters, common function.
* \param ctx phy context
* \param fc_mode frame control mode
* \param short_ppdu true if no data symbols will be sent
@@ -2387,10 +2387,10 @@ phy_tx_fc10 (phy_t *ctx, u32 date, u32 fc_10)
*
* When modulation type is a ROBO mode, following arguments are ignored.
*/
-void
-phy_tx_param (phy_t *ctx, phy_fc_mode_t fc_mode, bool short_ppdu,
- phy_mod_t mod, phy_fecrate_t fecrate, phy_pb_size_t pb_size,
- phy_gil_t gil, uint tonemap_index)
+static void
+phy_tx_param_common (phy_t *ctx, phy_fc_mode_t fc_mode, bool short_ppdu,
+ phy_mod_t mod, phy_fecrate_t fecrate,
+ phy_pb_size_t pb_size, phy_gil_t gil, uint tonemap_index)
{
/* Set the fc_mode value of PHY context.
* Set the short_ppdu value of PHY context.
@@ -2476,21 +2476,44 @@ phy_tx_param (phy_t *ctx, phy_fc_mode_t fc_mode, bool short_ppdu,
}
+void
+phy_tx_param (phy_t *ctx, phy_fc_mode_t fc_mode, u32 mod_fecrate_pb_size,
+ phy_gil_t gil)
+{
+ phy_mod_t mod = BF_GET (PHY_COMBO_PARAMS__MOD, mod_fecrate_pb_size);
+ phy_fecrate_t fecrate = BF_GET (PHY_COMBO_PARAMS__FECRATE,
+ mod_fecrate_pb_size);
+ phy_pb_size_t pb_size = BF_GET (PHY_COMBO_PARAMS__PB_SIZE,
+ mod_fecrate_pb_size);
+ phy_tx_param_common (ctx, fc_mode, false, mod, fecrate, pb_size, gil, 0);
+}
+
+
+void
+phy_tx_param_short (phy_t *ctx, phy_fc_mode_t fc_mode)
+{
+ phy_tx_param_common (ctx, fc_mode, true, PHY_MOD_NONE, PHY_FEC_RATE_NONE,
+ PHY_PB_SIZE_NONE, PHY_GIL_NONE, 0);
+}
+
+
/**
* Set TX parameters for SOUND transmission.
* \param ctx phy context
* \param fc_mode frame control mode
* \param nb_pb number of SOUND PB
- * \param mod modulation type
- * \param fecrate TCC rate
- * \param pb_size PB size
+ * \param mod_fecrate_pb_size combined modulation type, TCC rate, PB size
* \param gil guard interval for third symbol and following symbols
*/
void
phy_tx_param_sound (phy_t *ctx, phy_fc_mode_t fc_mode, uint nb_pb,
- phy_mod_t mod, phy_fecrate_t fecrate,
- phy_pb_size_t pb_size, phy_gil_t gil)
+ u32 mod_fecrate_pb_size, phy_gil_t gil)
{
+ phy_mod_t mod = BF_GET (PHY_COMBO_PARAMS__MOD, mod_fecrate_pb_size);
+ phy_fecrate_t fecrate = BF_GET (PHY_COMBO_PARAMS__FECRATE,
+ mod_fecrate_pb_size);
+ phy_pb_size_t pb_size = BF_GET (PHY_COMBO_PARAMS__PB_SIZE,
+ mod_fecrate_pb_size);
/* Set the fc_mode value of PHY context.
* Set the nb_pb value of PHY context.
* Set the mod value of PHY context.
@@ -2753,7 +2776,7 @@ phy_rx_activate (phy_t *ctx, bool now, u32 date, bool pre_detection)
/**
- * Set parameter for frame payload reception.
+ * Set parameter for frame payload reception, common function.
* \param ctx phy context
* \param short_ppdu true if no data symbols will be received
* \param mod modulation type
@@ -2769,9 +2792,9 @@ phy_rx_activate (phy_t *ctx, bool now, u32 date, bool pre_detection)
* data.
*/
void
-phy_rx_prepare (phy_t *ctx, bool short_ppdu, phy_mod_t mod,
- phy_fecrate_t fecrate, phy_pb_size_t pb_size, phy_gil_t gil,
- uint tonemap_index, uint symbol_nb)
+phy_rx_prepare_common (phy_t *ctx, bool short_ppdu, phy_mod_t mod,
+ phy_fecrate_t fecrate, phy_pb_size_t pb_size,
+ phy_gil_t gil, uint tonemap_index, uint symbol_nb)
{
/* PBP prepares HW for reception.
* This function is called when a FC is received, in the 'rx_fc_cb'. */
@@ -2882,22 +2905,44 @@ phy_rx_prepare (phy_t *ctx, bool short_ppdu, phy_mod_t mod,
}
+void
+phy_rx_prepare (phy_t *ctx, u32 mod_fecrate_pb_size, phy_gil_t gil,
+ uint symbol_nb)
+{
+ phy_mod_t mod = BF_GET (PHY_COMBO_PARAMS__MOD, mod_fecrate_pb_size);
+ phy_fecrate_t fecrate = BF_GET (PHY_COMBO_PARAMS__FECRATE,
+ mod_fecrate_pb_size);
+ phy_pb_size_t pb_size = BF_GET (PHY_COMBO_PARAMS__PB_SIZE,
+ mod_fecrate_pb_size);
+ phy_rx_prepare_common (ctx, false, mod, fecrate, pb_size, gil, 0,
+ symbol_nb);
+}
+
+
+void
+phy_rx_prepare_short (phy_t *ctx)
+{
+ phy_rx_prepare_common (ctx, true, PHY_MOD_NONE, PHY_FEC_RATE_NONE,
+ PHY_PB_SIZE_NONE, PHY_GIL_NONE, 0, 0);
+}
+
+
/**
* Set parameter for SOUND payload reception.
* \param ctx phy context
- * \param mod modulation type
- * \param fecrate TCC rate
- * \param pb_size PB size
+ * \param mod_fecrate_pb_size combined modulation type, TCC rate, PB size
* \param gil guard interval for third symbol and following symbols
* \param symbol_nb number of expected symbols
- * \param end_date date at which the reception is done and chandata can be
- * retrieved
*/
void
-phy_rx_prepare_sound (phy_t *ctx, uint nb_pb, phy_mod_t mod,
- phy_fecrate_t fecrate, phy_pb_size_t pb_size,
+phy_rx_prepare_sound (phy_t *ctx, uint nb_pb, u32 mod_fecrate_pb_size,
phy_gil_t gil, uint symbol_nb)
{
+ phy_mod_t mod = BF_GET (PHY_COMBO_PARAMS__MOD, mod_fecrate_pb_size);
+ phy_fecrate_t fecrate = BF_GET (PHY_COMBO_PARAMS__FECRATE,
+ mod_fecrate_pb_size);
+ phy_pb_size_t pb_size = BF_GET (PHY_COMBO_PARAMS__PB_SIZE,
+ mod_fecrate_pb_size);
u32 end_date = phy_date (ctx) + 1; // TODO: remove this.
/* PBP prepares HW for reception.
* This function is called when a FC is received, in the 'rx_fc_cb'. */
diff --git a/cesar/hal/phy/maximus/src/maximus_tmdma.c b/cesar/hal/phy/maximus/src/maximus_tmdma.c
index a81cb87a0c..39439d8966 100644
--- a/cesar/hal/phy/maximus/src/maximus_tmdma.c
+++ b/cesar/hal/phy/maximus/src/maximus_tmdma.c
@@ -67,7 +67,6 @@ phy_set_tonemask (phy_t *ctx, u32 *tonemask, uint carrier_nb)
/**
* Transfer tone map to hardware using the TM DMA.
* \param ctx phy context
- * \param tonemap_index tonemap index where to store tonemap
* \param tonemap tonemap blocks first descriptor
* set errno to:
* - EINVAL if ctx or tonemap are null, or if arguments are out-of-range or incorrect
@@ -75,8 +74,9 @@ phy_set_tonemask (phy_t *ctx, u32 *tonemask, uint carrier_nb)
* The tonemap uses two blocks.
*/
void
-phy_set_tonemap (phy_t *ctx, uint tonemap_index, blk_t *tonemap)
+phy_set_tonemap (phy_t *ctx, blk_t *tonemap)
{
+ uint tonemap_index = 0;
/* Set the tonemap_index value of PHY context.
* Copy tonemap contents into PHY context. */
diff --git a/cesar/hal/phy/maximus/test/src/test_phy_ctrl.c b/cesar/hal/phy/maximus/test/src/test_phy_ctrl.c
index 3a48b3e920..4e56782359 100644
--- a/cesar/hal/phy/maximus/test/src/test_phy_ctrl.c
+++ b/cesar/hal/phy/maximus/test/src/test_phy_ctrl.c
@@ -1414,7 +1414,7 @@ void phy_tx_param_test_case(test_t t)
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;
+ uint tonemap_index = 0;
printf("tx param\n");
test_case_begin(t, "tx param");
@@ -1423,9 +1423,8 @@ void phy_tx_param_test_case(test_t t)
{
mod = PHY_MOD_TM;
- phy_tx_param (ctx, fc_mode, short_ppdu,
- mod, fecrate, pb_size,
- gil, tonemap_index);
+ phy_tx_param (ctx, fc_mode, PHY_COMBO_PARAMS (mod, fecrate, pb_size),
+ gil);
test_fail_unless((EINVAL != errno)
&& (fc_mode == ctx->control.next_tx_param.fc_mode)
&& (short_ppdu == ctx->control.next_tx_param.short_ppdu)
@@ -1441,9 +1440,8 @@ void phy_tx_param_test_case(test_t t)
{
mod = PHY_MOD_HS_ROBO;
- phy_tx_param (ctx, fc_mode, short_ppdu,
- mod, fecrate, pb_size,
- gil, tonemap_index);
+ phy_tx_param (ctx, fc_mode, PHY_COMBO_PARAMS (mod, fecrate, pb_size),
+ gil);
test_fail_unless((EINVAL != errno)
&& (fc_mode == ctx->control.next_tx_param.fc_mode)
&& (short_ppdu == ctx->control.next_tx_param.short_ppdu)
@@ -1459,9 +1457,8 @@ void phy_tx_param_test_case(test_t t)
{
mod = PHY_MOD_MINI_ROBO;
- phy_tx_param (ctx, fc_mode, short_ppdu,
- mod, fecrate, pb_size,
- gil, tonemap_index);
+ phy_tx_param (ctx, fc_mode, PHY_COMBO_PARAMS (mod, fecrate, pb_size),
+ gil);
test_fail_unless((EINVAL != errno)
&& (fc_mode == ctx->control.next_tx_param.fc_mode)
&& (short_ppdu == ctx->control.next_tx_param.short_ppdu)
@@ -1493,8 +1490,7 @@ void phy_tx_param_sound_test_case(test_t t)
mod = PHY_MOD_MINI_ROBO;
phy_tx_param_sound (ctx, fc_mode, nb_pb,
- mod, fecrate,
- pb_size, gil);
+ PHY_COMBO_PARAMS (mod, fecrate, pb_size), gil);
test_fail_unless((EINVAL != errno)
&& (fc_mode == ctx->control.next_tx_param.fc_mode)
&& !ctx->control.next_tx_param.short_ppdu
@@ -1513,8 +1509,7 @@ void phy_tx_param_sound_test_case(test_t t)
gil = PHY_GIL_417;
phy_tx_param_sound (ctx, fc_mode, nb_pb,
- mod, fecrate,
- pb_size, gil);
+ PHY_COMBO_PARAMS (mod, fecrate, pb_size), gil);
test_fail_unless((EINVAL != errno)
&& (fc_mode == ctx->control.next_tx_param.fc_mode)
&& !ctx->control.next_tx_param.short_ppdu
@@ -1531,8 +1526,7 @@ void phy_tx_param_sound_test_case(test_t t)
mod = PHY_MOD_ROBO;
phy_tx_param_sound (ctx, fc_mode, nb_pb,
- mod, fecrate,
- pb_size, gil);
+ PHY_COMBO_PARAMS (mod, fecrate, pb_size), gil);
test_fail_unless((EINVAL != errno)
&& (fc_mode == ctx->control.next_tx_param.fc_mode)
&& !ctx->control.next_tx_param.short_ppdu
@@ -1567,7 +1561,7 @@ void phy_tx_frame_test_case(test_t t)
blk_t tonemap2;
u8 tonemap1_data[MAC_PB520_BYTES];
u8 tonemap2_data[(PHY_CARRIER_NB+1)/2-MAC_PB520_BYTES];
- uint tonemap_index = 3;
+ uint tonemap_index = 0;
printf("tx frame\n");
test_case_begin(t, "tx frame");
@@ -1620,7 +1614,7 @@ void phy_tx_frame_test_case(test_t t)
tonemap1.next = &tonemap2;
tonemap1.data = tonemap1_data;
ctx->control.next_tx_param.mod = PHY_MOD_TM;
- phy_set_tonemap (ctx, tonemap_index, &tonemap1);
+ phy_set_tonemap (ctx, &tonemap1);
// set fc av
memset(&fc_av, '\0', 4*sizeof(u32));
@@ -2731,7 +2725,6 @@ void maximus_phy_send_test_case(test_t t)
blk_t tonemap2;
u8 tonemap1_data[MAC_PB520_BYTES];
u8 tonemap2_data[(PHY_CARRIER_NB+1)/2-MAC_PB520_BYTES];
- uint tonemap_index = 3;
printf("maximus phy send\n");
test_case_begin(t, "maximus phy send");
@@ -2743,7 +2736,7 @@ void maximus_phy_send_test_case(test_t t)
tonemap2.data = tonemap2_data;
tonemap1.next = &tonemap2;
tonemap1.data = tonemap1_data;
- phy_set_tonemap (ctx, tonemap_index, &tonemap1);
+ phy_set_tonemap (ctx, &tonemap1);
ctx->control.current_tx_param.mod = PHY_MOD_ROBO;
// set medium state
@@ -3176,7 +3169,7 @@ void phy_rx_prepare_test_case(test_t t)
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 tonemap_index = 0;
uint symbol_nb = 0;
printf("rx prepare\n");
@@ -3186,13 +3179,7 @@ void phy_rx_prepare_test_case(test_t t)
{
mod = PHY_MOD_TM;
- phy_rx_prepare (ctx,
- short_ppdu,
- mod,
- fecrate,
- pb_size,
- gil,
- tonemap_index,
+ phy_rx_prepare (ctx, PHY_COMBO_PARAMS (mod, fecrate, pb_size), gil,
symbol_nb);
test_fail_unless ((EINVAL != errno)
&& (short_ppdu == ctx->control.rx_param.short_ppdu)
@@ -3245,13 +3232,7 @@ void phy_rx_prepare_test_case(test_t t)
{
mod = PHY_MOD_ROBO;
- phy_rx_prepare (ctx,
- short_ppdu,
- mod,
- fecrate,
- pb_size,
- gil,
- tonemap_index,
+ phy_rx_prepare (ctx, PHY_COMBO_PARAMS (mod, fecrate, pb_size), gil,
symbol_nb);
test_fail_unless ((EINVAL != errno)
&& (short_ppdu == ctx->control.rx_param.short_ppdu)
@@ -3304,13 +3285,7 @@ void phy_rx_prepare_test_case(test_t t)
{
mod = PHY_MOD_MINI_ROBO;
- phy_rx_prepare (ctx,
- short_ppdu,
- mod,
- fecrate,
- pb_size,
- gil,
- tonemap_index,
+ phy_rx_prepare (ctx, PHY_COMBO_PARAMS (mod, fecrate, pb_size), gil,
symbol_nb);
test_fail_unless ((EINVAL != errno)
&& (short_ppdu == ctx->control.rx_param.short_ppdu)
@@ -3377,13 +3352,9 @@ void phy_rx_prepare_sound_test_case(test_t t)
{
mod = PHY_MOD_ROBO;
- phy_rx_prepare_sound (ctx,
- 0,
- mod,
- fecrate,
- pb_size,
- gil,
- symbol_nb);
+ phy_rx_prepare_sound (ctx, 0,
+ PHY_COMBO_PARAMS (mod, fecrate, pb_size), gil,
+ symbol_nb);
test_fail_unless ((EINVAL != errno)
&& !ctx->control.rx_param.short_ppdu
&& (mod == ctx->control.rx_param.mod)
@@ -3437,13 +3408,9 @@ void phy_rx_prepare_sound_test_case(test_t t)
pb_size = PHY_PB_SIZE_136;
gil = PHY_GIL_567;
- phy_rx_prepare_sound (ctx,
- 0,
- mod,
- fecrate,
- pb_size,
- gil,
- symbol_nb);
+ phy_rx_prepare_sound (ctx, 0,
+ PHY_COMBO_PARAMS (mod, fecrate, pb_size), gil,
+ symbol_nb);
test_fail_unless ((EINVAL != errno)
&& !ctx->control.rx_param.short_ppdu
&& (mod == ctx->control.rx_param.mod)
diff --git a/cesar/hal/phy/maximus/test/src/test_tmdma.c b/cesar/hal/phy/maximus/test/src/test_tmdma.c
index 297653ef26..58e33257da 100644
--- a/cesar/hal/phy/maximus/test/src/test_tmdma.c
+++ b/cesar/hal/phy/maximus/test/src/test_tmdma.c
@@ -94,7 +94,7 @@ void phy_set_tonemap_test_case(test_t t)
blk_t tonemap2;
u8 tonemap1_data[MAC_PB520_BYTES];
u8 tonemap2_data[(PHY_CARRIER_NB+1)/2-MAC_PB520_BYTES]; // 4 bits per carrier
- uint tonemap_index = 3;
+ uint tonemap_index = 0;
memset(tonemap1_data, 'b', MAC_PB520_BYTES*sizeof(u8));
memset(tonemap2_data, 'c', ((PHY_CARRIER_NB+1)/2-MAC_PB520_BYTES)*sizeof(u8));
@@ -103,7 +103,7 @@ void phy_set_tonemap_test_case(test_t t)
tonemap1.next = &tonemap2;
tonemap1.data = tonemap1_data;
- phy_set_tonemap (ctx, tonemap_index, &tonemap1);
+ phy_set_tonemap (ctx, &tonemap1);
test_fail_unless ((EINVAL != errno)
&& (0 == memcmp(tonemap1.data, ctx->tmdma.tonemap[tonemap_index]->data, MAC_PB520_BYTES))
&& (0 == memcmp(tonemap2.data, ctx->tmdma.tonemap[tonemap_index]->next->data, (PHY_CARRIER_NB+1)/2-MAC_PB520_BYTES)));