|
1 /* |
|
2 ** This file is part of fsusb_picdem |
|
3 ** |
|
4 ** fsusb_picdem is free software; you can redistribute it and/or |
|
5 ** modify it under the terms of the GNU General Public License as |
|
6 ** published by the Free Software Foundation; either version 2 of the |
|
7 ** License, or (at your option) any later version. |
|
8 ** |
|
9 ** fsusb_picdem is distributed in the hope that it will be useful, but |
|
10 ** WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 ** General Public License for more details. |
|
13 ** |
|
14 ** You should have received a copy of the GNU General Public License |
|
15 ** along with fsusb_picdem; if not, write to the Free Software |
|
16 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
17 ** 02110-1301, USA |
|
18 */ |
|
19 |
|
20 #ifndef __MEMIMG_H__ |
|
21 #define __MEMIMG_H__ |
|
22 |
|
23 #include "rjlhex.h" |
|
24 /* |
|
25 * 18fx455 |
|
26 * |
|
27 * EEPROM: 0x00 - 0xff (special, currently unsupported) |
|
28 * |
|
29 * Program memory: 0x0000 - 0x5fff |
|
30 * |
|
31 * ID: 0x200000 - 0x200007 |
|
32 * |
|
33 * Config: 0x300000 - 0x30000d (byte-writable) |
|
34 * |
|
35 * Devid: 0x3ffffe - 0x3fffff (read-only) |
|
36 */ |
|
37 |
|
38 |
|
39 /* |
|
40 * 18fx550 (default) |
|
41 * |
|
42 * EEPROM: 0x00 - 0xff (special, currently unsupported) |
|
43 * |
|
44 * Program memory: 0x0000 - 0x7fff |
|
45 * |
|
46 * ID: 0x200000 - 0x200007 |
|
47 * |
|
48 * Config: 0x300000 - 0x30000d (byte-writable) |
|
49 * |
|
50 * Devid: 0x3ffffe - 0x3fffff (read-only) |
|
51 */ |
|
52 |
|
53 |
|
54 #ifndef DEV_18FX455 |
|
55 #define DEV_18FX550 |
|
56 #endif /* DEV_18FX455 */ |
|
57 |
|
58 #define MI_EEPROM_BASE 0x00 |
|
59 #define MI_EEPROM_TOP 0xff |
|
60 |
|
61 #define MI_PROGRAM_BASE 0x0000 |
|
62 #ifdef DEV_18FX455 |
|
63 #define MI_PROGRAM_TOP 0x5fff |
|
64 #endif /* DEV_18FX455 */ |
|
65 #ifdef DEV_18FX550 |
|
66 #define MI_PROGRAM_TOP 0x7fff |
|
67 #endif /* DEV_18FX550 */ |
|
68 |
|
69 #define MI_ID_BASE 0x200000 |
|
70 #define MI_ID_TOP 0x200007 |
|
71 |
|
72 #define MI_CONFIG_BASE 0x300000 |
|
73 #define MI_CONFIG_TOP 0x30000d |
|
74 |
|
75 #define MI_DEVID_BASE 0x3ffffe |
|
76 #define MI_DEVID_TOP 0x3fffff |
|
77 |
|
78 |
|
79 |
|
80 typedef unsigned char mi_byte_t; |
|
81 |
|
82 |
|
83 |
|
84 typedef struct _mi_patch { |
|
85 unsigned long base; |
|
86 unsigned long top; |
|
87 mi_byte_t *contents; |
|
88 char *mask; |
|
89 } mi_patch; |
|
90 |
|
91 typedef struct _mi_image { |
|
92 mi_patch *program; |
|
93 mi_patch *id; |
|
94 mi_patch *config; |
|
95 mi_patch *devid; |
|
96 mi_patch *eeprom; |
|
97 } mi_image; |
|
98 |
|
99 |
|
100 |
|
101 mi_image *mi_load_hexfile(char *filename); |
|
102 |
|
103 #endif /* __MEMIMG_H__ */ |