3 # Copyright 2009 Free Software Foundation, Inc.
5 # This file is part of GNU Radio
7 # GNU Radio is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
12 # GNU Radio is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 # dispatch codeword bits
25 HAS_STREAM_ID = 1 << 0;
26 HAS_CLASS_ID = 1 << 1;
27 HAS_INTEGER_SECS = 1 << 2;
28 HAS_FRACTIONAL_SECS = 1 << 3;
34 trailer_len = 32 * [0]
38 if cw & HAS_TRAILER: t += 1
42 if cw & HAS_STREAM_ID: t += 1
43 if cw & HAS_CLASS_ID: t += 2
44 if cw & HAS_INTEGER_SECS: t += 1
45 if cw & HAS_FRACTIONAL_SECS: t += 2
48 write_table(f, "cw_header_len", header_len)
49 write_table(f, "cw_trailer_len", trailer_len)
51 def write_table(f, name, table):
52 f.write("inline static size_t ")
54 f.write("(int cw){\n")
56 f.write(" static const size_t s_")
58 f.write("[32] = {\n ")
60 f.write("%d, " % (t,))
65 f.write("[cw];\n}\n\n")
68 if __name__ == '__main__':