root/branches/streaming-rework/src/bebob/bebob_dl_bcd.h

Revision 407, 3.2 kB (checked in by pieterpalmers, 17 years ago)

- Changed the way the device class configure options are handled. Now they are handled in the makefiles instead of the source files. The only source file that still contains the #ifdef's is devicemanager.cpp, to conditionally include the device class include files and to conditionally probe the classes that might be supported.
- added a configure option to disable the compilation of the test programs in tests/
- cleaned up the ADMTP transmit streamprocessor. Now it sends silenced packets when in the disabled state, instead of no-data packets
- added a getNodeID() to ieee1394service
- made comments in ieee1394service.h doxygen compliant

Line 
1 /* bebob_dl_bcd.h
2  * Copyright (C) 2006 by Daniel Wagner
3  *
4  * This file is part of FreeBoB.
5  *
6  * FreeBoB is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBoB 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 FreeBoB; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20 #ifndef BEBOB_DL_BCD_H
21 #define BEBOB_DL_BCD_H
22
23 #include "fbtypes.h"
24
25 #include "debugmodule/debugmodule.h"
26
27 #include <string>
28 #include <cstdio>
29
30 namespace BeBoB {
31
32     class BCD {
33     public:
34         BCD( std::string filename );
35         ~BCD();
36
37         bool parse();
38
39         fb_octlet_t getSoftwareDate() const
40             { return m_softwareDate; }
41         fb_octlet_t getSoftwareTime() const
42             { return m_softwareTime; }
43         fb_quadlet_t getSoftwareId() const
44             { return m_softwareId; }
45         fb_quadlet_t getSoftwareVersion() const
46             { return m_softwareVersion; }
47         fb_quadlet_t getHardwareId() const
48             { return m_hardwareId; }
49         fb_quadlet_t getVendorOUI() const
50             { return m_vendorOUI; }
51        
52         fb_quadlet_t getImageBaseAddress() const
53             { return m_imageBaseAddress; }
54         fb_quadlet_t getImageOffset() const
55             { return m_imageOffset; }
56         fb_quadlet_t getImageLength() const
57             { return m_imageLength; }
58         fb_quadlet_t getImageCRC() const
59             { return m_imageCRC; }
60
61         fb_quadlet_t getCnEOffset() const
62             { return m_cneOffset; }
63         fb_quadlet_t getCnELength() const
64             { return m_cneLength; }
65         fb_quadlet_t getCnECRC() const
66             { return m_cneCRC; }
67
68         bool read( int addr, fb_quadlet_t* q );
69         bool read( int addr, fb_octlet_t* o );
70         bool read( int addr, unsigned char* b, size_t len );
71
72         void displayInfo();
73
74     protected:
75         unsigned long crc32_table[256];
76         void initCRC32Table();
77         unsigned long reflect(unsigned long ref, char ch);
78         unsigned int getCRC(unsigned char* text, size_t len);
79         bool checkHeaderCRC( unsigned int crcOffset,
80                              unsigned int headerSize );
81         bool readHeaderInfo();
82     protected:
83         std::FILE* m_file;
84         std::string m_filename;
85         fb_quadlet_t m_bcd_version;
86
87         fb_octlet_t  m_softwareDate;
88         fb_octlet_t  m_softwareTime;
89         fb_quadlet_t m_softwareId;
90         fb_quadlet_t m_softwareVersion;
91         fb_quadlet_t m_hardwareId;
92         fb_quadlet_t m_vendorOUI;
93            
94
95         fb_quadlet_t m_imageBaseAddress;
96         fb_quadlet_t m_imageLength;
97         fb_quadlet_t m_imageOffset;
98         fb_quadlet_t m_imageCRC;
99
100         fb_quadlet_t m_cneLength;
101         fb_quadlet_t m_cneOffset;
102         fb_quadlet_t m_cneCRC;
103
104
105
106         DECLARE_DEBUG_MODULE;
107     };
108
109     std::string makeString( fb_octlet_t v );
110     std::string makeDate( fb_octlet_t v );
111     std::string makeTime( fb_octlet_t v );
112 };
113
114 #endif
Note: See TracBrowser for help on using the browser.