summaryrefslogtreecommitdiff
path: root/cesar/mac/pbproc/inc/fc.h
diff options
context:
space:
mode:
authorsave2008-04-07 14:17:42 +0000
committersave2008-04-07 14:17:42 +0000
commit3d58a62727346b7ac1a6cb36fed1a06ed72228dd (patch)
treed7788c3cf9f76426aef0286d0202e2097f0fa0eb /cesar/mac/pbproc/inc/fc.h
parent095dca4b0a8d4924093bab424f71f588fdd84613 (diff)
Moved the complete svn base into the cesar directory.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1769 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/mac/pbproc/inc/fc.h')
-rw-r--r--cesar/mac/pbproc/inc/fc.h439
1 files changed, 439 insertions, 0 deletions
diff --git a/cesar/mac/pbproc/inc/fc.h b/cesar/mac/pbproc/inc/fc.h
new file mode 100644
index 0000000000..76f551686b
--- /dev/null
+++ b/cesar/mac/pbproc/inc/fc.h
@@ -0,0 +1,439 @@
+#ifndef mac_pbproc_inc_fc_h
+#define mac_pbproc_inc_fc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file mac/pbproc/inc/fc.h
+ * \brief Frame control structure.
+ * \ingroup mac_pbproc
+ *
+ * Be careful to bit order.
+ */
+
+/** Delimiter type. */
+enum pbproc_fc_dt_t
+{
+ PBPROC_FC_DT_BEACON,
+ PBPROC_FC_DT_SOF,
+ PBPROC_FC_DT_SACK,
+ PBPROC_FC_DT_RTS_CTS,
+ PBPROC_FC_DT_SOUND,
+ PBPROC_FC_DT_RSOF,
+ PBPROC_FC_DT_NB,
+ PBPROC_FC_DT_MASK = 0x7
+};
+typedef enum pbproc_fc_dt_t pbproc_fc_dt_t;
+
+/** MFS FSM commands. */
+enum pbproc_fc_mfs_cmd_t
+{
+ PBPROC_FC_MFS_CMD_INIT,
+ PBPROC_FC_MFS_CMD_IN_SYNC,
+ PBPROC_FC_MFS_CMD_RE_SYNC,
+ PBPROC_FC_MFS_CMD_RELEASE,
+ PBPROC_FC_MFS_CMD_NOP,
+};
+typedef enum pbproc_fc_mfs_cmd_t pbproc_fc_mfs_cmd_t;
+
+/** MFS FSM response. */
+enum pbproc_fc_mfs_rsp_t
+{
+ PBPROC_FC_MFS_RSP_ACK,
+ PBPROC_FC_MFS_RSP_NACK,
+ PBPROC_FC_MFS_RSP_FAIL,
+ PBPROC_FC_MFS_RSP_HOLD,
+};
+typedef enum pbproc_fc_mfs_rsp_t pbproc_fc_mfs_rsp_t;
+
+/** Generic frame control. */
+struct pbproc_fc_generic_t
+{
+ BITFIELDS_WORD(
+ /** Delimiter type. */
+ pbproc_fc_dt_t dt_av:3;,
+ /** Access field. */
+ bool access:1;,
+ /** Short network identifier. */
+ uint snid:4;,
+ uint :24;)
+ uint :32;
+ uint :32;
+ BITFIELDS_WORD(
+ uint :8;,
+ /** FCCS. */
+ uint fccs_av:24;)
+};
+typedef struct pbproc_fc_generic_t pbproc_fc_generic_t;
+
+/** Beacon frame control. */
+struct pbproc_fc_beacon_t
+{
+ BITFIELDS_WORD(
+ /** Delimiter type. */
+ pbproc_fc_dt_t dt_av:3;,
+ /** Access field. */
+ bool access:1;,
+ /** Short network identifier. */
+ uint snid:4;,
+ /** Beacon time stamp, LSB. */
+ uint bts_lsb24:24;)
+ BITFIELDS_WORD(
+ /** Beacon time stamp, MSB. */
+ uint bts_msb8:8;,
+ /** Beacon transmission offset 0. */
+ uint bto0:16;,
+ /** Beacon transmission offset 1, LSB. */
+ uint bto1_lsb8:8;)
+ BITFIELDS_WORD(
+ /** Beacon transmission offset 1, MSB. */
+ uint bto1_msb8:8;,
+ /** Beacon transmission offset 2. */
+ uint bto2:16;,
+ /** Beacon transmission offset 3, LSB. */
+ uint bto3_lsb8:8;)
+ BITFIELDS_WORD(
+ /** Beacon transmission offset 3, MSB. */
+ uint bto3_msb8:8;,
+ /** FCCS. */
+ uint fccs_av:24;)
+};
+typedef struct pbproc_fc_beacon_t pbproc_fc_beacon_t;
+
+/** Start Of Frame frame control. */
+struct pbproc_fc_sof_t
+{
+ BITFIELDS_WORD(
+ /** Delimiter type. */
+ pbproc_fc_dt_t dt_av:3;,
+ /** Access field. */
+ bool access:1;,
+ /** Short network identifier. */
+ uint snid:4;,
+ /** Source terminal equipment identifier. */
+ uint stei:8;,
+ /** Destination terminal equipment identifier. */
+ uint dtei:8;,
+ /** Link identifier. */
+ uint lid:8;)
+ BITFIELDS_WORD(
+ /** Contention free session. */
+ bool cfs:1;,
+ /** Beacon detect flag. */
+ bool bdf:1;,
+ /** Homeplug 1.0.1 detect flag. */
+ bool hp10df:1;,
+ /** Homeplug 1.1 detect flag. */
+ bool hp11df:1;,
+ /** Encryption key select. */
+ uint eks:4;,
+ /** Pending PB. */
+ uint ppb:8;,
+ /** Bit loading estimate. */
+ uint ble:8;,
+ /** PB size, true for 136. */
+ bool pbsz:1;,
+ /** Number of symbols. */
+ uint num_sym:2;,
+ /** Tone map index. */
+ uint tmi_av:5;)
+ BITFIELDS_WORD(
+ /** Frame length. */
+ uint fl_av:12;,
+ /** MPDU count. */
+ uint mpdu_cnt:2;,
+ /** Burst count. */
+ uint burst_cnt:2;,
+ /** Bidirectional burst flag. */
+ bool bbf:1;,
+ /** Max reverse transmission frame length. */
+ uint mrtfl:4;,
+ /** Different CP PHY clock flag. */
+ bool dcppcf:1;,
+ /** Multicast flag. */
+ bool mcf:1;,
+ /** Multi-network broadcast flag. */
+ bool mnbf:1;,
+ /** Request SACK retransmission. */
+ bool rsr:1;,
+ /** Convergence layer SAP type. */
+ uint clst:1;,
+ /** Management MFS command. */
+ uint mfs_cmd_mgmt:3;,
+ /** Data MFS command. */
+ uint mfs_cmd_data:3;)
+ BITFIELDS_WORD(
+ /** Management MFS response for the preceding RSOF. */
+ uint mfs_rsp_mgmt:2;,
+ /** Data MFS response for the preceding RSOF. */
+ uint mfs_rsp_data:2;,
+ /** Bit map SACK info for the preceding RSOF. */
+ uint bm_sacki:4;,
+ /** FCCS. */
+ uint fccs_av:24;)
+};
+typedef struct pbproc_fc_sof_t pbproc_fc_sof_t;
+
+/** SACK Type. */
+enum pbproc_fc_sackt_t
+{
+ PBPROC_FC_SACKT_MIXED = 0,
+ PBPROC_FC_SACKT_MIXED_COMPRESSED = 1,
+ PBPROC_FC_SACKT_NOT_RECEIVED = 2,
+ PBPROC_FC_SACKT_UNIFORM = 3,
+};
+
+/** Uniform SACK information. */
+enum pbproc_fc_sacki_uniform_t
+{
+ PBPROC_FC_SACKI_UNIFORM_ALL_ERROR = 0,
+ PBPROC_FC_SACKI_UNIFORM_ALL_OK = 1,
+ PBPROC_FC_SACKI_UNIFORM_NOT_AVAILABLE = 2,
+ PBPROC_FC_SACKI_UNIFORM_TMI_DEFAULT_ROBO = 3,
+ PBPROC_FC_SACKI_UNIFORM_TMI_DEFAULT_RESTART = 4,
+ PBPROC_FC_SACKI_UNIFORM_TMI_RESTART = 5,
+ PBPROC_FC_SACKI_UNIFORM_NEK_ERROR = 6,
+ PBPROC_FC_SACKI_UNIFORM_NB
+};
+
+/** Maximum number of bits in a SACK. */
+#define PBPROC_FC_SACK_SACKI_BITS 72
+
+/** Selective Acknowledgment frame control. */
+struct pbproc_fc_sack_t
+{
+ BITFIELDS_WORD(
+ /** Delimiter type. */
+ pbproc_fc_dt_t dt_av:3;,
+ /** Access field. */
+ bool access:1;,
+ /** Short network identifier. */
+ uint snid:4;,
+ /** Destination terminal equipment identifier. */
+ uint dtei:8;,
+ /** Contention free session. */
+ bool cfs:1;,
+ /** Beacon detect flag. */
+ bool bdf:1;,
+ /** SACK version number. */
+ uint svn:1;,
+ /** Request reverse transmission flag. */
+ bool rrtf:1;,
+ /** Data MFS response. */
+ uint mfs_rsp_data:2;,
+ /** Management MFS response. */
+ uint mfs_rsp_mgmt:2;,
+ /** SACK type for MPDU count = 3. */
+ uint sackt3:2;,
+ /** SACK type for MPDU count = 2. */
+ uint sackt2:2;,
+ /** SACK type for MPDU count = 1. */
+ uint sackt1:2;,
+ /** SACK type for MPDU count = 0. */
+ uint sackt0:2;)
+ /** SACK information. */
+ uint sacki[2];
+ BITFIELDS_WORD(
+ /** SACK information last byte and/or RX window size and/or request
+ * reverse transmission length. */
+ uint sacki_last:8;,
+ /** FCCS. */
+ uint fccs_av:24;)
+};
+typedef struct pbproc_fc_sack_t pbproc_fc_sack_t;
+
+/** Request to send/Clear to send frame control. */
+struct pbproc_fc_rts_cts_t
+{
+ BITFIELDS_WORD(
+ /** Delimiter type. */
+ pbproc_fc_dt_t dt_av:3;,
+ /** Access field. */
+ bool access:1;,
+ /** Short network identifier. */
+ uint snid:4;,
+ /** Source terminal equipment identifier. */
+ uint stei:8;,
+ /** Destination terminal equipment identifier. */
+ uint dtei:8;,
+ /** Link identifier. */
+ uint lid:8;)
+ BITFIELDS_WORD(
+ /** Contention free session. */
+ bool cfs:1;,
+ /** Beacon detect flag. */
+ bool bdf:1;,
+ /** Homeplug 1.0.1 detect flag. */
+ bool hp10df:1;,
+ /** Homeplug 1.1 detect flag. */
+ bool hp11df:1;,
+ /** RTS flag. */
+ bool rtsf:1;,
+ /** Immediate grant flag. */
+ bool igf:1;,
+ /** Multi-network broadcast flag. */
+ bool mnbf:1;,
+ /** Multicast flag. */
+ bool mcf:1;,
+ /** Duration. */
+ uint dur:14;,
+ uint :10;)
+ uint :32;
+ BITFIELDS_WORD(
+ uint :8;,
+ /** FCCS. */
+ uint fccs_av:24;)
+};
+typedef struct pbproc_fc_rts_cts_t pbproc_fc_rts_cts_t;
+
+/** Sound reason code. */
+enum pbproc_fc_sound_reason_code_t
+{
+ PBPROC_FC_SRC_TMI_MIN = 0x04,
+ PBPROC_FC_SRC_TMI_MAX = 0x1f,
+ PBPROC_FC_SRC_ERROR = 0xfc,
+ PBPROC_FC_SRC_INITIAL = 0xfd,
+ PBPROC_FC_SRC_INTERVAL_UNAVAILABLE = 0xfe,
+ PBPROC_FC_SRC_INTERVAL_UNUSABLE = 0xff,
+};
+
+/** Sound frame control. */
+struct pbproc_fc_sound_t
+{
+ BITFIELDS_WORD(
+ /** Delimiter type. */
+ pbproc_fc_dt_t dt_av:3;,
+ /** Access field. */
+ bool access:1;,
+ /** Short network identifier. */
+ uint snid:4;,
+ /** Source terminal equipment identifier. */
+ uint stei:8;,
+ /** Destination terminal equipment identifier. */
+ uint dtei:8;,
+ /** Link identifier. */
+ uint lid:8;)
+ BITFIELDS_WORD(
+ /** Contention free session. */
+ bool cfs:1;,
+ /** PB size, true for 136. */
+ bool pbsz:1;,
+ /** Beacon detect flag. */
+ bool bdf:1;,
+ /** Sound ACK flag. */
+ bool saf:1;,
+ /** Sound complete flag. */
+ bool scf:1;,
+ /** Max tone map requested. */
+ uint req_tm:3;,
+ /** Frame length. */
+ uint fl_av:12;,
+ /** MPDU count. */
+ uint mpdu_cnt:2;,
+ uint :2;,
+ /** Pending PB. */
+ uint ppb:8;)
+ BITFIELDS_WORD(
+ /** Sound reason code. */
+ uint src:8;,
+ uint :24;)
+ BITFIELDS_WORD(
+ uint :8;,
+ /** FCCS. */
+ uint fccs_av:24;)
+};
+typedef struct pbproc_fc_sound_t pbproc_fc_sound_t;
+
+/** Reverse SOF frame control. */
+struct pbproc_fc_rsof_t
+{
+ BITFIELDS_WORD(
+ /** Delimiter type. */
+ pbproc_fc_dt_t dt_av:3;,
+ /** Access field. */
+ bool access:1;,
+ /** Short network identifier. */
+ uint snid:4;,
+ /** Destination terminal equipment identifier. */
+ uint dtei:8;,
+ /** Contention free session. */
+ bool cfs:1;,
+ /** Beacon detect flag. */
+ bool bdf:1;,
+ /** SACK version number. */
+ uint svn:1;,
+ /** Request reverse transmission flag. */
+ bool rrtf:1;,
+ /** Data MFS response. */
+ uint mfs_rsp_data:2;,
+ /** Management MFS response. */
+ uint mfs_rsp_mgmt:2;,
+ /** SACK type for MPDU count = 3. */
+ uint sackt3:2;,
+ /** SACK type for MPDU count = 2. */
+ uint sackt2:2;,
+ /** SACK type for MPDU count = 1. */
+ uint sackt1:2;,
+ /** SACK type for MPDU count = 0. */
+ uint sackt0:2;)
+ /** SACK information, LSB. */
+ uint sacki_lsb;
+ BITFIELDS_WORD(
+ /** SACK information, MSB, and/or RX window size and/or request reverse
+ * transmission length. */
+ uint sacki_msb:16;,
+ /** Reverse SOF frame length. */
+ uint rsof_fl_av:10;,
+ /** Tone map index. */
+ uint tmi_av:5;,
+ /** PB size, true for 136. */
+ bool pbsz:1;)
+ BITFIELDS_WORD(
+ /** Number of symbols. */
+ uint num_sym:2;,
+ /** Management MFS command. */
+ uint mfs_cmd_mgmt:3;,
+ /** Data MFS command. */
+ uint mfs_cmd_data:3;,
+ /** FCCS. */
+ uint fccs_av:24;)
+};
+typedef struct pbproc_fc_rsof_t pbproc_fc_rsof_t;
+
+/** Union for any frame control. */
+union pbproc_fc_t
+{
+ /** Direct word access. */
+ uint words[4];
+ /** Generic FC access. */
+ pbproc_fc_generic_t generic;
+ /** Beacon FC access. */
+ pbproc_fc_beacon_t beacon;
+ /** SOF FC access. */
+ pbproc_fc_sof_t sof;
+ /** SACK FC access. */
+ pbproc_fc_sack_t sack;
+ /** RTS/CTS FC access. */
+ pbproc_fc_rts_cts_t rts_cts;
+ /** Sound FC access. */
+ pbproc_fc_sound_t sound;
+ /** RSOF FC access. */
+ pbproc_fc_rsof_t rsof;
+};
+typedef union pbproc_fc_t pbproc_fc_t;
+
+BEGIN_DECLS
+
+/**
+ * Compute the Pending Phy Blocks Frame Control field.
+ * \param n integer number of Pending Phy Blocks
+ * \return floating point coded value
+ */
+u8
+pbproc_fc_pbb (uint n);
+
+#endif /* mac_pbproc_inc_fc_h */