blob: 2092f053048f948590584d61864a339aa4626576 (
plain)
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
|
/***************************************************************************
* Copyright (C) 2003-2004 Alain Gibaud <alain.gibaud@free.fr> *
* *
* 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 DIRECT_PIC_H
#define DIRECT_PIC_H
#include "devices/pic/pic/pic_memory.h"
#include "direct.h"
namespace Direct
{
//-----------------------------------------------------------------------------
class PulseEngine
{
public:
PulseEngine(::Programmer::Base &base);
virtual ~PulseEngine() {}
BitValue pulseEngine(const TQString &command, BitValue value = 0);
protected:
::Programmer::Base &_pbase;
uint _clockDelay; // additionnal delay for buggy hardware
virtual bool pulse(const char *&cmd, BitValue value, BitValue &res);
virtual Hardware &hardware() { return static_cast<Hardware &>(*_pbase.hardware()); }
};
//-----------------------------------------------------------------------------
class PicDeviceSpecific : public ::Programmer::PicDeviceSpecific, public PulseEngine
{
public:
PicDeviceSpecific(::Programmer::Base &base);
virtual bool canEraseAll() const { return true; }
virtual bool canEraseRange(Pic::MemoryRangeType type) const { return ( type==Pic::MemoryRangeType::Code || type==Pic::MemoryRangeType::Eeprom ); }
virtual bool canReadRange(Pic::MemoryRangeType) const { return true; }
virtual bool canWriteRange(Pic::MemoryRangeType) const { return true; }
virtual bool setPowerOff();
virtual bool setTargetPowerOn(bool on);
protected:
virtual bool pulse(const char *&cmd, BitValue value, BitValue &res);
bool setPowerOnVddFirst();
bool setPowerOnVppFirst();
};
//-----------------------------------------------------------------------------
class Pic8DeviceSpecific : public PicDeviceSpecific
{
public:
Pic8DeviceSpecific(::Programmer::Base &base) : PicDeviceSpecific(base) {}
protected:
virtual bool pulse(const char *&cmd, BitValue value, BitValue &res);
virtual void send_word(BitValue word) = 0;
virtual void send_bits(BitValue d, uint nbBits) = 0;
virtual void send_cmd(BitValue d) = 0;
virtual BitValue get_word() = 0;
virtual BitValue get_byte() = 0;
};
} // namespace
#endif
|