| ofs | hex dump | ascii |
|---|
| 0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 ff 00 00 02 5e 08 06 00 00 00 ba 59 0c | .PNG........IHDR.......^......Y. |
| 0020 | 68 00 00 00 04 67 41 4d 41 00 00 b1 8f 0b fc 61 05 00 00 00 09 70 48 59 73 00 00 2e 22 00 00 2e | h....gAMA......a.....pHYs..."... |
| 0040 | 22 01 aa e2 dd 92 00 00 00 19 74 45 58 74 53 6f 66 74 77 61 72 65 00 70 61 69 6e 74 2e 6e 65 74 | ".........tEXtSoftware.paint.net |
| 0060 | 20 34 2e 30 2e 31 37 33 6e 9f 63 00 00 b1 af 49 44 41 54 78 5e ed bd 79 c0 2d 55 79 e6 9b 08 de | .4.0.173n.c....IDATx^..y.-Uy.... |
| 0080 | 44 66 95 4e 72 e8 0c 7d af 26 ad 49 df 16 6d cc ed e4 e2 41 24 49 df 8e 38 64 e8 ee dc 20 09 78 | Df.Nr..}.&.I..m....A$I..8d.....x |
| 00a0 | bb 83 ca 18 24 83 89 80 63 4b 3a 1a 0c 0e c0 21 28 f3 a0 08 1c 64 16 88 03 22 b3 80 ca e4 00 22 | ....$...cK:....!(....d..."....." |
| 00c0 | e7 30 cb 99 98 0f 59 b7 9e aa ef dd df bb df fd ae 9a f7 de 55 b5 9f 3f 7e df fe 6a d5 aa 55 ab | .0....Y.............U..?~..j..U. |
| 00e0 | d6 5a b5 9e 77 8d f5 13 21 04 42 08 21 3d 67 ed fd f7 87 53 57 1d 1b 4e 3b e1 38 97 23 de 7d 70 | .Z..w...!.B.!=g....SW..N;.8.#.}p |
| 0100 | 78 db ef ed 59 8a 57 bf e2 65 e1 97 7f f1 e7 66 c0 8a f0 f2 5f f8 d9 f4 77 e5 2e 3b 8f c5 01 71 | x...Y.W..e.....f...._...w..;...q |
| 0120 | b6 cf 48 da c3 75 24 84 10 32 3d 1e 5c bb 66 42 a8 45 f4 f6 7a eb 1b 53 de f4 86 d7 a5 02 99 89 | ..H..u$..2=.\.fB.E..z..S........ |
| 0140 | e3 f2 ef 96 5b fe 44 52 73 2f 06 db 6f bd 45 92 5c 7e 1a 92 66 b8 8e 84 10 42 ca 73 cb 8d 37 4c | ....[.DRs/..o.E.\~..f....B.s..7L |
| 0160 | 88 78 26 de 2b 52 c1 06 9e b8 91 62 f6 fe fd 37 25 49 ec a7 3b a9 8f eb 48 08 21 64 9c 9b af bb | .x&.+R.....b...7%I..;...H.!d.... |
| 0180 | 36 15 77 88 d1 ca 5d 5e b5 70 ad f0 79 b1 e2 a5 db 24 c9 ef e7 09 a9 8f eb 48 08 21 24 fc c4 37 | 6.w...]^.p..y....$.......H.!$..7 |
| 01a0 | af bf 2e ec b9 fb ae 61 a7 1d b7 9d 10 a5 3e b2 3c c6 6e c7 dc 97 87 15 00 7a 2d a4 07 63 56 c8 | .......a......>.<.n......z-..cV. |
| 01c0 | bd 77 da 71 9b 89 78 db 7c 21 cd 71 1d 09 21 64 d1 b9 ec 82 f3 67 da b2 87 e8 69 01 c6 ff 9e 48 | .w.q..x.|!.q..!d.....g....i....H |
| 01e0 | 62 e2 de e9 27 ae 1a 9b 33 80 63 fc fe cb bf fc cb 18 cf 3f ff bc fb db 25 6c dc f0 2c 36 6d 6c | b...'...3.c........?....%l..,6ml |
| 0200 | de 90 e6 b8 8e 84 10 b2 e8 78 2d d0 32 60 92 9a 08 38 5a d0 18 26 c0 04 be 23 0f 3b 64 24 d6 00 | .........x-.2`...8Z..&...#.;d$.. |
| 0220 | b3 f3 cb 88 71 d7 fc 4c 03 7d 5f a4 8d 4d 53 9b 37 a4 39 ae 23 21 84 2c 32 10 66 2b 40 82 88 3b | ....q..L.}_..MS.7.9.#!.,2.f+@..; |
| 0240 | 5a e1 07 ec fb b6 91 98 6b 31 d3 c4 04 b5 8a d0 ce 4b 94 e7 01 c5 7f 36 b8 8e 84 10 b2 c8 78 5d | Z.......k1.......K.....6......x] |
| 0260 | cf 1f ff c8 07 d3 d6 ba 27 58 a4 3d 28 fe b3 c1 75 24 84 90 45 66 ff 7d f6 9a 10 20 4f a8 48 fb | ........'X.=(...u$..Ef.}....O.H. |
| 0280 | 50 fc 67 83 eb 48 08 21 8b 0c c6 e9 b5 f8 a0 9b 5f ba de 17 a9 0b 7e 1e 50 fc 67 83 eb 48 08 21 | P.g..H.!........_.....~.P.g..H.! |
| 02a0 | 8b 0c b6 b7 d5 e2 83 63 08 93 16 7e 1a 01 d3 81 e2 3f 1b 5c 47 42 08 59 64 d0 d2 d7 e2 83 c9 7d | .......c...~.....?.\GB.Yd......} |
| 02c0 | 10 26 08 be 60 45 8b b4 03 c5 7f 36 b8 8e 84 10 b2 c8 d8 65 7e 10 7f 0a fe 6c a0 f8 cf 06 d7 91 | .&..`E.....6.......e~....l...... |
| 02e0 | 10 42 16 19 2b 3e 98 e9 ef 09 15 69 1f 8a ff 6c 70 1d 09 21 64 91 b1 e2 83 dd f4 3c a1 22 ed 43 | .B..+>.....i...lp..!d......<.".C |
| 0300 | f1 9f 0d ae 23 21 84 2c 2a de 06 3f 10 24 4f a8 34 32 2c e0 0d 0f 94 39 17 03 db 0c e3 fe 30 40 | ....#!.,*..?.$O.42,....9......0@ |
| 0320 | 64 1b 5f 41 b6 fc f5 c0 f7 f1 65 a7 c1 3c 5e d8 c2 16 c6 fa eb 85 b8 ef 81 6f df bb f6 9e 08 78 | d._A......e..<^..........o.....x |
| 0340 | 4e 1b be cd 23 d2 1c d7 91 10 42 16 15 88 aa 15 9f aa 42 26 82 8e 1d 00 f3 44 59 ef e5 3f b4 2f | N...#.....B.......B&.....DY..?./ |
| 0360 | 04 e2 39 6d ba 94 c1 4b 7f 9b 47 a4 39 ae 23 21 84 2c 2a 9e f8 e4 b5 ce f3 ce d9 70 ea 90 6d 27 | ..9m...K..G.9.#!.,*........p..m' |
| 0380 | bc dc b2 d6 5f e2 c3 b7 03 f0 dd 00 31 2c b0 3f 81 fc af b7 1e ce 03 9f 2a b6 69 50 05 7c f9 50 | ...._.......1,.?........*.iP.|.P |
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */#include "DFUMode.h"
#include <stdio.h>
#include "stdafx.h"
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#include "lmdfu.h"
#include "lmdfuwrap.h"
#include "ProgressMode.h"
#include "TwineDFUExtras.h"
#pragma once
using namespace System;
namespace Tango
{
namespace FirmwareUpdateLib {
/// <summary>
/// Represents the upload operation progress callback delegate.
/// </summary>
/// <param name="progressMode">The progress mode.</param>
/// <param name="current">The current.</param>
/// <param name="total">The total.</param>
public delegate void ProgressCallbackDelegate(ProgressMode progressMode, int current, int total);
public ref class DFUDevice
{
private:
unsigned char *lastDownloadBytes;
tLMDFUDeviceInfo *devInfo;
tLMDFUHandle devHandle;
bool _isDisposed;
public:
/// <summary>
/// Vendor ID published in the device descriptor.
/// </summary>
property String^ VID;
/// <summary>
/// Product ID published in the device descriptor.
/// </summary>
property String^ PID;
/// <summary>
/// BCD device release number published in the device descriptor.
/// </summary>
property String^ DeviceName;
/// <summary>
/// The manufacturer name string published in the device.
/// </summary>
property String^ Manufacturer;
/// <summary>
/// The interface string published in the DFU interface descriptor.
/// </summary>
property String^ DFUInterface;
/// <summary>
/// The serial number string published in the device descriptor.
/// </summary>
property String^ SerialNumber;
/// <summary>
/// Maximum number of bytes that the device can accept per control-write transaction as published in the DFU functional descriptor.
/// </summary>
property int MaxTransfer;
/// <summary>
/// Determines the current DFU driver mode. (An update can only be applied while in DFU mode).
/// </summary>
property DFUMode Mode;
/// <summary>
/// Indicates that the device will detach and reattach automatically on receipt of the DFU_DETACH request whereas 'false' indicates that the host must issue a USB reset after the DFU_DETACH request.
/// </summary>
property bool WillDetach;
/// <summary>
/// Indicates that the device supports firmware download operations and: 'false' indicates that download is not supported.
/// </summary>
property bool ManifestTolerant;
property bool UploadCable;
property bool DownloadCable;
/// <summary>
///Determines whether the DFU device supports the Tiva DFU binary protocol or false otherwise. (If not than AppStartAddress should be provided!).
/// </summary>
property bool SupportsTivaExtensions;
/// <summary>
/// The size of a flash block in bytes.
/// </summary>
property short FlashBlockSize;
/// <summary>
/// The number of blocks of flash in the device. Total flash size is NumFlashBlocks * FlashBlockSize.
/// </summary>
property short NumFlashBlocks;
/// <summary>
/// Address 1 byte above the highest location the boot loader can access.
/// </summary>
property long FlashTopAddress;
/// <summary>
/// Total flash size in bytes.
/// </summary>
property int FlashSize;
/// <summary>
/// Lowest address the boot loader can write or erase.
/// </summary>
property long AppStartAddress;
/// <summary>
/// Image Size.
/// </summary>
property long ImageLength;
/// <summary>
/// Optional Twine information which will be flashed to the top of the memory.
/// </summary>
property TwineDFUExtras^ TwineExtras;
/// <summary>
/// Initializes a new instance of the <see cref="DFUDevice"/> class.
/// </summary>
DFUDevice();
/// <summary>
/// Finalizes an instance of the <see cref="DFUDevice"/> class.
/// </summary>
~DFUDevice();
/// <summary>
/// Switch the device to DFU upgrade mode.
/// </summary>
void SwitchToDFUMode();
/// <summary>
/// Clears the flash.
/// </summary>
void ClearFlash();
/// <summary>
/// Resets the device.
/// </summary>
void Reset();
/// <summary>
/// Uploads the specified image bytes to the firmware via the DFU class.
/// </summary>
/// <param name="bytes">The bytes.</param>
/// <param name="callback">The progress callback.</param>
void Upload(array<byte>^ bytes, ProgressCallbackDelegate^ callback);
/// <summary>
/// Uploads the specified twine extras to the top of the flash memory.
/// </summary>
/// <param name="extras">The extras.</param>
/// <param name="callback">The progress callback.</param>
void UploadTwineExtras(TwineDFUExtras^ extras, ProgressCallbackDelegate^ callback);
/// <summary>
/// Downloads the existing image bytes from the firmware via the DFU class.
/// </summary>
/// <param name="callback">The progress callback.</param>
/// <returns></returns>
void Download(ProgressCallbackDelegate^ callback);
/// <summary>
/// Gets the last download operation bytes.
/// </summary>
/// <returns></returns>
array<byte>^ GetDownloadBytes();
internal:
const int EXTENSION_LENGTH = 1024;
const int EXTENSION_CODE = 1357;
const int EXTENSION_COMMENTS_LENGTH = 992;
/// <summary>
/// Fetches the twine extras.
/// </summary>
void FetchTwineExtras();
/// <summary>
/// Initializes a new instance of the <see cref="DFUDevice"/> class.
/// </summary>
/// <param name="deviceInfo">The device information.</param>
/// <param name="deviceHandle">The device handle.</param>
DFUDevice(tLMDFUDeviceInfo *deviceInfo, tLMDFUHandle deviceHandle);
};
}
}