summaryrefslogtreecommitdiffstats
path: root/src/progs/direct/base/direct_18F.h
blob: c3cbcf8436a491d96052b3596827c3172e48b40e (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/***************************************************************************
 *   Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org>                  *
 *   Copyright (C) 2003-2005 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_18F_H
#define DIRECT_18F_H

#include "direct_18.h"

namespace Direct
{
//-----------------------------------------------------------------------------
class P18F : public P18
{
public:
  P18F(::Programmer::Base &base) : P18(base) {}
  virtual bool doRead(Pic::MemoryRangeType type, Device::Array &data, const ::Programmer::VerifyData *vdata);
  virtual bool doWrite(Pic::MemoryRangeType, const Device::Array &data, bool force);
  virtual bool doEraseCommand(uint cmd1, uint cmd2);
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);

  bool skipMaskWords(Pic::MemoryRangeType type, const Device::Array &data,
                     uint &i, uint nb, bool force);
  void setPointer(Pic::MemoryRangeType type, uint offset);
  void setCodePointer(uint address);
  enum Type { Code, Eeprom, Erase };
  virtual void program(Type type);
  virtual uint programHighTime(Type type) const { return (type==Code ? 1000 : 5000); }
  virtual uint programLowTime() { return 5; }
  virtual void configureSinglePanel() {}
  virtual void unlockEeprom();
  virtual void directAccess(Pic::MemoryRangeType type);
};

//-----------------------------------------------------------------------------
class P18F1220 : public P18F
{
public:
  P18F1220(::Programmer::Base &base) : P18F(base) {}
  virtual void program(Type type);
};

//-----------------------------------------------------------------------------
class P18F242 : public P18F
{
public:
  P18F242(::Programmer::Base &base) : P18F(base) {}
  virtual void configureSinglePanel();
};

//-----------------------------------------------------------------------------
class P18F2539 : public P18F242
{
public:
  P18F2539(::Programmer::Base &base) : P18F242(base) {}
  virtual bool doErase(bool isProtected);
  virtual bool doEraseCommand(uint cmd1, uint cmd2);
};

//-----------------------------------------------------------------------------
class P18F2439 : public P18F2539
{
public:
  P18F2439(::Programmer::Base &base) : P18F2539(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
};

//-----------------------------------------------------------------------------
class P18F2221 : public P18F
{
public:
  P18F2221(::Programmer::Base &base) : P18F(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
  virtual uint programLowTime() { return 100; }
  virtual void unlockEeprom() {}
};

//-----------------------------------------------------------------------------
class P18F6527 : public P18F2221
{
public:
  P18F6527(::Programmer::Base &base) : P18F2221(base) {}
  virtual bool doErase(bool isProtected);
};

//-----------------------------------------------------------------------------
class P18F6310 : public P18F
{
public:
  P18F6310(::Programmer::Base &base) : P18F(base) {}
  virtual bool canEraseRange(Pic::MemoryRangeType) const { return false; }
  virtual uint programHighTime(Type type) const { return (type==Code ? 2000 : 30000); }
  virtual uint programLowTime() { return 120; }
  virtual bool doEraseRange(Pic::MemoryRangeType) { return false; }
  virtual bool doErase(bool isProtected);
};

} // namespace

#endif