--- /dev/null
+/******************************************************************************\r
+\r
+Project: Portable command line ISP for Philips LPC2000 family\r
+ and Analog Devices ADUC70xx\r
+\r
+Filename: lpcprog.h\r
+\r
+Compiler: Microsoft VC 6/7, GCC Cygwin, GCC Linux, GCC ARM ELF\r
+\r
+Author: Martin Maurer (Martin.Maurer@clibb.de)\r
+\r
+Copyright: (c) Martin Maurer 2003-2008, All rights reserved\r
+Portions Copyright (c) by Aeolus Development 2004 http://www.aeolusdevelopment.com\r
+\r
+ This file is part of lpc21isp.\r
+\r
+ lpc21isp is free software: you can redistribute it and/or modify\r
+ it under the terms of the GNU Lesser General Public License as published by\r
+ the Free Software Foundation, either version 3 of the License, or\r
+ any later version.\r
+\r
+ lpc21isp is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU Lesser General Public License for more details.\r
+\r
+ You should have received a copy of the GNU Lesser General Public License\r
+ and GNU General Public License along with lpc21isp.\r
+ If not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+/* LPC_RAMSTART, LPC_RAMBASE\r
+*\r
+* Used in PhilipsDownload() to decide whether to Flash code or just place in in RAM\r
+* (works for .hex files only)\r
+*\r
+* LPC_RAMSTART - the Physical start address of the SRAM\r
+* LPC_RAMBASE - the base address where downloading starts.\r
+* Note that any code in the .hex file that resides in 0x4000,0000 ~ 0x4000,0200\r
+* will _not_ be written to the LPCs SRAM.\r
+* This is due to the fact that 0x4000,0040 - 0x4000,0200 is used by the bootrom.\r
+* Any interrupt vectors must be copied to 0x4000,0000 and remapped to 0x0000,0000\r
+* by the startup code.\r
+*/\r
+#define LPC_RAMSTART 0x40000000L\r
+#define LPC_RAMBASE 0x40000200L\r
+\r
+/* Return values used by PhilipsDownload(): reserving all values from 0x1000 to 0x1FFF */\r
+\r
+#define NO_ANSWER_WDT 0x1000\r
+#define NO_ANSWER_QM 0x1001\r
+#define NO_ANSWER_SYNC 0x1002\r
+#define NO_ANSWER_OSC 0x1003\r
+#define NO_ANSWER_RBV 0x1004\r
+#define NO_ANSWER_RPID 0x1005\r
+#define ERROR_WRITE_DATA 0x1006\r
+#define ERROR_WRITE_CRC 0x1007\r
+#define ERROR_WRITE_CRC2 0x1008\r
+#define PROGRAM_TOO_LARGE 0x1009\r
+\r
+#define USER_ABORT_SYNC 0x100A /* User aborted synchronisation process */\r
+\r
+#define UNLOCK_ERROR 0x1100 /* return value is 0x1100 + philips ISP returned value (0 to 255) */\r
+#define WRONG_ANSWER_PREP 0x1200 /* return value is 0x1200 + philips ISP returned value (0 to 255) */\r
+#define WRONG_ANSWER_ERAS 0x1300 /* return value is 0x1300 + philips ISP returned value (0 to 255) */\r
+#define WRONG_ANSWER_WRIT 0x1400 /* return value is 0x1400 + philips ISP returned value (0 to 255) */\r
+#define WRONG_ANSWER_PREP2 0x1500 /* return value is 0x1500 + philips ISP returned value (0 to 255) */\r
+#define WRONG_ANSWER_COPY 0x1600 /* return value is 0x1600 + philips ISP returned value (0 to 255) */\r
+#define FAILED_RUN 0x1700 /* return value is 0x1700 + philips ISP returned value (0 to 255) */\r
+\r
+#ifndef WIN32\r
+#define LPC_BSL_PIN 13\r
+#define LPC_RESET_PIN 47\r
+#define LPC_RESET(in) NAsetGPIOpin(LPC_RESET_PIN, (in))\r
+#define LPC_BSL(in) NAsetGPIOpin(LPC_BSL_PIN, (in))\r
+#endif\r
+\r
+\r
+/* LPC_FLASHMASK\r
+*\r
+* LPC_FLASHMASK - bitmask to define the maximum size of the Filesize to download.\r
+* LoadFile() will check any new segment address record (03) or extended linear\r
+* address record (04) to see if the addressed 64 kByte data block still falls\r
+* in the max. flash size.\r
+* LoadFile() will not load any files that are larger than this size.\r
+*/\r
+#define LPC_FLASHMASK 0xFFC00000 /* 22 bits = 4 MB */\r
+\r
+typedef struct\r
+{\r
+ unsigned long id;\r
+ unsigned Product;\r
+ unsigned FlashSize; /* in kiB, for informational purposes only */\r
+ unsigned RAMSize; /* in kiB, for informational purposes only */\r
+ unsigned FlashSectors; /* total number of sectors */\r
+ unsigned MaxCopySize; /* maximum size that can be copied to Flash in a single command */\r
+ const unsigned int *SectorTable; /* pointer to a sector table with constant the sector sizes */\r
+} LPC_DEVICE_TYPE;\r
+\r
+int PhilipsDownload(ISP_ENVIRONMENT *IspEnvironment);\r