summaryrefslogtreecommitdiff
path: root/hal/phy
diff options
context:
space:
mode:
authorburet2008-01-25 10:40:28 +0000
committerburet2008-01-25 10:40:28 +0000
commitc69a05462880585f026da608b0509577a8711a32 (patch)
treed94cf46260db2443637470186c3595ac4510e935 /hal/phy
parentac1ebb0d235ffb26987bd2216349e230d3c5de02 (diff)
Maximus V2: HAL PHY chandata transfer error correction.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1330 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'hal/phy')
-rw-r--r--hal/phy/maximus/inc/maximus_phy_ctx.h4
-rw-r--r--hal/phy/maximus/src/maximus_pbdma.c7
-rw-r--r--hal/phy/maximus/src/maximus_phy_ctrl.c46
-rw-r--r--hal/phy/maximus/test/src/test_pbdma.c8
-rw-r--r--hal/phy/maximus/test/src/test_phy_ctrl.c6
5 files changed, 30 insertions, 41 deletions
diff --git a/hal/phy/maximus/inc/maximus_phy_ctx.h b/hal/phy/maximus/inc/maximus_phy_ctx.h
index ee6498a9a8..b5dfd3dab8 100644
--- a/hal/phy/maximus/inc/maximus_phy_ctx.h
+++ b/hal/phy/maximus/inc/maximus_phy_ctx.h
@@ -229,8 +229,8 @@ struct maximus_pbdma_t
uint nb_ready;
/** Number of the PB after which an interrupt is triggered. */
uint nb_pb_it;
- /** Used to indicate or a chandata transfer (true) or a PB transfer (false).*/
- bool transfer_mode;
+ /** Used to indicate that a chandata transfer has been requested (true) or not (false). */
+ bool chandata_transfer;
/** First PB descriptor. */
phy_pb_t *first_pb;
/** Current PB descriptor for Rx. */
diff --git a/hal/phy/maximus/src/maximus_pbdma.c b/hal/phy/maximus/src/maximus_pbdma.c
index 5f3b094cfd..9445ba19f7 100644
--- a/hal/phy/maximus/src/maximus_pbdma.c
+++ b/hal/phy/maximus/src/maximus_pbdma.c
@@ -70,9 +70,6 @@ phy_pbdma_start (phy_t *ctx, bool bypass_aes, const u32 iv[3],
ctx->pbdma.nb_ready = nb_ready;
ctx->pbdma.nb_pb_it = nb_pb_it;
ctx->pbdma.first_pb = first_pb;
-
- // set PB transfer mode
- ctx->pbdma.transfer_mode = false;
// reset current PB descriptor in case of Rx
ctx->pbdma.current_pb = &ctx->pbdma.first_pb->pb_rx;
@@ -171,8 +168,8 @@ phy_pbdma_start_chandata (phy_t *ctx, phy_chandata_t *first_chandata)
{
ctx->pbdma.first_chandata = first_chandata;
- // set chandata transfer mode
- ctx->pbdma.transfer_mode = true;
+ // set chandata transfer
+ ctx->pbdma.chandata_transfer = true;
}
}
diff --git a/hal/phy/maximus/src/maximus_phy_ctrl.c b/hal/phy/maximus/src/maximus_phy_ctrl.c
index d1deea62f0..bb35944c3e 100644
--- a/hal/phy/maximus/src/maximus_phy_ctrl.c
+++ b/hal/phy/maximus/src/maximus_phy_ctrl.c
@@ -935,7 +935,7 @@ maximus_phy_recv_noise (phy_t *ctx, sci_msg_t *msg)
if ((ctx->control.rx_param.src_tx_id == ntohs(msg->hdr.phy->tx_id))
&& (ctx->control.rx_param.src_station_id == ntohs(msg->sci_hdr->station_id)))
{
- if (ctx->pbdma.transfer_mode) // 'phy_pbdma_start_chandata()' has been called
+ if (ctx->pbdma.chandata_transfer) // 'phy_pbdma_start_chandata()' has been called
{
// if channel perturbation is enabled, get the noise
if (0 != msg->length)
@@ -1019,21 +1019,22 @@ maximus_phy_recv_noise (phy_t *ctx, sci_msg_t *msg)
"%s: phy_pbdma_start_chandata() has been called but channel perturbation is disabled", __FUNCTION__);
}
- // reset transfer mode
- ctx->pbdma.transfer_mode = false;
-
/* At the end of the chandata transfer (i.e. current_chandata->last = 1),
* or if 'phy_pbdma_start_chandata()' has been called,
* a chandata end interrupt is simulated by calling phy_pbdma_cb callback. */
ctx->pbdma.status_word.end_chandata = 1;
maximus_pending_isrs |= (1 << PHY_HAL_INTERRUPT_PBDMA);
- ret = 0;
}
- else // ctx->pbdma.transfer_mode = false
+ else // ctx->pbdma.chandata_transfer = false
{
station_log(&my_station, STATION_LOG_DEBUG, STATION_LOGTYPE_PHY,
"%s: phy_pbdma_start_chandata() has not been called and channel perturbation = %d", __FUNCTION__, 0 != msg->length);
}
+
+ // reset chandata transfer
+ ctx->pbdma.chandata_transfer = false;
+
+ ret = 0;
}
else
{
@@ -2142,31 +2143,22 @@ phy_tx_frame (phy_t *ctx, u32 date, bool want_conf, bool stop_tx_on_prp_lost,
ctx->control.stop_tx_on_prp_lost = stop_tx_on_prp_lost;
memcpy(ctx->control.next_tx_param.fc_av, fc_av, 4*sizeof(u32));
- if (!ctx->pbdma.transfer_mode) // PB transfer
- {
- // fill callback data
- tx_frame_cb_data.ctx = ctx;
- tx_frame_cb_data.want_conf = want_conf;
+ // fill callback data
+ tx_frame_cb_data.ctx = ctx;
+ tx_frame_cb_data.want_conf = want_conf;
- // send netclock message to Maximus
- if (-1 == netclock_schedule(my_station.netclock,
- ctx->control.next_tx_param.tx_frame_netclock_cb,
- NETWORK_CLOCK_TYPE_STATION,
- maximus_phy_schedule_tick(date),
- &maximus_phy_tx_frame_cb,
- (void*)&tx_frame_cb_data,
- &ctx->control.next_tx_param.tx_frame_netclock_id))
- {
- station_log(&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_PHY,
- "%s: errno = %d", __FUNCTION__, errno);
- dbg_assert_print(false, "errno = %d when scheduling a netclock message", errno);
- }
- }
- else // chandata transfer
+ // send netclock message to Maximus
+ if (-1 == netclock_schedule(my_station.netclock,
+ ctx->control.next_tx_param.tx_frame_netclock_cb,
+ NETWORK_CLOCK_TYPE_STATION,
+ maximus_phy_schedule_tick(date),
+ &maximus_phy_tx_frame_cb,
+ (void*)&tx_frame_cb_data,
+ &ctx->control.next_tx_param.tx_frame_netclock_id))
{
station_log(&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_PHY,
"%s: errno = %d", __FUNCTION__, errno);
- dbg_assert_print(false, "errno = %d because station should not transmit chandata", errno);
+ dbg_assert_print(false, "errno = %d when scheduling a netclock message", errno);
}
}
}
diff --git a/hal/phy/maximus/test/src/test_pbdma.c b/hal/phy/maximus/test/src/test_pbdma.c
index 8f9e1c13d6..270cc47607 100644
--- a/hal/phy/maximus/test/src/test_pbdma.c
+++ b/hal/phy/maximus/test/src/test_pbdma.c
@@ -77,7 +77,7 @@ void phy_pbdma_start_test_case(test_t t)
&& (nb_ready == ctx->pbdma.nb_ready)
&& (nb_pb_it == ctx->pbdma.nb_pb_it)
&& (pb == ctx->pbdma.first_pb)
- && (!ctx->pbdma.transfer_mode)
+ && (!ctx->pbdma.chandata_transfer)
&& (ctx->pbdma.current_pb == &ctx->pbdma.first_pb->pb_rx));
phy_pb_tx_t * current_pb = &ctx->pbdma.first_pb->pb_tx;
for (i=0; i<PHY_PB_MAX_NB; i++)
@@ -121,7 +121,7 @@ void phy_pbdma_start_test_case(test_t t)
&& (nb_ready == ctx->pbdma.nb_ready)
&& (nb_pb_it == ctx->pbdma.nb_pb_it)
&& (pb == ctx->pbdma.first_pb)
- && (!ctx->pbdma.transfer_mode)
+ && (!ctx->pbdma.chandata_transfer)
&& (ctx->pbdma.current_pb == &ctx->pbdma.first_pb->pb_rx));
} test_end;
}
@@ -271,7 +271,7 @@ void phy_pbdma_start_chandata_test_case(test_t t)
test_fail_unless ((EINVAL != errno)
&& (&chandata == ctx->pbdma.first_chandata)
&& (0 == memcmp(chandata_data, ctx->pbdma.first_chandata->blk.data, 4*chandata_size))
- && (ctx->pbdma.transfer_mode));
+ && (ctx->pbdma.chandata_transfer));
} test_end;
test_begin(t, "pbdma start chandata in Rx")
@@ -279,7 +279,7 @@ void phy_pbdma_start_chandata_test_case(test_t t)
phy_pbdma_start_chandata (ctx, &chandata);
test_fail_unless ((EINVAL != errno)
&& (&chandata == ctx->pbdma.first_chandata)
- && (ctx->pbdma.transfer_mode));
+ && (ctx->pbdma.chandata_transfer));
} test_end;
}
diff --git a/hal/phy/maximus/test/src/test_phy_ctrl.c b/hal/phy/maximus/test/src/test_phy_ctrl.c
index 1858094e2c..887b0e784c 100644
--- a/hal/phy/maximus/test/src/test_phy_ctrl.c
+++ b/hal/phy/maximus/test/src/test_phy_ctrl.c
@@ -575,8 +575,8 @@ void maximus_phy_recv_test_case(test_t t)
// set tx id
phy_hdr.tx_id = 10;
- // set transfer mode
- ctx->pbdma.transfer_mode = true;
+ // set chandata transfer
+ ctx->pbdma.chandata_transfer = true;
// frequency noise
ctx->pbdma.first_chandata = freq_noise_chandata;
@@ -813,7 +813,7 @@ void phy_init_test_case(test_t t)
&& (&phy_access_conf_cb == ctx->control.access_conf_cb)
&& (&phy_pbdma_cb == ctx->control.pbdma_cb)
&& (&phy_deferred_cb == ctx->control.deferred_cb)
- && !ctx->pbdma.transfer_mode);
+ && !ctx->pbdma.chandata_transfer);
ctx->warning_assert = true;
} test_end;