tools/fsusb/memimg.h
changeset 2 2f55e5dd591d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/fsusb/memimg.h	Tue Jan 29 22:31:52 2008 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +/*
     1.5 +** This file is part of fsusb_picdem
     1.6 +**
     1.7 +** fsusb_picdem is free software; you can redistribute it and/or
     1.8 +** modify it under the terms of the GNU General Public License as
     1.9 +** published by the Free Software Foundation; either version 2 of the
    1.10 +** License, or (at your option) any later version.
    1.11 +**
    1.12 +** fsusb_picdem is distributed in the hope that it will be useful, but
    1.13 +** WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.15 +** General Public License for more details.
    1.16 +**
    1.17 +** You should have received a copy of the GNU General Public License
    1.18 +** along with fsusb_picdem; if not, write to the Free Software
    1.19 +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    1.20 +** 02110-1301, USA
    1.21 +*/
    1.22 +
    1.23 +#ifndef __MEMIMG_H__
    1.24 +#define __MEMIMG_H__
    1.25 +
    1.26 +#include "rjlhex.h"
    1.27 +/*
    1.28 + * 18fx455
    1.29 + *
    1.30 + * EEPROM: 0x00 - 0xff (special, currently unsupported)
    1.31 + *
    1.32 + * Program memory: 0x0000 - 0x5fff
    1.33 + *
    1.34 + * ID: 0x200000 - 0x200007
    1.35 + *
    1.36 + * Config: 0x300000 - 0x30000d (byte-writable)
    1.37 + *
    1.38 + * Devid: 0x3ffffe - 0x3fffff (read-only)
    1.39 + */
    1.40 +
    1.41 +
    1.42 +/*
    1.43 + * 18fx550 (default)
    1.44 + *
    1.45 + * EEPROM: 0x00 - 0xff (special, currently unsupported)
    1.46 + *
    1.47 + * Program memory: 0x0000 - 0x7fff
    1.48 + *
    1.49 + * ID: 0x200000 - 0x200007
    1.50 + *
    1.51 + * Config: 0x300000 - 0x30000d (byte-writable)
    1.52 + *
    1.53 + * Devid: 0x3ffffe - 0x3fffff (read-only)
    1.54 + */
    1.55 +
    1.56 +
    1.57 +#ifndef DEV_18FX455
    1.58 +#define DEV_18FX550
    1.59 +#endif /* DEV_18FX455 */
    1.60 +
    1.61 +#define MI_EEPROM_BASE      0x00
    1.62 +#define MI_EEPROM_TOP       0xff
    1.63 +
    1.64 +#define MI_PROGRAM_BASE   0x0000
    1.65 +#ifdef DEV_18FX455
    1.66 +#define MI_PROGRAM_TOP    0x5fff
    1.67 +#endif /* DEV_18FX455 */
    1.68 +#ifdef DEV_18FX550
    1.69 +#define MI_PROGRAM_TOP    0x7fff
    1.70 +#endif /* DEV_18FX550 */
    1.71 +
    1.72 +#define MI_ID_BASE      0x200000
    1.73 +#define MI_ID_TOP       0x200007
    1.74 +
    1.75 +#define MI_CONFIG_BASE  0x300000
    1.76 +#define MI_CONFIG_TOP   0x30000d
    1.77 +
    1.78 +#define MI_DEVID_BASE   0x3ffffe
    1.79 +#define MI_DEVID_TOP    0x3fffff
    1.80 +
    1.81 +
    1.82 +
    1.83 +typedef unsigned char mi_byte_t;
    1.84 +
    1.85 +
    1.86 +
    1.87 +typedef struct _mi_patch {
    1.88 +  unsigned long base;
    1.89 +  unsigned long top;
    1.90 +  mi_byte_t *contents;
    1.91 +  char *mask;
    1.92 +} mi_patch;
    1.93 +
    1.94 +typedef struct _mi_image {
    1.95 +  mi_patch *program;
    1.96 +  mi_patch *id;
    1.97 +  mi_patch *config;
    1.98 +  mi_patch *devid;
    1.99 +  mi_patch *eeprom;
   1.100 +} mi_image;
   1.101 +
   1.102 +
   1.103 +
   1.104 +mi_image *mi_load_hexfile(char *filename);
   1.105 +
   1.106 +#endif /* __MEMIMG_H__ */