summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
Diffstat (limited to 'cesar')
-rw-r--r--cesar/hal/phy/defs.h6
-rw-r--r--cesar/hal/phy/src/phy.c3
-rw-r--r--cesar/hal/phy/src/tx.c4
3 files changed, 10 insertions, 3 deletions
diff --git a/cesar/hal/phy/defs.h b/cesar/hal/phy/defs.h
index 40e3234013..222a0e1a04 100644
--- a/cesar/hal/phy/defs.h
+++ b/cesar/hal/phy/defs.h
@@ -71,6 +71,12 @@
/** Delay for MAFADESE start. */
#define PHY_START_MAFADESE_DELAY_TCK (1400 / 3)
+/** Hardware delay for RX between sample on medium and DSP analysis. */
+#define PHY_RX_HARDWARE_DELAY_TCK (10 + 3)
+
+/** Hardware delay for TX between start command and first sample on medium. */
+#define PHY_TX_HARDWARE_DELAY_TCK (12 + 8)
+
/** Noise energy type.*/
typedef unsigned int phy_noise_energy_t;
diff --git a/cesar/hal/phy/src/phy.c b/cesar/hal/phy/src/phy.c
index a64324736d..149e8e41c7 100644
--- a/cesar/hal/phy/src/phy.c
+++ b/cesar/hal/phy/src/phy.c
@@ -159,7 +159,8 @@ phy_isr (cyg_vector_t vector, cyg_addrword_t data)
u32 offset_smp = BF_GET (PHY_DSPSS_RESYS_DETECT_OFFSET__PREAMBLE,
PHY_DSPSS_RESYS_DETECT_OFFSET);
u32 rx_date = PHY_PRATIC_STA_LAST_RECEIVED_FRAME_DATE
- - offset_smp / 3 - PHY_PREAMBLE_SYNCP_TCK;
+ - offset_smp / 3 - PHY_PREAMBLE_SYNCP_TCK
+ - PHY_RX_HARDWARE_DELAY_TCK;
PHY_TRACE (RX_FC_CB, phy_date (), rx_date);
if (status & BF_MASK (PHY_DSPSS_RX_FC_AV_STATUS__CRC_OK))
{
diff --git a/cesar/hal/phy/src/tx.c b/cesar/hal/phy/src/tx.c
index 534682e380..eec1b70fe1 100644
--- a/cesar/hal/phy/src/tx.c
+++ b/cesar/hal/phy/src/tx.c
@@ -182,8 +182,8 @@ phy_tx_frame (phy_t *ctx, u32 date, bool want_conf, bool stop_tx_on_prp_lost,
else
LEON_ITC2_MASK &= ~(1 << LEON_ITC2_IT__PRATIC_ACCESS_CONF);
/* Program TX. */
- PHY_TRACE_DATE_WARNING (date);
- PHY_PRATIC_TIMER_2_DATE = date;
+ PHY_TRACE_DATE_WARNING (date - PHY_TX_HARDWARE_DELAY_TCK);
+ PHY_PRATIC_TIMER_2_DATE = date - PHY_TX_HARDWARE_DELAY_TCK;
PHY_PRATIC_TIMER_2_CTRL =
BF_FILL (PHY_PRATIC_TIMER_X_CTRL,
(ACTION, PHY_PRATIC_ACTION__START_TX),