summaryrefslogtreecommitdiff
path: root/cesar/mac/pbproc/inc/fc.h
blob: 11a63f60983eca7679f1336b7f5976a90a3974ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
#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.
 */

#include "mac/pbproc/inc/sacki_dec.h"

/** 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;

/** 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;

#define PBPROC_FC_GENERIC_W0__DT_AV 2, 0
#define PBPROC_FC_GENERIC_W0__ACCESS 3, 3
#define PBPROC_FC_GENERIC_W0__SNID 7, 4

#define PBPROC_FC_GENERIC_W3__FCCS_AV 31, 8

/** 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;

#define PBPROC_FC_BEACON_W0__DT_AV 2, 0
#define PBPROC_FC_BEACON_W0__ACCESS 3, 3
#define PBPROC_FC_BEACON_W0__SNID 7, 4
#define PBPROC_FC_BEACON_W0__BTS_LSB24 31, 8

#define PBPROC_FC_BEACON_W1__BTS_MSB8 7, 0
#define PBPROC_FC_BEACON_W1__BTO0 23, 8
#define PBPROC_FC_BEACON_W1__BTO1_LSB8 31, 24

#define PBPROC_FC_BEACON_W2__BTO1_MSB8 7, 0
#define PBPROC_FC_BEACON_W2__BTO2 23, 8
#define PBPROC_FC_BEACON_W2__BTO3_LSB8 31, 24

#define PBPROC_FC_BEACON_W3__BTO3_MSB8 7, 0
#define PBPROC_FC_BEACON_W3__FCCS_AV 31, 8

/** 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;

#define PBPROC_FC_SOF_W0__DT_AV 2, 0
#define PBPROC_FC_SOF_W0__ACCESS 3, 3
#define PBPROC_FC_SOF_W0__SNID 7, 4
#define PBPROC_FC_SOF_W0__STEI 15, 8
#define PBPROC_FC_SOF_W0__DTEI 23, 16
#define PBPROC_FC_SOF_W0__LID 31, 24

#define PBPROC_FC_SOF_W1__CFS 0, 0
#define PBPROC_FC_SOF_W1__BDF 1, 1
#define PBPROC_FC_SOF_W1__HP10DF 2, 2
#define PBPROC_FC_SOF_W1__HP11DF 3, 3
#define PBPROC_FC_SOF_W1__EKS 7, 4
#define PBPROC_FC_SOF_W1__PPB 15, 8
#define PBPROC_FC_SOF_W1__BLE 23, 16
#define PBPROC_FC_SOF_W1__PBSZ 24, 24
#define PBPROC_FC_SOF_W1__NUM_SYM 26, 25
#define PBPROC_FC_SOF_W1__TMI_AV 31, 27

#define PBPROC_FC_SOF_W2__FL_AV 11, 0
#define PBPROC_FC_SOF_W2__MPDU_CNT 13, 12
#define PBPROC_FC_SOF_W2__BURST_CNT 15, 14
#define PBPROC_FC_SOF_W2__BBF 16, 16
#define PBPROC_FC_SOF_W2__MRTFL 20, 17
#define PBPROC_FC_SOF_W2__DCPPCF 21, 21
#define PBPROC_FC_SOF_W2__MCF 22, 22
#define PBPROC_FC_SOF_W2__MNBF 23, 23
#define PBPROC_FC_SOF_W2__RSR 24, 24
#define PBPROC_FC_SOF_W2__CLST 25, 25
#define PBPROC_FC_SOF_W2__MFS_CMD_MGMT 28, 26
#define PBPROC_FC_SOF_W2__MFS_CMD_DATA 31, 29

#define PBPROC_FC_SOF_W3__MFS_RSP_MGMT 1, 0
#define PBPROC_FC_SOF_W3__MFS_RSP_DATA 3, 2
#define PBPROC_FC_SOF_W3__BM_SACKI 7, 4
#define PBPROC_FC_SOF_W3__FCCS_AV 31, 8

/** 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,
    PBPROC_FC_SACKI_UNIFORM_SIZE = 4,
};

/** Maximum number of bits in a SACK. */
#define PBPROC_FC_SACK_SACKI_BITS 72

