summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2009-02-13 15:16:49 +0000
committerschodet2009-02-13 15:16:49 +0000
commitbf89fb2c442df0ab0ac16e82283ea4285f0a550c (patch)
treedaf64b682095d3c031fe2b6022a34942ee2e672e
parent12ffa3e11f13e6d6013a0e4c8cc0770e24292535 (diff)
* hal/phy/test/phy:
- added reply support for RX bursts, closes #291. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@3999 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/hal/phy/test/phy/src/burst.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/cesar/hal/phy/test/phy/src/burst.c b/cesar/hal/phy/test/phy/src/burst.c
index a75313d53d..631085108e 100644
--- a/cesar/hal/phy/test/phy/src/burst.c
+++ b/cesar/hal/phy/test/phy/src/burst.c
@@ -360,6 +360,23 @@ test_phy_burst_rx_handle (test_phy_t *ctx, u32 rx_date, const u32 *fc_av)
}
}
+static void ARCH_ILRAM
+test_phy_burst_rx_reply (test_phy_t *ctx)
+{
+ dbg_assert (ctx);
+ test_phy_msg_burst_t *b = &ctx->static_msg.msg.burst;
+ test_phy_data_parameters_t *d = &b->data_parameters;
+ /* Optionally prepare FC 1.0. */
+ if (PHY_FC_MODE_IS_HYBRID (d->fc_mode))
+ phy_tx_fc10 (ctx->phy, 0xfc1000);
+ /* Program TX. */
+ phy_tx_param_short (ctx->phy, d->fc_mode);
+ u32 fc[4];
+ fc[0] = 0x51; fc[1] = b->tx_date;
+ fc[2] = 0x01234567; fc[3] = 0x89abcdef;
+ phy_tx_frame (ctx->phy, b->tx_date, false, false, fc);
+}
+
static bool ARCH_ILRAM
test_phy_burst_rx_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av)
{
@@ -369,11 +386,23 @@ test_phy_burst_rx_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av)
test_phy_msg_burst_t *b = &ctx->static_msg.msg.burst;
test_phy_data_parameters_t *d = &b->data_parameters;
dbg_assert (!b->receiving);
+ /* Handle received frame. */
b->receiving = true;
+ b->replied = false;
bool call_dsr = test_phy_burst_rx_handle (ctx, rx_date, fc_av);
+ uint flp_tck = d->prefc_tck + d->data_tck + b->ifs_tck;
+ /* Reply (none, now or after PBDMA callback)? */
+ if (b->reply && ctx->received_fc_crc_ok)
+ {
+ b->replied = true;
+ flp_tck += b->rifs_tck + d->prefc_tck;
+ b->tx_date = rx_date + d->prefc_tck + d->data_tck + b->rifs_tck;
+ if (d->short_ppdu || d->sound)
+ test_phy_burst_rx_reply (ctx);
+ }
+ /* Next reception. */
if (!b->rx_stop)
- phy_rx_activate (ctx->phy, false, rx_date + d->prefc_tck
- + d->data_tck + b->ifs_tck, true);
+ phy_rx_activate (ctx->phy, false, rx_date + flp_tck, true);
return call_dsr;
}
@@ -382,6 +411,9 @@ test_phy_burst_rx_pbdma_cb (void *user, u32 status_word)
{
test_phy_t *ctx = (void *) user;
dbg_assert (ctx);
+ dbg_assert (ctx->static_msg.id == TEST_PHY_MSG_ID_BURST);
+ test_phy_msg_burst_t *b = &ctx->static_msg.msg.burst;
+ test_phy_data_parameters_t *d = &b->data_parameters;
phy_pbdma_status_t pbdma_status = PHY_PBDMA_STATUS (status_word);
dbg_assert (!pbdma_status.rx_header_load_error
&& !pbdma_status.ahb_response_error
@@ -390,6 +422,9 @@ test_phy_burst_rx_pbdma_cb (void *user, u32 status_word)
&& !pbdma_status.pb_null
&& (pbdma_status.end_rx_pb
|| pbdma_status.end_chandata));
+ /* Reply? */
+ if (b->replied && !d->sound)
+ test_phy_burst_rx_reply (ctx);
/* More processing in the DSR. */
return true;
}
@@ -409,7 +444,9 @@ test_phy_burst_rx_stats (test_phy_t *ctx)
sf->next = NULL;
sf->frame = TEST_PHY_BURST_FRAME_RX;
sf->date = ctx->received_pre_date;
- sf->reply = false;
+ sf->reply = b->replied;
+ if (sf->reply)
+ sf->reply_date = b->tx_date;
sf->fc10 = ctx->received_fc10;
for (i = 0; i < 4; i++)
sf->fc[i] = ctx->received_fc[i];
@@ -1089,6 +1126,7 @@ test_phy_burst_fcall (fcall_ctx_t *fcall, fcall_param_t **param,
memset (&m->stats, 0, sizeof (m->stats));
m->request = TEST_PHY_BURST_REQ_NONE;
m->receiving = false;
+ m->replied = false;
m->chandata_blocks = NULL;
/* Message accepted, will return later. */
fcall_param_set_async (*param, 1);