GNU Radio 3.5.1 C++ API
atsci_syminfo.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2002 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 #ifndef _ATSC_SYMINFO_H_
00023 #define _ATSC_SYMINFO_H_
00024 
00025 namespace atsc {
00026 
00027   static const unsigned int SI_SEGMENT_NUM_MASK       = 0x1ff;
00028   static const unsigned int SI_FIELD_SYNC_SEGMENT_NUM = SI_SEGMENT_NUM_MASK;  // conceptually -1
00029 
00030   struct syminfo {
00031     unsigned int    symbol_num          : 10;   // 0..831
00032     unsigned int    segment_num         :  9;   // 0..311 and SI_FIELD_SYNC_SEGMENT_NUM
00033     unsigned int    field_num           :  1;   // 0..1
00034     unsigned int    valid               :  1;   // contents are valid
00035   };
00036 
00037 
00038   static inline bool
00039   tag_is_start_field_sync (syminfo tag)
00040   {
00041     return tag.symbol_num == 0 && tag.segment_num == SI_FIELD_SYNC_SEGMENT_NUM && tag.valid;
00042   }
00043 
00044   static inline bool
00045   tag_is_start_field_sync_1 (syminfo tag)
00046   {
00047     return tag_is_start_field_sync (tag) && tag.field_num == 0;
00048   }
00049 
00050   static inline bool
00051   tag_is_start_field_sync_2 (syminfo tag)
00052   {
00053     return tag_is_start_field_sync (tag) && tag.field_num == 1;
00054   }
00055 
00056 }
00057 
00058 #endif /* _ATSC_SYMINFO_H_ */