summaryrefslogtreecommitdiffstats
path: root/src/progs/direct/base/direct_16F.h
blob: 0b0fca8f4c32775ce38f03e2f0e5d99eadba8c71 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/***************************************************************************
 *   Copyright (C) 2003-2005 Alain Gibaud <alain.gibaud@free.fr>           *
 *   Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org>                  *
 *   Copyright (C) 2004 Keith Baker <syzygy@pubnix.org>  [16F7X]           *
 *                                                                         *
 *   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_16F_HH
#define DIRECT_16F_HH

#include "direct_16.h"

namespace Direct
{
//-----------------------------------------------------------------------------
class P16F : public pic16
{
public:
  P16F(::Programmer::Base &base) : pic16(base) {}
  bool gotoTestMemory();
  virtual bool gotoMemory(Pic::MemoryRangeType type);
};

//-----------------------------------------------------------------------------
class P16F8X : public P16F
{
public:
  P16F8X(::Programmer::Base &base) : P16F(base) {}
  virtual bool doErase(bool isProtected);
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual uint waitProgTime(Pic::MemoryRangeType) const { return 20000; }
};

//-----------------------------------------------------------------------------
class P16CR8X : public P16F8X
{
public:
  P16CR8X(::Programmer::Base &base) : P16F8X(base) {}
  virtual bool doErase(bool) { return false; } // #### can't the eeprom be bulk erased ???
  virtual bool doEraseRange(Pic::MemoryRangeType) { return false; }
  // #### eeprom and config only can be programmed...
};

//-----------------------------------------------------------------------------
class P16F84A : public P16F
{
public:
  P16F84A(::Programmer::Base &base) : P16F(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
  virtual void startProg(Pic::MemoryRangeType type);
  virtual uint waitProgTime(Pic::MemoryRangeType type) const;
};

typedef class P16F84A P16F87X;

//-----------------------------------------------------------------------------
class P16F7X : public P16F
{
public:
  P16F7X(::Programmer::Base &base) : P16F(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
  uint nbWordsCodeProg() const { return 2; }
  virtual uint waitProgTime(Pic::MemoryRangeType type) const;
  virtual void endProg(Pic::MemoryRangeType) { pulseEngine("k14,"); }
  virtual bool setPowerOn() { return setPowerOnVppFirst(); }
};

//-----------------------------------------------------------------------------
class P16F62X : public P16F84A
{
public:
  P16F62X(::Programmer::Base &base) : P16F84A(base) {}
  virtual bool doErase(bool isProtected);
  virtual uint waitProgTime(Pic::MemoryRangeType) const { return 8000; }
  virtual bool setPowerOn() { return setPowerOnVppFirst(); }
};

//-----------------------------------------------------------------------------
class P16F81X : public P16F
{
public:
  P16F81X(::Programmer::Base &base) : P16F(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
  uint nbWordsCodeProg() const { return 4; }
  virtual void startProg(Pic::MemoryRangeType) { pulseEngine("k24,"); }
  virtual uint waitProgTime(Pic::MemoryRangeType) const { return 2000; }
  virtual void endProg(Pic::MemoryRangeType) { pulseEngine("k23,"); }
};

//-----------------------------------------------------------------------------
class P12F675 : public P16F
{
public:
  P12F675(::Programmer::Base &base) : P16F(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
  virtual uint waitProgTime(Pic::MemoryRangeType type) const;
  virtual bool setPowerOn() { return setPowerOnVppFirst(); }
};

//-----------------------------------------------------------------------------
class P16F62XA : public P16F
{
public:
  P16F62XA(::Programmer::Base &base) : P16F(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
  virtual uint waitProgTime(Pic::MemoryRangeType type) const;
  virtual bool setPowerOn() { return setPowerOnVppFirst(); }
};

//-----------------------------------------------------------------------------
class P16F87XA : public P16F
{
public:
  P16F87XA(::Programmer::Base &base) : P16F(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
  virtual uint nbWordsCodeProg() const { return 8; }
  virtual uint waitProgTime(Pic::MemoryRangeType) const { return 8000; }
};

//-----------------------------------------------------------------------------
class P16F913 : public P16F
{
public:
  P16F913(::Programmer::Base &base) : P16F(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
  virtual uint nbWordsCodeProg() const { return 4; }
  virtual void startProg(Pic::MemoryRangeType) { pulseEngine("k24,"); }
  virtual uint waitProgTime(Pic::MemoryRangeType) const { return 2500; }
  virtual void endProg(Pic::MemoryRangeType) { pulseEngine("k10,w100"); }
  virtual bool setPowerOn() { return setPowerOnVppFirst(); }
};

class P16F916 : public P16F913
{
public:
  P16F916(::Programmer::Base &base) : P16F913(base) {}
  virtual uint nbWordsCodeProg() const { return 8; }
};

typedef class P16F913 P12F6XX_16F6XX;

class P16F785 : public P16F913
{
public:
  P16F785(::Programmer::Base &base) : P16F913(base) {}
  virtual bool doEraseRange(Pic::MemoryRangeType type);
  virtual bool doErase(bool isProtected);
};

} // namespace

#endif