root/trunk/libffado/src/fireworks/fireworks_firmware.cpp

Revision 688, 3.1 kB (checked in by ppalmers, 13 years ago)

- Remove bebob sync tool, since this is now generalized into the FFADODevice API.

the sync source can be set with tests/test-ffado

- introduce a new directory for firmware tools: support/firmware
- Move the bridgeco firmware downloader to the support/firmware directory
- initial code for echo firmware downloading

Line 
1 /*
2  * Copyright (C) 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 #include "fireworks_device.h"
25 #include "fireworks_firmware.h"
26 #include "efc/efc_avc_cmd.h"
27 #include "efc/efc_cmd.h"
28 #include "efc/efc_cmds_flash.h"
29
30 #include <string>
31 #include <sstream>
32
33 using namespace std;
34
35 // These classes provide support for reading/writing the firmware on
36 // echo fireworks based devices
37 namespace FireWorks {
38 IMPL_DEBUG_MODULE( Firmware, Firmware, DEBUG_LEVEL_NORMAL );
39 IMPL_DEBUG_MODULE( FirmwareUtil, FirmwareUtil, DEBUG_LEVEL_NORMAL );
40
41 // the firmware class
42
43 // some generic string generation functions
44 const char *Firmware::eDatTypeToString(const enum eDatType type) {
45     switch (type) {
46         case eDT_DspCode:
47             return "Dsp Code";
48         case eDT_IceLynxCode:
49             return "IceLynx Code";
50         case eDT_Data:
51             return "Data";
52         case eDT_FPGACode:
53             return "FPGA Code";
54         case eDT_DeviceName:
55             return "Device Name";
56         default:
57             return "invalid";
58     }
59 }
60
61 Firmware::Firmware()
62 {
63 }
64
65 Firmware::~Firmware()
66 {
67 }
68
69 void
70 Firmware::show()
71 {
72     debugOutput(DEBUG_LEVEL_NORMAL, "Firmware from %s\n", m_filename.c_str());
73     debugOutput(DEBUG_LEVEL_NORMAL, " Type                 : %s\n", eDatTypeToString(m_Type));
74     debugOutput(DEBUG_LEVEL_NORMAL, " Address Offset       : %08llX\n", m_flash_offset_address);
75     debugOutput(DEBUG_LEVEL_NORMAL, " Lenght (Quadlets)    : %08llX\n", m_length_quads);
76     debugOutput(DEBUG_LEVEL_NORMAL, " CRC 32               : %08llX\n", m_CRC32);
77     debugOutput(DEBUG_LEVEL_NORMAL, " Checksum             : %08llX\n", m_checksum);
78     debugOutput(DEBUG_LEVEL_NORMAL, " Firmware version     : %08llX\n", m_version);
79     debugOutput(DEBUG_LEVEL_NORMAL, " Append CRC           : %s\n", (m_append_crc?"Yes":"No"));
80     debugOutput(DEBUG_LEVEL_NORMAL, " Footprint (Quadlets) : %08llX\n", m_footprint_quads);
81
82 }
83
84 bool
85 Firmware::loadFile(std::string filename)
86 {
87     debugOutput(DEBUG_LEVEL_VERBOSE, "Loading firmware from file %s\n", filename.c_str());
88    
89    
90     m_filename =  filename;
91     return false;
92 }
93
94 // the firmware loader helper class
95 FirmwareUtil::FirmwareUtil(FireWorks::Device& p, FireWorks::Firmware& f)
96 : m_Parent(p)
97 , m_Firmware(f)
98 {
99 }
100
101 FirmwareUtil::~FirmwareUtil()
102 {
103 }
104
105 void
106 FirmwareUtil::show()
107 {
108     debugOutput(DEBUG_LEVEL_NORMAL, "FirmwareUtil\n");
109 }
110
111 } // FireWorks
Note: See TracBrowser for help on using the browser.