/****************************************************************************/
/* Copyright 2010, © Bendor Research Pty. Ltd. All rights reserved.			*/
/* Permission is granted to use this software for any purpose whatsoever	*/
/* as long as this copyright notice is preserved. The code is provided		*/
/* "as is", with no explicit, implicit or implied warranty or guarantee		*/
/* of any kind and Bendor Research Pty. Ltd. can not be held liable for		*/
/* any loss or damages arising out of the use of this software.				*/
/****************************************************************************/
/*																			*/
/*	Include file describing the NXP LPC210x in-application programming		*/
/*	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~		*/
/*																			*/
/*	2011 Jan	ZK		Generated from the LPC23xx version					*/
/*																			*/
/****************************************************************************/

#ifndef LPC210X_IAP
#define	LPC210X_IAP

/*
*	This function is the IAP entry
*	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*	It receives two arrays of longs. The first one contains the command
*	and the parameters. The second one will contain the results (if any).
*/

#define	IAP(a,b)	(*((void(*)(unsigned long*,unsigned long*))0x7ffffff1))(a,b)

/*
*	These are the command codes
*/

#define	IAP_CMD_PREPARE		50		/* Prepare for erase or write			*/
#define	IAP_CMD_WRITE		51		/* Copy RAM to FLASH					*/
#define	IAP_CMD_ERASE		52		/* Erase sectors						*/
#define	IAP_CMD_BLANK		53		/* Blank check sectors					*/
#define	IAP_CMD_PARTID		54		/* Read part ID number					*/
#define	IAP_CMD_BOOTVER		55		/* Read boot code version number		*/
#define	IAP_CMD_COMPARE		56		/* Compare areas						*/
#define	IAP_CMD_ISP			57		/* Reboot chip in ISP mode				*/

/*
*	These are the command result codes
*/

#define	IAP_RES_OK			0		/* Command succeeded					*/
#define	IAP_RES_COMMAND		1		/* Invalid command						*/
#define	IAP_RES_SRCWORD		2		/* Source address not word address		*/
#define	IAP_RES_DSTWORD		3		/* Destination address not word address	*/
#define	IAP_RES_SRCMAP		4		/* Source address not mapped			*/
#define	IAP_RES_DSTMAP		5		/* Destination address not mapped		*/
#define IAP_RES_COUNT		6		/* Incorrect count						*/
#define	IAP_RES_INVSEC		7		/* Invalid sector number				*/
#define IAP_RES_NBLANK		8		/* Sector is not blank					*/
#define IAP_RES_NPREP		9		/* Sector not prepared					*/
#define IAP_RES_COMPARE		10		/* Compare mismatch						*/
#define IAP_RES_BUSY		11		/* FLASH is busy						*/

#endif

