From 48534d8d5bd88f6d81c67cfcbf6aa4b562828af1 Mon Sep 17 00:00:00 2001 From: schodet Date: Wed, 16 Jun 2010 11:50:18 +0000 Subject: cesar/hal/phy: take hardware delay into account, refs #1655 git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7228 017c9cb6-072f-447c-8318-d5b54f68fe89 --- cesar/hal/phy/defs.h | 6 ++++++ cesar/hal/phy/src/phy.c | 3 ++- cesar/hal/phy/src/tx.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'cesar') 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), -- cgit v1.2.3