source: ISPProgrammer/ISPprog/Processors.pas

Last change on this file was 363, checked in by chronos, 12 years ago
  • Added: Package ISPProgrammer for in-system programming of various chips. Supports Dallas ISP protocol, Presto, Rabbit RFU and some others Atmel devices.
File size: 4.1 KB
Line 
1unit Processors;
2
3{$MODE Delphi}
4
5interface
6
7{$INCLUDE Options.inc}
8
9uses Globals;
10
11type
12 TLockBits = array[0..7] of string[5];
13 TSignature = record
14 b0, b1, b2:byte; {Signature bytes}
15 name:string[16];
16 proctype:byte; {Processor type: PROC_TYPE_xxx}
17 fsize:integer; {Flash size in bytes}
18 esize:integer; {EEPROM size in bytes}
19 usigsize:integer; {User Signature size in bytes}
20 fpage:byte; {Flash page bits}
21 fpagesize:integer; {Flash page size in bytes, usually 2^fpage}
22 epage:byte; {EEPROM page bits}
23 epagesize:integer; {EEPROM page size in bytes, usually 2^epage}
24 osccal:byte; {Number of oscillator calibration bytes}
25 algo:byte; {Programming algorithm}
26 algo_erase:byte; {Erasing algorithm}
27 algo_lb:byte; {Lock bits and fuses reading/programming algorithm}
28 algo_busy:byte; {Busy check algorithm}
29 prog_time:integer; {Time in ms to wait after programming}
30 lockbits:array[0..7] of string[5]; {LSB to MSB}
31 fusebitslo:array[0..7] of string[16]; {LSB to MSB}
32 fusebitshi:array[0..7] of string[16]; {LSB to MSB}
33 fusebitsext:array[0..7] of string[16]; {LSB to MSB}
34 end;
35
36const
37 ALGO_STD = 1;
38 ALGO_MEGA = 2;
39 ALGO_DATAFLASH = 3;
40 ALGO_SERIALFLASH = 4;
41{$IFDEF I2C_SUPPORT}
42 ALGO_AT24_EEPROM = 5;
43{$ENDIF}
44
45 ALGO_ERASE_STD = 0;
46 ALGO_ERASE_TWICE = 1;
47
48 ALGO_LB_NONE = 0;
49 ALGO_LB_STD = 1;
50 ALGO_LB_TINY = 2;
51 ALGO_LB_2323 = 3;
52 ALGO_LB_2333 = 4;
53 ALGO_LB_MEGA = 5;
54 ALGO_LB_89x = 6;
55 ALGO_LB_89S51 = 7;
56 ALGO_LB_89S8253 = 8;
57 ALGO_LB_89S2051 = 9;
58
59 ALGO_BUSY_WAIT = 1;
60 ALGO_BUSY_POLL_00FF = 2;
61 ALGO_BUSY_POLL_FF = 3;
62 ALGO_BUSY_POLL_NMSB = 4;
63 ALGO_BUSY_POLL_RDYBSY = 5;
64 ALGO_BUSY_DATAFLASH = 6;
65 ALGO_BUSY_SERIALFLASH = 7;
66{$IFDEF I2C_SUPPORT}
67 ALGO_BUSY_AT24_EEPROM = 8;
68{$ENDIF}
69
70 MAX_FLASH_SIZE = 17301504; // AT45CS1282 (16.5MB)
71 MAX_EEPROM_SIZE = 4096;
72 MAX_USERSIG_SIZE = 32;
73
74 SIGNCOUNT = 2
75 + 7 {AT89}
76 + 18 {AT90}
77 + 16 {ATtiny}
78 + 38 {ATmega}
79 + 21 {AT45}
80 + 7 {AT25}
81 + 4 {AT25F}
82 + 1 {AT26}
83{$IFDEF I2C_SUPPORT}
84 + 11 {AT24}
85{$ENDIF}
86 ;
87
88 Signatures:array [1..SIGNCOUNT] of TSignature =
89 (
90 (b0:$00; b1:$00; b2:$00;
91 name:'AT89S53/8252';
92 proctype:PROC_TYPE_OLD51;
93 fsize:12288; esize:2048; usigsize:0; fpage:0; fpagesize:0; epage:0; epagesize:0;
94 osccal:0;
95 algo:ALGO_STD;
96 algo_erase:ALGO_ERASE_STD;
97 algo_lb:ALGO_LB_89x;
98 algo_busy:ALGO_BUSY_POLL_NMSB;
99 prog_time:16;
100 lockbits:('','','','','','LB3','LB2','LB1');
101 fusebitslo:('','','','','','','','');
102 fusebitshi:('','','','','','','','');
103 fusebitsext:('','','','','','','',''))
104,
105 (b0:$00; b1:$01; b2:$02;
106 name:'CHIP LOCKED';
107 proctype:0;
108 fsize:0; esize:0; usigsize:0; fpage:0; fpagesize:0; epage:0; epagesize:0;
109 osccal:0;
110 algo:0;
111 algo_erase:0;
112 algo_lb:0;
113 algo_busy:0;
114 prog_time:0;
115 lockbits:('','','','','','','','');
116 fusebitslo:('','','','','','','','');
117 fusebitshi:('','','','','','','','');
118 fusebitsext:('','','','','','','',''))
119,
120{$I Devices_AT89.inc}
121,
122{$I Devices_AT90.inc}
123,
124{$I Devices_ATtiny.inc}
125,
126{$I Devices_ATmega.inc}
127,
128{$I Devices_AT45.inc}
129,
130{$I Devices_AT25.inc}
131,
132{$I Devices_AT25F.inc}
133,
134{$I Devices_AT26.inc}
135
136{$IFDEF I2C_SUPPORT}
137 ,
138 {$I Devices_AT24.inc}
139{$ENDIF}
140
141 );
142
143 DEVICE_UNKNOWN = 0;
144 DEVICE_AT89Sxx = 1; // AT89S53/8252
145 DEVICE_LOCKED = 2;
146
147function FindSignature (s0:byte; s1:byte; s2:byte):integer;
148function FindName (name:string):integer;
149
150implementation
151
152function FindSignature (s0:byte; s1:byte; s2:byte):integer;
153var
154 n:integer;
155begin
156 for n:=2 to SIGNCOUNT do
157 with Signatures[n] do
158 if (b0=s0) and (b1=s1) and (b2=s2) then
159 begin
160 Result:=n;
161 Exit;
162 end;
163 Result:=-1;
164end;
165
166function FindName (name:string):integer;
167var
168 n:integer;
169begin
170 for n:=1 to SIGNCOUNT do
171 if (n <> DEVICE_LOCKED) and (Signatures[n].name = name) then
172 begin
173 Result:=n;
174 Exit;
175 end;
176 Result:=-1;
177end;
178
179end.
Note: See TracBrowser for help on using the repository browser.