FreeCalypso > hg > freecalypso-tools
annotate target-utils/loadagent/amdflash.c @ 990:f34261bb3355
pln-ppb-test: implement PPB erase
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 03 Dec 2023 00:20:14 +0000 |
parents | b34384991094 |
children |
rev | line source |
---|---|
0
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements the AMFB and AMFW commands for programming |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * AMD-style flash memories. Syntax: |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * AMFB <baseaddr> -- sets the base address for subsequent AMFW commands |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * AMFW <offset> <hexstring> -- the actual flash write operation |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 * The flash memory is assumed to be 16 bits wide. The hex string |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * argument to the AMFW command is just data, with no header, address, |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * length, checksum or other additions. The number of hex digits in the |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * string must be a multiple of 4, and the byte order is the same as |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * that of TI's *.m0 files: we interpret the string as consisting of |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 * 16-bit words rather than bytes. |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 * |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 * The address to which each flash write is directed is the sum of the |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 * base given to AMFB and the offset given to AMFW. The fixed offsets |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 * of 0xAAA and 0x554 (0x555 and 0x2AA in words) prescribed for the flash |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 * programming command sequence are also made from the base set with AMFB. |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #include <sys/types.h> |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "types.h" |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 static u32 base_addr; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 cmd_AMFB(argbulk) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 char *argbulk; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 char *argv[2]; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 u_long addr; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 if (parse_args(argbulk, 1, 1, argv, 0) < 0) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 if (parse_hexarg(argv[0], 8, &addr) < 0) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 printf("ERROR: argument must be a valid 32-bit hex address\n"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 if (addr & 1) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 printf("ERROR: odd address\n"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 base_addr = addr; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 void |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 cmd_AMFW(argbulk) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 char *argbulk; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 char *argv[3], *s; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 u_long offset; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 volatile u16 *flashptr; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 u32 datum; /* needs to be u32 for decode_hex_digits() */ |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 int i; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 if (parse_args(argbulk, 2, 2, argv, 0) < 0) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 if (parse_hexarg(argv[0], 8, &offset) < 0) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 printf("ERROR: offset argument must a valid 32-bit hex value\n"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 if (offset & 1) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 printf("ERROR: odd offset argument\n"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 flashptr = (volatile u16 *)(base_addr + offset); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 for (s = argv[1]; *s; flashptr++, s += 4) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 if (decode_hex_digits(s, 4, &datum) < 0) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 printf("ERROR: bad AMFW hex string argument\n"); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 if (*flashptr != 0xFFFF) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 printf("ERROR: flash not blank at %08X\n", |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 (u_long) flashptr); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 *(volatile u16 *)(base_addr + 0xAAA) = 0xAA; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 *(volatile u16 *)(base_addr + 0x554) = 0x55; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 *(volatile u16 *)(base_addr + 0xAAA) = 0xA0; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 *flashptr = datum; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 for (i = 10000; i; i--) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 if (*flashptr == datum) |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 break; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 if (!i) { |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 printf("ERROR: flash write timeout at %08X\n", |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 (u_long) flashptr); |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 return; |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 } |
e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 } |
659
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
91 |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
92 amdflash_binary_prog(offset, nwords, data) |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
93 u32 offset; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
94 unsigned nwords; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
95 u16 *data; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
96 { |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
97 volatile u16 *flashptr; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
98 int i; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
99 |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
100 flashptr = (volatile u16 *)(base_addr + offset); |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
101 while (nwords) { |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
102 if (*flashptr != 0xFFFF) { |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
103 serial_out(0x15); /* NAK */ |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
104 printf("ERROR: flash not blank at %08X\n", |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
105 (u_long) flashptr); |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
106 return(-1); |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
107 } |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
108 *(volatile u16 *)(base_addr + 0xAAA) = 0xAA; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
109 *(volatile u16 *)(base_addr + 0x554) = 0x55; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
110 *(volatile u16 *)(base_addr + 0xAAA) = 0xA0; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
111 *flashptr = *data; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
112 for (i = 10000; i; i--) |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
113 if (*flashptr == *data) |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
114 break; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
115 if (!i) { |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
116 serial_out(0x15); /* NAK */ |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
117 printf("ERROR: flash write timeout at %08X\n", |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
118 (u_long) flashptr); |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
119 return(-1); |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
120 } |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
121 flashptr++; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
122 data++; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
123 nwords--; |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
124 } |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
125 return(0); |
761e8b0c65b0
loadagent: first step in implementation of binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
658
diff
changeset
|
126 } |
660
b34384991094
loadagent: implemented binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
659
diff
changeset
|
127 |
b34384991094
loadagent: implemented binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
659
diff
changeset
|
128 void |
b34384991094
loadagent: implemented binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
659
diff
changeset
|
129 cmd_AMFWB() |
b34384991094
loadagent: implemented binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
659
diff
changeset
|
130 { |
b34384991094
loadagent: implemented binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
659
diff
changeset
|
131 binary_flash_prog_main(amdflash_binary_prog); |
b34384991094
loadagent: implemented binary flash programming
Mychaela Falconia <falcon@freecalypso.org>
parents:
659
diff
changeset
|
132 } |