root/branches/libfreebob-downloader/src/bebob/bebob_dl_bcd.h

Revision 276, 3.2 kB (checked in by wagi, 16 years ago)

2006-06-27 Daniel Wagner <wagi@monom.org>

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