/** Number of possible RRTL values. */
#define PBPROC_FC_SACK_RRTL_NB 16

/** 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;

#define PBPROC_FC_SACK_W0__DT_AV 2, 0
#define PBPROC_FC_SACK_W0__ACCESS 3, 3
#define PBPROC_FC_SACK_W0__SNID 7, 4
#define PBPROC_FC_SACK_W0__DTEI 15, 8
#define PBPROC_FC_SACK_W0__CFS 16, 16
#define PBPROC_FC_SACK_W0__BDF 17, 17
#define PBPROC_FC_SACK_W0__SVN 18, 18
#define PBPROC_FC_SACK_W0__RRTF 19, 19
#define PBPROC_FC_SACK_W0__MFS_RSP_DATA 21, 20
#define PBPROC_FC_SACK_W0__MFS_RSP_MGMT 23, 22
#define PBPROC_FC_SACK_W0__SACKT3 25, 24
#define PBPROC_FC_SACK_W0__SACKT2 27, 26
#define PBPROC_FC_SACK_W0__SACKT1 29, 28
#define PBPROC_FC_SACK_W0__SACKT0 31, 30

#define PBPROC_FC_SACK_W1__SACKI0 31, 0

#define PBPROC_FC_SACK_W2__SACKI1 31, 0

#define PBPROC_FC_SACK_W3__SACKI2 7, 0
#define PBPROC_FC_SACK_W3__RXWSZ_RRTL 3, 0
#define PBPROC_FC_SACK_W3__RXWSZ_NO_RRTL 7, 4
#define PBPROC_FC_SACK_W3__RRTL 7, 4
#define PBPROC_FC_SACK_W3__FCCS_AV 31, 8

/** 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;,
    /** Reserved, should be zero. */
    uint reserved0:10;)
    /** Reserved, should be zero. */
    uint reserved1:32;
    BITFIELDS_WORD(
    /** Reserved, should be zero. */
    uint reserved2:8;,
    /** FCCS. */
    uint fccs_av:24;)
};
typedef struct pbproc_fc_rts_cts_t pbproc_fc_rts_cts_t;

#define PBPROC_FC_RTS_CTS_W0__DT_AV 2, 0
#define PBPROC_FC_RTS_CTS_W0__ACCESS 3, 3
#define PBPROC_FC_RTS_CTS_W0__SNID 7, 4
#define PBPROC_FC_RTS_CTS_W0__STEI 15, 8
#define PBPROC_FC_RTS_CTS_W0__DTEI 23, 16
#define PBPROC_FC_RTS_CTS_W0__LID 31, 24

#define PBPROC_FC_RTS_CTS_W1__CFS 0, 0
#define PBPROC_FC_RTS_CTS_W1__BDF 1, 1
#define PBPROC_FC_RTS_CTS_W1__HP10DF 2, 2
#define PBPROC_FC_RTS_CTS_W1__HP11DF 3, 3
#define PBPROC_FC_RTS_CTS_W1__RTSF 4, 4
#define PBPROC_FC_RTS_CTS_W1__IGF 5, 5
#define PBPROC_FC_RTS_CTS_W1__MNBF 6, 6
#define PBPROC_FC_RTS_CTS_W1__MCF 7, 7
#define PBPROC_FC_RTS_CTS_W1__DUR 21, 8
#define PBPROC_FC_RTS_CTS_W1__RESERVED0 31, 22

#define PBPROC_FC_RTS_CTS_W2__RESERVED1 31, 0

#define PBPROC_FC_RTS_CTS_W3__RESERVED2 7, 0
#define PBPROC_FC_RTS_CTS_W3__FCCS_AV 31, 8

/** 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;,
    /** Reserved, should be zero. */
    uint reserved0:2;,
    /** Pending PB. */
    uint ppb:8;)
    BITFIELDS_WORD(
    /** Sound reason code. */
    uint src:8;,
    /** Reserved, should be zero. */
    uint reserved1:24;)
    BITFIELDS_WORD(
    /** Reserved, should be zero. */
    uint reserved2:8;,
    /** FCCS. */
    uint fccs_av:24;)
};
typedef struct pbproc_fc_sound_t pbproc_fc_sound_t;

