1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/***************************************************************************
* Copyright (C) 2005-2006 Nicolas Hadacek <hadacek@kde.org> *
* Copyright (C) 2002-2003 Stephen Landamore <stephen@landamore.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef ICD_H
#define ICD_H
#include "microchip.h"
#include "devices/pic/prog/pic_prog.h"
#include "devices/pic/pic/pic_memory.h"
namespace Icd
{
//-----------------------------------------------------------------------------
class Hardware : public ::Programmer::PicHardware
{
public:
Hardware(::Programmer::Base &base, Port::Base *port) : ::Programmer::PicHardware(base, port, TQString()) {}
// initialization
virtual bool uploadFirmware(const Pic::Memory &memory) = 0;
virtual bool setTarget() = 0;
// status
virtual bool getFirmwareVersion(VersionData &version) = 0;
virtual bool setTargetPowerOn(bool) { return true; }
// programming
virtual bool readMemory(Pic::MemoryRangeType type, uint wordOffset, Device::Array &data, const ::Programmer::VerifyData *vdata) = 0;
virtual bool writeMemory(Pic::MemoryRangeType type, uint wordOffset, const Device::Array &data) = 0;
virtual bool eraseAll() = 0;
// debugging
virtual bool readRegister(Address address, BitValue &value, uint nbBytes) = 0;
virtual bool writeRegister(Address address, BitValue value, uint nbBytes) = 0;
virtual bool resumeRun() = 0;
virtual bool step() = 0;
virtual bool haltRun() = 0;
virtual BitValue getProgramCounter() = 0;
protected:
TQString _rx;
virtual bool internalConnect(const TQString &mode) = 0;
virtual TQString receivedData() const = 0;
virtual bool internalConnectHardware() { return internalConnect("U"); }
};
//-----------------------------------------------------------------------------
class DeviceSpecific : public ::Programmer::PicDeviceSpecific
{
public:
DeviceSpecific(::Programmer::Base &base) : ::Programmer::PicDeviceSpecific(base) {}
virtual bool canEraseAll() const { return true; }
virtual bool canEraseRange(Pic::MemoryRangeType) const { return false; }
virtual bool canReadRange(Pic::MemoryRangeType) const { return true; }
virtual bool canWriteRange(Pic::MemoryRangeType) const { return true; }
Hardware &hardware() { return static_cast<Hardware &>(*_base.hardware()); }
virtual bool setPowerOff() { return false; }
virtual bool setPowerOn() { return false; }
virtual bool setTargetPowerOn(bool on) { return hardware().setTargetPowerOn(on); }
virtual bool doEraseRange(Pic::MemoryRangeType) { return false; }
virtual bool doErase(bool);
virtual bool doRead(Pic::MemoryRangeType type, Device::Array &data, const ::Programmer::VerifyData *vdata);
Device::Array prepareRange(Pic::MemoryRangeType type, const Device::Array &data, bool force, uint &wordOffset);
virtual bool doWrite(Pic::MemoryRangeType type, const Device::Array &data, bool force);
};
} // namespace
#endif
|