root/trunk/libffado/src/dice/dice_firmware_loader.cpp

Revision 2803, 17.5 kB (checked in by jwoithe, 1 year ago)

Cosmetic: capitalise "L" in "Linux".

"Linux" is a proper noun so it should start with a capital letter. These
changes are almost all within comments.

This patch was originally proposed by pander on the ffado-devel mailing
list. It has been expanded to cover all similar cases to maintain
consistency throughout the source tree.

Line 
1 /*
2  * Copyright (C) 2012 by Peter Hinkel
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 program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  * Implementation of the DICE firmware loader specification based upon
23  * TCAT public available document v3.2.0.0 (2008-06-20)
24  *
25  */
26
27 #include <fstream>
28 #include "config.h"
29
30 #include "dice/dice_avdevice.h"
31 #include "dice/dice_firmware_loader.h"
32
33 #include "libieee1394/configrom.h"
34 #include "libieee1394/ieee1394service.h"
35
36 #include "debugmodule/debugmodule.h"
37
38 #include "libutil/ByteSwap.h"
39 #include <libraw1394/csr.h>
40
41 #include <stdint.h>
42 #include <iostream>
43 #include <sstream>
44
45 #include <string>
46 #include <cstring>
47 #include <unistd.h>
48 #include <assert.h>
49
50 #include "libutil/Configuration.h"
51 #include "devicemanager.h"
52
53 #include "focusrite/saffire_pro40.h"
54 #include "focusrite/saffire_pro24.h"
55 #include "focusrite/saffire_pro14.h"
56
57 using namespace std;
58
59 namespace Dice {
60
61 fb_quadlet_t tmp_quadlet;
62
63 bool
64 Device::showDiceInfoFL() {
65
66         DICE_FL_GET_VENDOR_IMAGE_DESC_RETURN image_desc;
67
68         writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_GET_RUNNING_IMAGE_VINFO);
69
70         do {
71                 usleep(10000);
72                 readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
73         } while (tmp_quadlet & (1UL<<31));
74
75         readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
76
77         if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
78                 readRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &image_desc, sizeof(image_desc));
79                 printMessage("Dice image vendor and product information:\n");
80                 printMessage("  uiVProductID: %i\n", image_desc.uiProductID);
81                 printMessage("  uiVendorID: %s\n", image_desc.uiVendorID);
82                 printMessage("  uiVMajor: %i\n", image_desc.uiVMajor);
83                 printMessage("  uiVMajor: %i\n", image_desc.uiVMinor);
84                 printMessage("  user1: %i\n", image_desc.user1);
85                 printMessage("  user2: %i\n", image_desc.user2);
86         } else {
87                 printMessage("Cannot read firmware info\n");
88         }
89         return true;
90 }
91
92 bool
93 Device::dumpFirmwareFL(const char* filename) {
94
95         DICE_FL_INFO_PARAM* pflash_info = showFlashInfoFL(false);
96         DICE_FL_READ_MEMORY memory;
97
98         if (pflash_info) {
99                 ofstream file(filename, ios::out|ios::binary);
100
101                 if (file.is_open()) {
102
103                         uint32_t size = pflash_info->uiNumBlocks * pflash_info->uiBlockSize;
104                         uint32_t start = pflash_info->uiStartAddress;
105                         uint32_t end = pflash_info->uiEndAddress;
106
107                         printMessage("Downloading complete DICE flash into file (flash size = %i KBytes)\n", size/1024);
108                         printMessage("Please wait, dumping will take about a minute\n");
109                         printMessage("Dump in progress ...\n");
110                         while (start<end) {
111                                 memory.uiLen = min<uint32_t>(end-start, sizeof(memory.ReadBuffer));
112                                 memory.uiStartAddress = start;
113
114                                 writeRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &memory, sizeof(memory));
115
116                                 writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_READ_MEMORY);
117
118                                 do {
119                                         usleep(4000);
120                                         readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
121                                 } while (tmp_quadlet & (1UL<<31));
122
123                                 readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
124
125                                 if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
126                                         readRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &memory, sizeof(memory));
127                                         file.write(memory.ReadBuffer, memory.uiLen);
128                                 } else {
129                                         printMessage("in dumpFirmwareFL, unknown error =  0x%X \nSTOP.\n", tmp_quadlet);
130                                         return false;
131                                 }
132                                 start += memory.uiLen;
133                         }
134                 }
135                 file.close();
136                 printMessage("Dumping successfully finished to file %s\n", filename);
137                 return true;
138         } else {
139                 printMessage("Downloading not supported for this device\n");
140                 return false;
141         }
142 }
143
144 DICE_FL_INFO_PARAM*
145 Device::showFlashInfoFL(bool v) {
146
147         DICE_FL_INFO_PARAM flash_info;
148         DICE_FL_INFO_PARAM* pflash_info = new DICE_FL_INFO_PARAM;
149
150         writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_GET_FLASH_INFO);
151
152         do {
153                 usleep(10000);
154                 readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
155         } while (tmp_quadlet & (1UL<<31));
156
157         readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
158
159         if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
160                 readRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &flash_info, sizeof(flash_info));
161                 if (v) {
162                         printMessage("Flash Information:\n");
163                         printMessage("  uiStartAddress: 0x%X\n", flash_info.uiStartAddress);
164                         printMessage("  uiEndAddress: 0x%X\n", flash_info.uiEndAddress);
165                         printMessage("  uiNumBlocks: %i\n", flash_info.uiNumBlocks);
166                         printMessage("  uiBlockSize: %i\n", flash_info.uiBlockSize);
167                 }
168                 memcpy(pflash_info, &flash_info, sizeof(flash_info));
169                 return pflash_info;
170         } else {
171                 printMessage("Cannot read flash information\n");
172                 return pflash_info = NULL;
173         }
174 }
175
176 bool
177 Device::showImgInfoFL() {
178
179         DICE_FL_GET_IMAGE_DESC_RETURN img_desc;
180         uint32_t imageID=0;
181
182         do {
183                 writeReg(DICE_FL_OFFSET + DICE_FL_PARAMETER, imageID);
184
185                 writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_GET_IMAGE_DESC);
186                 do {
187                         usleep(100);
188                         readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
189                 } while (tmp_quadlet & (1UL<<31));
190
191                 readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
192
193                 if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
194                         readRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &img_desc, sizeof(img_desc));
195                         printMessage("Detailed information of:\n");
196                         printMessage("  image: %s\n", img_desc.name);
197                         printMessage("  flashBase @addr: 0x%X\n", img_desc.flashBase);
198                         printMessage("  memBase @addr:0x%X\n", img_desc.memBase);
199                         printMessage("  size: %i Bytes (0x%X)\n", img_desc.size, img_desc.size); //size in flash (blocks)
200                         printMessage("  entryPoint: 0x%X\n", img_desc.entryPoint);
201                         printMessage("  length: %i Bytes\n", img_desc.length); //real number of bytes of image
202                         printMessage("  checksum: %i\n", img_desc.chkSum);
203                         printMessage("  uiBoardSerialNumber: %i\n", img_desc.uiBoardSerialNumber);
204                         printMessage("  uiVersionHigh: %i\n", img_desc.uiVersionHigh);
205                         printMessage("  uiVersionLow: %i\n", img_desc.uiVersionLow);
206                         printMessage("  uiConfigurationFlags: %i\n", img_desc.uiConfigurationFlags);
207                         printMessage("  Build Time: %s\n", img_desc.BuildTime);
208                         printMessage("  Build Date: %s\n", img_desc.BuildDate);
209                 } else if (tmp_quadlet == DICE_FL_E_GEN_NOMATCH) {
210                         //printMessage("in showImgInfoFL(): Image not exists.\nSTOP.\n");
211                         return false;
212                 } else {
213                         //printMessage("in showImgInfoFL(): unknown error =  0x%X\nSTOP.\n", tmp_quadlet);
214                         return false;
215                 }
216                 imageID++;
217         } while (tmp_quadlet == DICE_FL_RETURN_NO_ERROR);
218         return true;
219 }
220
221 bool
222 Device::showAppInfoFL() {
223
224         DICE_FL_GET_APP_INFO_RETURN app_info;
225
226         writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_GET_APP_INFO);
227
228         do {
229                 usleep(10000);
230                 readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
231         } while (tmp_quadlet & (1UL<<31));
232
233         readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
234
235         if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
236                 readRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &app_info, sizeof(app_info));
237                 printMessage("Application information of 'dice' image:\n");
238                 printMessage("  uiBaseSDKVersion: %X\n", app_info.uiBaseSDKVersion); //value needs to be parsed, but how?
239                 printMessage("  uiApplicationVersion: %X\n", app_info.uiApplicationVersion); //value needs to be parsed, but how?
240                 printMessage("  uiVendorID: %X\n", app_info.uiVendorID);
241                 printMessage("  uiProductID: %X\n", app_info.uiProductID);
242                 printMessage("  BuildTime: %s\n", app_info.BuildTime);
243                 printMessage("  BuildDate: %s\n", app_info.BuildDate);
244                 printMessage("  uiBoardSerialNumber: %d\n", app_info.uiBoardSerialNumber);
245                 return true;
246         } else {
247                 printMessage("in showAppInfoFL(): unknown error =  0x%X\nSTOP.\n", tmp_quadlet);
248                 printMessage("Cannot read application information\n");
249                 return false;
250         }
251 }
252
253 bool
254 Device::testDiceFL(int action) {
255
256         DICE_FL_TEST_ACTION_PARAM testParam;
257         DICE_FL_TEST_ACTION_RETURN testReturn;
258         char pvalue0[11];
259         char pvalue1[11];
260         char* pEnd;
261
262         switch (action) {
263                 case 1 :
264                         testParam.cmdID = action;
265
266                         printMessage("Use for input (quadlet = 32 bit) hex values only, i.e. '0x8080'\n");
267                         printMessage("Writeable address range in RAM: 0x000000 - 0x7FFFFF\n");
268                         printMessage("The address must be 32 bit aligned\n");
269
270                         printMessage("Enter the @addr to write: ");
271                         cin >> pvalue0;
272                         testParam.lvalue0 = strtoul(pvalue0, &pEnd, 16);
273                         if (testParam.lvalue0 > 0x7FFFFF) {
274                                 printMessage("@addr out of range. Aborting.\nSTOP.\n");
275                                 return false;
276                         }
277
278                         printMessage("Enter the value to write: ");
279                         cin >> pvalue1;
280                         testParam.lvalue1 = strtoul(pvalue1, &pEnd, 16);
281
282                         writeRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &testParam, sizeof(testParam));
283
284                         writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_TEST_ACTION);
285
286                         do {
287                                 usleep(10000);
288                                 readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
289                         } while (tmp_quadlet & (1UL<<31));
290
291                         readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
292
293                         if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
294                                 printMessage("Quadlet written successfully\n");
295                                 return true;
296                         } else {
297                                 printMessage("in testDiceFL(): unknown error =  0x%X\nSTOP.\n", tmp_quadlet);
298                                 return false;
299                         }
300                         break;
301                 case 2 :
302                         testParam.cmdID = action;
303
304                         printMessage("Use for input hex values only, i.e. '0x8080'\n");
305                         printMessage("The address must be 32 bit aligned\n");
306
307                         printMessage("Enter the @addr to read: ");
308                         cin >> pvalue0;
309                         testParam.lvalue0 = strtoul(pvalue0, &pEnd, 16);
310
311                         writeRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &testParam, sizeof(testParam));
312
313                         writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_TEST_ACTION);
314
315                         do {
316                                 usleep(10000);
317                                 readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
318                         } while (tmp_quadlet & (1UL<<31));
319
320                         readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
321
322                         if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
323                                 readRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &testReturn, sizeof(testReturn));
324                                 printMessage("Value @addr 0x%X = 0x%X\n", testParam.lvalue0, testReturn.data[0]);
325                                 printMessage("Quadlet read successfully\n");
326                                 return true;
327                         } else {
328                                 printMessage("in testDiceFL(): unknown error =  0x%X\nSTOP.\n", tmp_quadlet);
329                                 return false;
330                         }
331                         break;
332                 default :
333                         printMessage("Test&Debug command not found.\n");
334                         return false;
335                         break;
336         }
337 }
338
339 bool
340 Device::deleteImgFL(const char* image, bool v) {
341
342         DICE_FL_DELETE_IMAGE_PARAM imageDelete;
343
344         memcpy(imageDelete.name, image, strlen(image)+1);
345
346         printMessage("Deleting image '%s'\n", image);
347         printMessage("Please wait, this will take some time\n");
348         printMessage("Deletion in progress ...\n");
349
350         writeRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &imageDelete, sizeof(imageDelete));
351
352         writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_DELETE_IMAGE);
353
354         do {
355                 usleep(300000);
356                 readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
357         } while (tmp_quadlet & (1UL<<31));
358
359         readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
360
361         if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
362                 printMessage("Deletion successfully finished\n");
363                 return true;
364         } else if (tmp_quadlet == DICE_FL_E_FIS_ILLEGAL_IMAGE) {
365                 if (v) {
366                         printMessage("in deleteImgFL(): FIS illegal image\nSTOP.\n");
367                         return false;
368                 } else {
369                         printMessage("No image with name '%s' in firmware. Nothing to delete.\n", image);
370                         return true;
371                 }
372         } else {
373                 printMessage("in deleteImgFL(): unknown error =  0x%X\nSTOP.\n", tmp_quadlet);
374                 return false;
375         }
376 }
377
378 bool
379 Device::flashDiceFL(const char* filename, const char* image) {
380
381         /***************************
382          * CHECKING CAPABILITY BITS
383          ***************************/
384
385         readReg(DICE_FL_OFFSET + DICE_FL_CAPABILITIES, &tmp_quadlet);
386
387         printMessage("CAPABILITIES = 0x%X\n", tmp_quadlet);
388         /*
389          * this operation is necessary to determine if IMAGE-AUTOERASE and PROGRESS-INFORMATION are supported
390          * to be implemented in a future release
391          */
392
393         /***************
394          * UPLOAD IMAGE
395          ***************/
396
397         DICE_FL_UPLOAD_HEADER_PARAM upload_header;
398         DICE_FL_UPLOAD_DATA_PARAM upload_data;
399         uint32_t imageSize = 0;
400         uint32_t index = 0;
401         uint32_t chksum = 0;
402         unsigned char* byteValue;
403
404         ifstream file(filename, ios::in|ios::binary|ios::ate);
405
406         if (file.is_open()) {
407                 imageSize = file.tellg();
408                 file.seekg(0, ios::beg);
409
410                 printMessage("Uploading DICE image (image size = %i Bytes)\n", imageSize);
411                 printMessage("Please wait, this will take some time\n");
412                 printMessage("Upload in progress ...\n");
413                 while (file.good()) {
414                         file.read((char*) upload_data.buffer, sizeof(upload_data));
415
416                         if ((upload_header.length = (uint32_t) file.gcount()) > 0) {
417
418                                 upload_header.index = index;
419
420                                 byteValue = (unsigned char*) upload_data.buffer;
421                                 for (uint32_t i=0; i<upload_header.length; i++) {
422                                         chksum += *byteValue++;
423                                 }
424
425                                 writeRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &upload_header, sizeof(upload_header));
426                                 writeRegBlock(DICE_FL_OFFSET + DICE_FL_BUFFER, (fb_quadlet_t*) &upload_data, sizeof(upload_data));
427
428                                 writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_UPLOAD);
429
430                                 do {
431                                         usleep(100);
432                                         readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
433                                 } while (tmp_quadlet & (1UL<<31));
434
435                                 readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
436
437                                 if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
438                                         //printMessage("Upload operation successful");
439                                 } else if (tmp_quadlet == DICE_FL_E_BAD_INPUT_PARAM) {
440                                         printMessage("in flashDiceFL(): bad input parameter\nSTOP.\n");
441                                         return false;
442                                 } else {
443                                         printMessage("in flashDiceFL(): unknown error =  0x%X\nSTOP.\n", tmp_quadlet);
444                                         return false;
445                                 }
446                                 index += upload_header.length;
447                         }
448                 }
449
450                 file.close();
451         } else {
452                 printMessage("Cannot open file %s\nSTOP.\n", filename);
453                 return false;
454         }
455
456         /**************
457          * UPLOAD_STAT
458          **************/
459
460         writeReg(DICE_FL_OFFSET + DICE_FL_PARAMETER, imageSize);
461
462         writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_UPLOAD_STAT);
463
464         do {
465                 usleep(1000000); //take care on polling, depends on dice-image size (to low values lead to a read error)
466                 readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
467         } while (tmp_quadlet & (1UL<<31));
468
469         readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
470
471         if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
472                 readReg(DICE_FL_OFFSET + DICE_FL_PARAMETER, &tmp_quadlet);
473                 //printMessage("Offline (DICE) checksum calculation = %i\n", tmp_quadlet);
474                 //printMessage("Offline (local) checksum calculation = %i\n", chksum);
475         } else {
476                 printMessage("in flashDiceFL(): unknown error =  0x%X\nSTOP.\n", tmp_quadlet);
477                 return false;
478         }
479
480         /***********
481          * FLASHING
482          ***********/
483
484         if (tmp_quadlet == chksum) {
485
486                 printMessage(
487                                 "\n***********************************************************************\n\n"
488                                 "Flashing process was successfully tested on a TCAT DICE EVM002 board.\n"
489                                 "It may work with other DICE based boards, but it can cause your device\n"
490                                 "to magically stop working (a.k.a. bricking), too.\n\n"
491                                 "If you are on a BIG ENDIAN machine (i.e. Apple Mac) this process will\n"
492                                 "definitely brick your device. You have been warned.\n\n"
493                                 "By pressing 'y' you accept the risk, otherwise process will be aborted.\n\n"
494                                 "        *****  DON'T TURN OFF POWER DURING FLASH PROCESS *****\n\n"
495                                 "***********************************************************************\n\n"
496                                 "Continue anyway? ");
497                 char query;
498                 cin >> query;
499                 if (query == 'y') {
500
501                         DICE_FL_CREATE_IMAGE_PARAM imageCreate;
502
503                         imageCreate.length = imageSize;
504                         imageCreate.execAddr = 0x30000;
505                         imageCreate.entryAddr = 0x30040;
506                         memcpy(imageCreate.name, image, strlen(image)+1);
507
508                         deleteImgFL(image);
509
510                         printMessage("Writing image '%s' to device\n", image);
511                         printMessage("Please wait, this will take some time\n");
512                         printMessage("Flash in progress ...\n");
513
514                         writeRegBlock(DICE_FL_OFFSET + DICE_FL_PARAMETER, (fb_quadlet_t*) &imageCreate, sizeof(imageCreate));
515
516                         writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_CREATE_IMAGE);
517
518                         do {
519                                 usleep(300000);
520                                 readReg(DICE_FL_OFFSET + DICE_FL_OPCODE, &tmp_quadlet);
521                         } while (tmp_quadlet & (1UL<<31));
522
523                         readReg(DICE_FL_OFFSET + DICE_FL_RETURN_STATUS, &tmp_quadlet);
524
525                         if (tmp_quadlet == DICE_FL_RETURN_NO_ERROR) {
526                                 printMessage("Flashing successfully finished\n");
527                                 printMessage("You have to restart the device manually to load the new image\n");
528                                 return true;
529                         } else if (tmp_quadlet == DICE_FL_E_FIS_ILLEGAL_IMAGE) {
530                                 printMessage("in flashDiceFL(): FIS illegal image\nSTOP.\n");
531                                 return false;
532                         } else {
533                                 printMessage("in flashDiceFL(): unknown error =  0x%X\nSTOP.\n", tmp_quadlet);
534                                 return false;
535                         }
536
537                 /**************
538                  * RESET_IMAGE
539                  **************/
540
541                 //writeReg(DICE_FL_OFFSET + DICE_FL_OPCODE, (1UL<<31) | DICE_FL_OP_RESET_IMAGE);
542                 /*
543                  * this would lead to a segmentation fault due to a BUS reset by DICE device
544                  */
545
546                 } else {
547                         return false;
548                 }
549         } else {
550                 printMessage("Checksum mismatch. Flash operation aborted.\n");
551                 return false;
552         }
553 }
554
555 } //namespace Dice
Note: See TracBrowser for help on using the browser.