#define PBPROC_FC_SOUND_W0__DT_AV 2, 0
#define PBPROC_FC_SOUND_W0__ACCESS 3, 3
#define PBPROC_FC_SOUND_W0__SNID 7, 4
#define PBPROC_FC_SOUND_W0__STEI 15, 8
#define PBPROC_FC_SOUND_W0__DTEI 23, 16
#define PBPROC_FC_SOUND_W0__LID 31, 24

#define PBPROC_FC_SOUND_W1__CFS 0, 0
#define PBPROC_FC_SOUND_W1__PBSZ 1, 1
#define PBPROC_FC_SOUND_W1__BDF 2, 2
#define PBPROC_FC_SOUND_W1__SAF 3, 3
#define PBPROC_FC_SOUND_W1__SCF 4, 4
#define PBPROC_FC_SOUND_W1__REQ_TM 7, 5
#define PBPROC_FC_SOUND_W1__FL_AV 19, 8
#define PBPROC_FC_SOUND_W1__MPDU_CNT 21, 20
#define PBPROC_FC_SOUND_W1__RESERVED0 23, 22
#define PBPROC_FC_SOUND_W1__PPB 31, 24

#define PBPROC_FC_SOUND_W2__SRC 7, 0
#define PBPROC_FC_SOUND_W2__RESERVED1 31, 8

#define PBPROC_FC_SOUND_W3__RESERVED2 7, 0
#define PBPROC_FC_SOUND_W3__FCCS_AV 31, 8

/** 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;

#define PBPROC_FC_RSOF_W0__DT_AV 2, 0
#define PBPROC_FC_RSOF_W0__ACCESS 3, 3
#define PBPROC_FC_RSOF_W0__SNID 7, 4
#define PBPROC_FC_RSOF_W0__DTEI 15, 8
#define PBPROC_FC_RSOF_W0__CFS 16, 16
#define PBPROC_FC_RSOF_W0__BDF 17, 17
#define PBPROC_FC_RSOF_W0__SVN 18, 18
#define PBPROC_FC_RSOF_W0__RRTF 19, 19
#define PBPROC_FC_RSOF_W0__MFS_RSP_DATA 21, 20
#define PBPROC_FC_RSOF_W0__MFS_RSP_MGMT 23, 22
#define PBPROC_FC_RSOF_W0__SACKT3 25, 24
#define PBPROC_FC_RSOF_W0__SACKT2 27, 26
#define PBPROC_FC_RSOF_W0__SACKT1 29, 28
#define PBPROC_FC_RSOF_W0__SACKT0 31, 30

#define PBPROC_FC_RSOF_W1__SACKI0 31, 0

#define PBPROC_FC_RSOF_W2__SACKI1 15, 0
#define PBPROC_FC_RSOF_W2__RSOF_FL_AV 25, 16
#define PBPROC_FC_RSOF_W2__TMI_AV 30, 26
#define PBPROC_FC_RSOF_W2__PBSZ 31, 31

#define PBPROC_FC_RSOF_W3__NUM_SYM 1, 0
#define PBPROC_FC_RSOF_W3__MFS_CMD_MGMT 4, 2
#define PBPROC_FC_RSOF_W3__MFS_CMD_DATA 7, 5
#define PBPROC_FC_RSOF_W3__FCCS_AV 31, 8

/** 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;

/** Byte aligned structure for ACK data (SOF/RSOF/SACK FC).*/
struct pbproc_fc_ack_data_t
{
    /** SACK type table. */
    u8 sackt[4];
    /** SACK decompression informations. */
    pbproc_sacki_dec_t sacki_dec;
    /** Request reverse transmission length. */
    uint rrtl_tck;
    /** RX window size. */
    u8 rxwsz;
    /** MFS response. */
    u8 mfs_rsp;
};
typedef struct pbproc_fc_ack_data_t pbproc_fc_ack_data_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 */