#ifndef hal_phy_defs_h #define hal_phy_defs_h /* Cesar project {{{ * * Copyright (C) 2007 Spidcom * * <<>> * * }}} */ /** * \file hal/phy/defs.h * \brief HAL Phy types and defines. * \ingroup hal_phy */ /** DSP clock is supposed to be 150 MHz, but it is 75 MHz on prototype. */ #include "common/module.h" #if defined (__sparc__) && MODULE_INCLUDED (hal_phy) # include "config/phy/dsp.h" # define PHY_DSP_CLOCK_MHZ (CONFIG_PHY_DSP_150MHZ ? 150 : 75) #else # define PHY_DSP_CLOCK_MHZ 150 #endif /** Number of OFDM carrier, defined by the hardware. */ #define PHY_CARRIER_NB 1155 /** Number of first OFDM carrier, defined by the hardware. */ #define PHY_CARRIER_OFFSET 74 /** Carrier min and max used. */ #define PHY_CARRIER_MIN PHY_CARRIER_OFFSET #define PHY_CARRIER_MAX (PHY_CARRIER_OFFSET + PHY_CARRIER_NB - 1) /** Total number of OFDM carrier, also counting unusable ones. */ #define PHY_ALL_CARRIER_NB 1536 /** Number of AV carriers per HP10 carrier. */ #define PHY_HP10_CARRIER_FACTOR 8 /** Number of OFDM carrier for HP10. */ #define PHY_HP10_CARRIER_NB \ ((PHY_CARRIER_OFFSET + PHY_CARRIER_NB - 1) / PHY_HP10_CARRIER_FACTOR \ - PHY_HP10_CARRIER_OFFSET + 1) /** Number of first OFDM carrier for HP10. */ #define PHY_HP10_CARRIER_OFFSET \ CEIL_DIV (PHY_CARRIER_OFFSET, PHY_HP10_CARRIER_FACTOR) /** Number of words needed to define a tonemask. */ #define PHY_TONEMASK_WORDS ((PHY_CARRIER_NB + 32 - 1) / 32) /** Number of bytes needed to define a tonemask. */ #define PHY_TONEMASK_SIZE (PHY_TONEMASK_WORDS * 4) /** Number of words needed to define a tonemap. */ #define PHY_TONEMAP_WORDS ((PHY_CARRIER_NB + 8 - 1) / 8) /** Number of bytes needed to define a tonemap. */ #define PHY_TONEMAP_SIZE (PHY_TONEMAP_WORDS * 4) /** Number of words in HP10 extended tonemask. */ #define PHY_HP10_TONEMASK_WORDS 6 /** Delay to find a preamble, defined by the hardware, not precise. * At this time, we got confirmation from HW. * False alarm is not possible anymore. */ #define PHY_PREAMBLE_CONFIRMATION_DELAY_TCK ((192 + 9 * 384) / 3) /** Delay for FC 1.0 preparation. * 7900: FC 1.0 creation cycles. * 1600: last FC 1.0 IFFT cycles. * 1152: hybrid preamble. * 372: preamble/FC overlapping. */ #define PHY_FC_10_PREPARATION_DELAY_TCK \ (((7900 + 1600) / (PHY_DSP_CLOCK_MHZ / 25)) - 1152 + 372 / 3 + 1) /** Delay for MAFADESE start. */ #define PHY_START_MAFADESE_DELAY_TCK (1400 / 3) /** Hardware delay after short MPDU to activate RX again. */ #define PHY_RX_ACTIVATE_DELAY_AFTER_SHORT_TCK (60 * 25) /** Hardware delay after RX BURST MPDU BIFS to activate RX again. */ #define PHY_RX_ACTIVATE_DELAY_AFTER_BURST_TCK (0 * 25) /** Hardware delay for RX between sample on medium and DSP analysis. */ #define PHY_RX_HARDWARE_DELAY_TCK (12 + 3) /** Hardware delay for TX between start command and first sample on medium. */ #define PHY_TX_HARDWARE_DELAY_TCK (54 / 3 + 8) /** Hardware delay for PRP TX between start command and first sample on * medium. */ #define PHY_PRP_HARDWARE_DELAY_TCK (14 / 3 + 8) /** Hardware delay for preamble or PRS creation, include a margin for software * execution. */ #define PHY_PREPARE_DELAY_TCK (90 * 25) /** Noise energy type.*/ typedef unsigned int phy_noise_energy_t; /** Spectrum type.*/ typedef unsigned int phy_spectrum_t; /** Number of noise storable in a block */ #define PHY_NOISE_NB_PER_BLK (BLK_SIZE/(sizeof(phy_noise_energy_t))) /** Number of spectrum storable in a block */ #define PHY_SPECTRUM_NB_PER_BLK (BLK_SIZE/(sizeof(phy_spectrum_t))) /** Modulation mode. */ enum phy_mod_t { PHY_MOD_ROBO, /*< ROBO mode. */ PHY_MOD_HS_ROBO, /*< HIGH-SPEED ROBO mode. */ PHY_MOD_MINI_ROBO, /*< MINI ROBO mode. */ PHY_MOD_TM, /*< Tone map modulation. */ PHY_MOD_NONE, /*< Invalid mode. */ PHY_MOD_ROBO_NB = PHY_MOD_TM, /*< Number of ROBO modes. */ }; typedef enum phy_mod_t phy_mod_t; /** Forward Error Correction puncturing rate. */ enum phy_fecrate_t { PHY_FEC_RATE_1_2, /*< FEC rate 1/2. */ PHY_FEC_RATE_16_21, /*< FEC rate 16/21. */ PHY_FEC_RATE_NONE, /*< Invalid FEC rate. */ PHY_FEC_RATE_NB = PHY_FEC_RATE_NONE /*< Number of FEC Fate. */ }; typedef enum phy_fecrate_t phy_fecrate_t; /** PB size. */ enum phy_pb_size_t { PHY_PB_SIZE_136, /*< PB size 136 bytes, only one PB. */ PHY_PB_SIZE_520, /*< PB size 520 bytes. */ PHY_PB_SIZE_NONE /*< Invalid PB size. */ }; typedef enum phy_pb_size_t phy_pb_size_t; /** FC mode. */ enum phy_fc_mode_t { PHY_FC_MODE_HYBRID_1, /*< Hybrid FC, 1 symbol. */ PHY_FC_MODE_HYBRID_2, /*< Hybrid FC, 2 symbol. */ PHY_FC_MODE_AV_1, /*< AV FC, 1 symbol. */ PHY_FC_MODE_AV_2, /*< AV FC, 2 symbol. */ PHY_FC_MODE_NB, /*< Number of defined FC mode. */ PHY_FC_MODE_NONE = PHY_FC_MODE_NB /*< Invalid FC mode. */ }; typedef enum phy_fc_mode_t phy_fc_mode_t; /** Is it a hybrid mode. */ #define PHY_FC_MODE_IS_HYBRID(m) (!((m) & 0x2)) /** Is there two symbols. */ #define PHY_FC_MODE_IS_TWO_SYMBOLS(m) ((m) & 0x1) /** Make FC mode. */ #define PHY_FC_MODE(hybrid, fc_symb_nb) (((hybrid) ? 0 : 2) \ | ((fc_symb_nb == 1) ? 0 : 1)) /** Guard interval length. */ enum phy_gil_t { PHY_GIL_417, /*< Guard interval 417 samples. */ PHY_GIL_567, /*< Guard interval 567 samples. */ PHY_GIL_3534, /*< Guard interval 3534 samples. */ PHY_GIL_NB, /*< Number of defined guard intervals. */ PHY_GIL_NONE = PHY_GIL_NB /*< Invalid guard interval. */ }; typedef enum phy_gil_t phy_gil_t; /** Build combo parameters for phy_tx_param and phy_rx_prepare family * functions. */ #define PHY_COMBO_PARAMS(mod, fecrate, pb_size) \ BF_FILL (PHY_COMBO_PARAMS, (MOD, (mod)), (FECRATE, (fecrate)), \ (PB_SIZE, (pb_size))) #define PHY_COMBO_PARAMS__MOD 3, 2 #define PHY_COMBO_PARAMS__FECRATE 1, 1 #define PHY_COMBO_PARAMS__PB_SIZE 0, 0 /** Combo parameters for want_conf & stop_tx_on_prp_lost. */ #define PHY_WANT_CONF 2 #define PHY_STOP_ON_PRP_LOST 1 /** Events. */ enum phy_event_t { PHY_EVENT_RX_FC = 1, PHY_EVENT_ACCESS = 2, PHY_EVENT_ACCESS_CONF = 4, PHY_EVENT_PBDMA = 8, }; typedef enum phy_event_t phy_event_t; #endif /* hal_phy_defs_h */