summaryrefslogtreecommitdiff
path: root/cesar/mac/common/timings.h
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/common/timings.h')
-rw-r--r--cesar/mac/common/timings.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/cesar/mac/common/timings.h b/cesar/mac/common/timings.h
new file mode 100644
index 0000000000..c61b4490c6
--- /dev/null
+++ b/cesar/mac/common/timings.h
@@ -0,0 +1,159 @@
+#ifndef mac_common_timings_h
+#define mac_common_timings_h
+/* Maria project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file mac/common/timings.h
+ * \brief Homeplug AV timings.
+ * \ingroup mac_common
+ */
+
+/** Number of ticks per microsecond. */
+#define MAC_TCK_PER_US 25
+
+/** Number of ticks per frame length unit. */
+#define MAC_TCK_PER_FL 32
+
+/** Convert milliseconds to ticks. */
+#define MAC_MS_TO_TCK(ms) ((ms) * MAC_TCK_PER_US * 1000)
+/** Convert microseconds to ticks. */
+#define MAC_US_TO_TCK(us) ((us) * MAC_TCK_PER_US)
+/** Convert ticks to microseconds.
+ * \warning truncate to zero. */
+#define MAC_TCK_TO_US(tck) ((tck) / MAC_TCK_PER_US)
+/** Convert ticks to allocation time unit.
+ * \warning truncate to zero. */
+#define MAC_TCK_TO_ATU(tck) ((tck) / 256)
+/** Convert allocation time unit to ticks. */
+#define MAC_ATU_TO_TCK(atu) ((atu) * 256)
+/** Convert frame length unit to ticks. */
+#define MAC_FL_TO_TCK(fl) ((fl) * MAC_TCK_PER_FL)
+
+/** Allocation interframe spacing (us). */
+#define MAC_AIFS_US 30
+/** Allocation interframe spacing (ticks). */
+#define MAC_AIFS_TCK MAC_US_TO_TCK (MAC_AIFS_US)
+
+/** Default AV response interframe spacing (ticks). */
+#define MAC_RIFS_DEFAULT_TCK MAC_US_TO_TCK (140)
+
+/** Minimum rifs value in frame length unit that can be used for MPDU transmission
+ * with negociated tonemap. (30 us) */
+#define MAC_RIFS_AV_MIN_FL 24
+
+/** Maximum rifs value in frame length unit that can be used for MPDU transmission
+ * with negociated tonemap. (160 us) */
+#define MAC_RIFS_AV_MAX_FL 125
+
+/** RIFS value used by our implementation for negotiated tonemap, independent
+ * of the number of symbols (fl). */
+#define MAC_RIFS_SPC_ANY_FL (MAC_RIFS_AV_MIN_FL * 2)
+
+/** RIFS value used by our implementation for negotiated tonemap, independent
+ * of the number of symbols (ticks). */
+#define MAC_RIFS_SPC_ANY_TCK MAC_FL_TO_TCK (MAC_RIFS_SPC_ANY_FL)
+
+/** Rifs value in frame length unit that can be used for MPDU transmission
+ * with negociated tonemap containing one OFDM symbol. */
+#define MAC_RIFS_AV_ONE_SYM_FL MAC_RIFS_SPC_ANY_FL
+
+/** Rifs value in ticks that can be used for MPDU transmission
+ * with negociated tonemap containing one OFDM symbol. */
+#define MAC_RIFS_AV_ONE_SYM_TCK MAC_FL_TO_TCK (MAC_RIFS_AV_ONE_SYM_FL)
+
+/** Rifs value in frame length unit that can be used for MPDU transmission
+ * with negociated tonemap containing two OFDM symbols. */
+#define MAC_RIFS_AV_TWO_SYM_FL MAC_RIFS_SPC_ANY_FL
+
+/** Rifs value in ticks that can be used for MPDU transmission
+ * with negociated tonemap containing two OFDM symbols. */
+#define MAC_RIFS_AV_TWO_SYM_TCK MAC_FL_TO_TCK (MAC_RIFS_AV_TWO_SYM_FL)
+
+/** Rifs value in frame length unit that can be used for MPDU transmission
+ * with negociated tonemap containing more than two OFDM symbols. */
+#define MAC_RIFS_AV_G2_SYM_FL MAC_RIFS_SPC_ANY_FL
+
+/** Rifs value in ticks that can be used for MPDU transmission
+ * with negociated tonemap containing more than two OFDM symbols. */
+#define MAC_RIFS_AV_G2_SYM_TCK MAC_FL_TO_TCK (MAC_RIFS_AV_G2_SYM_FL)
+
+/** Homeplug 1.0 response interframe spacing (ticks). */
+#define MAC_RIFS_10_TCK (1975 / 3)
+
+/** RTS to CTS gap (ticks). */
+#define MAC_RCG_TCK MAC_US_TO_TCK (120)
+
+/** CTS to MPDU gap (ticks). */
+#define MAC_CMG_TCK MAC_US_TO_TCK (120)
+
+/** Burst interframe spacing (ticks). */
+#define MAC_BIFS_TCK MAC_US_TO_TCK (20)
+
+/** Beacon to beacon interframe spacing (ticks). */
+#define MAC_B2BIFS_TCK MAC_US_TO_TCK (90)
+
+/** Extended interframe spacing for hybrid networks (ticks). */
+#define MAC_EIFS_10_TCK (127125 / 3)
+
+/** Extended interframe spacing for AV networks (ticks). */
+#define MAC_EIFS_AV_TCK (219048 / 3)
+
+/** Contention interframe spacing (ticks). */
+#define MAC_CIFS_TCK MAC_US_TO_TCK (100)
+
+/** Contention free interframe spacing minimum value (ticks). */
+#define MAC_CFIFS_MIN_TCK MAC_US_TO_TCK (30)
+
+/** Contention free interframe spacing minimum value (ticks). */
+#define MAC_CFIFS_MAX_TCK MAC_US_TO_TCK (140)
+
+/** Minimum value of maximum frame length (fl). */
+#define MAC_MAX_FL_MIN_FL 0x7a2
+
+/** Maximum value of maximum frame length (fl). */
+#define MAC_MAX_FL_MAX_FL 0xfff
+
+/** Preamble (ticks). */
+#define MAC_PREAMBLE_TCK (3840/3)
+
+/** Hybrid preamble (ticks). */
+#define MAC_PREAMBLE_HYBRID_TCK (3456/3)
+
+/** Homeplug 1.0 Frame Control (ticks). */
+#define MAC_FC_10_TCK (2892/3)
+
+/** Homeplug AV Frame Control (ticks). */
+#define MAC_FC_AV_TCK (4446/3)
+
+/** Symbol with a 417 sample guard length (ticks). */
+#define MAC_DX417_TCK (3489/3)
+
+/** Symbol with a 567 sample guard length (ticks). */
+#define MAC_DX567_TCK (3639/3)
+
+/** Symbol with a 3534 sample guard length (ticks). */
+#define MAC_DX3534_TCK (6606/3)
+
+/** Payload length for a given symbol size and number of symbols (ticks).
+ * The first two symbols are always MAC_DX567_TCK long. */
+#define MAC_PAYLOAD_TCK(symb_nb, dx) \
+ ((symb_nb) < 2 \
+ ? (symb_nb) * MAC_DX567_TCK \
+ : 2 * MAC_DX567_TCK + ((symb_nb) - 2) * (dx))
+
+/** Contention window slot, PRS (ticks). */
+#define MAC_SLOT_TCK (2688/3)
+
+/** Tolerance, rounded up (ticks). */
+#define MAC_TOLERANCE_TCK ((37 + (3 - 1)) / 3)
+
+/** Tonemap tolerance (ticks). */
+#define MAC_TM_TOLERANCE_TCK MAC_US_TO_TCK (150)
+
+
+#endif /* mac_common_timings_h */