1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Pieter Palmers |
---|
3 |
* |
---|
4 |
* This file is part of FFADO |
---|
5 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
6 |
* |
---|
7 |
* FFADO is based upon FreeBoB. |
---|
8 |
* |
---|
9 |
* This library is free software; you can redistribute it and/or |
---|
10 |
* modify it under the terms of the GNU Lesser General Public |
---|
11 |
* License version 2.1, as published by the Free Software Foundation; |
---|
12 |
* |
---|
13 |
* This library is distributed in the hope that it will be useful, |
---|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 |
* Lesser General Public License for more details. |
---|
17 |
* |
---|
18 |
* You should have received a copy of the GNU Lesser General Public |
---|
19 |
* License along with this library; if not, write to the Free Software |
---|
20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
---|
21 |
* MA 02110-1301 USA |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#ifndef FIREWORKS_FIRMWARE_H |
---|
25 |
#define FIREWORKS_FIRMWARE_H |
---|
26 |
|
---|
27 |
#include "debugmodule/debugmodule.h" |
---|
28 |
|
---|
29 |
#include "efc/efc_cmd.h" |
---|
30 |
#include "efc/efc_cmds_hardware.h" |
---|
31 |
#include "efc/efc_cmds_flash.h" |
---|
32 |
|
---|
33 |
#include <string> |
---|
34 |
|
---|
35 |
class ConfigRom; |
---|
36 |
class Ieee1394Service; |
---|
37 |
|
---|
38 |
namespace FireWorks { |
---|
39 |
|
---|
40 |
#define ECHO_FIRMWARE_MAGIC_VALUES {1651,1,0,0,0} |
---|
41 |
#define ECHO_FIRMWARE_NB_MAGIC_VALUES 5 |
---|
42 |
|
---|
43 |
#define ECHO_FIRMWARE_HEADER_LENGTH_BYTES 256 |
---|
44 |
#define ECHO_FIRMWARE_HEADER_LENGTH_QUADLETS (ECHO_FIRMWARE_HEADER_LENGTH_BYTES / 4) |
---|
45 |
|
---|
46 |
#define ECHO_FIRMWARE_FILE_MAX_LENGTH_BYTES (384*1024 + ECHO_FIRMWARE_HEADER_LENGTH_BYTES) |
---|
47 |
#define ECHO_FIRMWARE_FILE_MAX_LENGTH_QUADLETS (ECHO_FIRMWARE_HEADER_LENGTH_BYTES / 4) |
---|
48 |
|
---|
49 |
class Firmware |
---|
50 |
{ |
---|
51 |
public: |
---|
52 |
enum eDatType { |
---|
53 |
eDT_DspCode = 0, |
---|
54 |
eDT_IceLynxCode = 1, |
---|
55 |
eDT_Data = 2, |
---|
56 |
eDT_FPGACode = 3, |
---|
57 |
eDT_DeviceName = 4, |
---|
58 |
eDT_Invalid = 0xFF, |
---|
59 |
}; |
---|
60 |
static const char *eDatTypeToString(const enum eDatType target); |
---|
61 |
|
---|
62 |
public: |
---|
63 |
Firmware(); |
---|
64 |
virtual ~Firmware(); |
---|
65 |
|
---|
66 |
virtual bool loadFile(std::string filename); |
---|
67 |
|
---|
68 |
virtual void show(); |
---|
69 |
|
---|
70 |
protected: |
---|
71 |
// filename |
---|
72 |
std::string m_filename; |
---|
73 |
|
---|
74 |
// header data |
---|
75 |
enum eDatType m_Type; |
---|
76 |
uint32_t m_flash_offset_address; |
---|
77 |
uint32_t m_length_quads; |
---|
78 |
uint32_t m_CRC32; |
---|
79 |
uint32_t m_checksum; |
---|
80 |
uint32_t m_version; |
---|
81 |
bool m_append_crc; // true to append |
---|
82 |
uint32_t m_footprint_quads; |
---|
83 |
|
---|
84 |
private: |
---|
85 |
DECLARE_DEBUG_MODULE; |
---|
86 |
}; |
---|
87 |
|
---|
88 |
class FirmwareUtil |
---|
89 |
{ |
---|
90 |
|
---|
91 |
public: |
---|
92 |
FirmwareUtil(FireWorks::Device& parent, |
---|
93 |
FireWorks::Firmware& f); |
---|
94 |
virtual ~FirmwareUtil(); |
---|
95 |
|
---|
96 |
virtual void show(); |
---|
97 |
|
---|
98 |
protected: |
---|
99 |
FireWorks::Device& m_Parent; |
---|
100 |
FireWorks::Firmware& m_Firmware; |
---|
101 |
private: |
---|
102 |
DECLARE_DEBUG_MODULE; |
---|
103 |
}; |
---|
104 |
|
---|
105 |
} // namespace FireWorks |
---|
106 |
|
---|
107 |
#endif |
---|