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

Revision 404, 3.3 kB (checked in by pieterpalmers, 16 years ago)

- introduce support framework for DICE and Metric Halo
- change probe/discovery code to make adding devices easier
- made conditional compilation effectively work.

./configure now has the following switches:

--enable-bebob build BeBoB support (default=yes)
--enable-motu build Motu support (default=no)
--enable-dice build DICE support (default=no)
--enable-metric-halo build Metric Halo support (note: completely useless)

(default=no)

--enable-rme build RME support (note: completely useless)

(default=no)

--enable-bounce build Bounce device support (default=no)
--enable-all-devices build support for all supported devices (default=no)

these now turn on/off compilation effectively.

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
21 #ifdef ENABLE_BEBOB
22
23 #ifndef BEBOB_DL_BCD_H
24 #define BEBOB_DL_BCD_H
25
26 #include "fbtypes.h"
27
28 #include "debugmodule/debugmodule.h"
29
30 #include <string>
31 #include <cstdio>
32
33 namespace BeBoB {
34
35     class BCD {
36     public:
37         BCD( std::string filename );
38         ~BCD();
39
40         bool parse();
41
42         fb_octlet_t getSoftwareDate() const
43             { return m_softwareDate; }
44         fb_octlet_t getSoftwareTime() const
45             { return m_softwareTime; }
46         fb_quadlet_t getSoftwareId() const
47             { return m_softwareId; }
48         fb_quadlet_t getSoftwareVersion() const
49             { return m_softwareVersion; }
50         fb_quadlet_t getHardwareId() const
51             { return m_hardwareId; }
52         fb_quadlet_t getVendorOUI() const
53             { return m_vendorOUI; }
54        
55         fb_quadlet_t getImageBaseAddress() const
56             { return m_imageBaseAddress; }
57         fb_quadlet_t getImageOffset() const
58             { return m_imageOffset; }
59         fb_quadlet_t getImageLength() const
60             { return m_imageLength; }
61         fb_quadlet_t getImageCRC() const
62             { return m_imageCRC; }
63
64         fb_quadlet_t getCnEOffset() const
65             { return m_cneOffset; }
66         fb_quadlet_t getCnELength() const
67             { return m_cneLength; }
68         fb_quadlet_t getCnECRC() const
69             { return m_cneCRC; }
70
71         bool read( int addr, fb_quadlet_t* q );
72         bool read( int addr, fb_octlet_t* o );
73         bool read( int addr, unsigned char* b, size_t len );
74
75         void displayInfo();
76
77     protected:
78         unsigned long crc32_table[256];
79         void initCRC32Table();
80         unsigned long reflect(unsigned long ref, char ch);
81         unsigned int getCRC(unsigned char* text, size_t len);
82         bool checkHeaderCRC( unsigned int crcOffset,
83                              unsigned int headerSize );
84         bool readHeaderInfo();
85     protected:
86         std::FILE* m_file;
87         std::string m_filename;
88         fb_quadlet_t m_bcd_version;
89
90         fb_octlet_t  m_softwareDate;
91         fb_octlet_t  m_softwareTime;
92         fb_quadlet_t m_softwareId;
93         fb_quadlet_t m_softwareVersion;
94         fb_quadlet_t m_hardwareId;
95         fb_quadlet_t m_vendorOUI;
96            
97
98         fb_quadlet_t m_imageBaseAddress;
99         fb_quadlet_t m_imageLength;
100         fb_quadlet_t m_imageOffset;
101         fb_quadlet_t m_imageCRC;
102
103         fb_quadlet_t m_cneLength;
104         fb_quadlet_t m_cneOffset;
105         fb_quadlet_t m_cneCRC;
106
107
108
109         DECLARE_DEBUG_MODULE;
110     };
111
112     std::string makeString( fb_octlet_t v );
113     std::string makeDate( fb_octlet_t v );
114     std::string makeTime( fb_octlet_t v );
115 };
116
117 #endif
118
119 #endif //#ifdef ENABLE_BEBOB
Note: See TracBrowser for help on using the browser.