Update revision to release 3.3.0-rc1, update autotools
[debian/gnuradio] / vrt / include / vrt / bits.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2009 Free Software Foundation, Inc.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 #ifndef INCLUDED_VRT_BITS_H
19 #define INCLUDED_VRT_BITS_H
20
21 #include <stdint.h>
22
23
24 /* VRT Header bits */
25
26 #define VRTH_PT_MASK              (0xf << 28)
27 #define VRTH_PT_IF_DATA_NO_SID    (0x0 << 28)   // IF-Data, no stream id
28 #define VRTH_PT_IF_DATA_WITH_SID  (0x1 << 28)   // IF-Data, w/ stream id
29 #define VRTH_PT_EXT_DATA_NO_SID   (0x2 << 28)
30 #define VRTH_PT_EXT_DATA_WITH_SID (0x3 << 28)
31 #define VRTH_PT_IF_CONTEXT        (0x4 << 28)
32 #define VRTH_PT_EXT_CONTEXT       (0x5 << 28)
33
34 #define VRTH_HAS_CLASSID          (1 << 27)
35 #define VRTH_HAS_TRAILER          (1 << 26)     // Data pkts only
36 #define VRTH_START_OF_BURST       (1 << 25)     // Data (Tx) pkts only
37 #define VRTH_END_OF_BURST         (1 << 24)     // Data (Tx) pkts only
38 #define VRTH_TSM                  (1 << 24)     // Context pkts only
39
40 #define VRTH_TSI_MASK             (0x3 << 22)
41 #define VRTH_TSI_NONE             (0x0 << 22)
42 #define VRTH_TSI_UTC              (0x1 << 22)
43 #define VRTH_TSI_GPS              (0x2 << 22)
44 #define VRTH_TSI_OTHER            (0x3 << 22)
45
46 #define VRTH_TSF_MASK             (0x3 << 20)
47 #define VRTH_TSF_NONE             (0x0 << 20)
48 #define VRTH_TSF_SAMPLE_CNT       (0x1 << 20)
49 #define VRTH_TSF_REAL_TIME_PS     (0x2 << 20)
50 #define VRTH_TSF_FREE_RUNNING     (0x3 << 20)
51
52 #define VRTH_PKT_CNT_SHIFT        16
53 #define VRTH_PKT_CNT_MASK         (0xf << 16)
54
55 #define VRTH_PKT_SIZE_MASK        0xffff                    
56
57
58 static inline int
59 vrth_pkt_cnt(uint32_t h)
60 {
61   return (h & VRTH_PKT_CNT_MASK) >> 16;
62 }
63
64 static inline int
65 vrth_pkt_size(uint32_t h)
66 {
67   return h & VRTH_PKT_SIZE_MASK;
68 }
69
70 /*
71  * Trailer bits
72  */
73 #define TR_E                  (1 << 8)
74
75 #define TR_ENABLE(x) ((x) << 20)
76 #define TR_STATE(x)  ((x) <<  8)
77
78 // Use these with TR_ENABLE and TR_STATE
79 #define TR_CAL_TIME           (1 << 11)
80 #define TR_VALID_DATA         (1 << 10)
81 #define TR_REF_LOCK           (1 <<  9)
82 #define TR_AGC                (1 <<  8)
83 #define TR_DETECTED_SIG       (1 <<  7)
84 #define TR_SPECTRAL_INVERSION (1 <<  6)
85 #define TR_OVER_RANGE         (1 <<  5)
86 #define TR_SAMPLE_LOSS        (1 <<  4)
87 #define TR_USER_3             (1 <<  3)
88 #define TR_USER_2             (1 <<  2)
89 #define TR_USER_1             (1 <<  1)
90 #define TR_USER_0             (1 <<  0)
91
92 #endif /* INCLUDED_VRT_BITS_H */