drivers/ecos_lpc2138_sja1000/nvram_iap.h
author oremeq
Fri, 12 May 2006 22:14:03 +0200
changeset 3 d9cf34cd6823
permissions -rw-r--r--
ADDED LED to TESTMASTERSLAVE. It looks nice!
Some code for the NVRAM support
3
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     1
/*
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack.
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     3
                   canfestival@canopencanada.ca
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     4
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     5
See COPYING file for copyrights details.
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     6
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     7
This library is free software; you can redistribute it and/or
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     8
modify it under the terms of the GNU Lesser General Public
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     9
License as published by the Free Software Foundation; either
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    10
version 2.1 of the License, or (at your option) any later version.
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    11
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    12
This library is distributed in the hope that it will be useful,
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    13
but WITHOUT ANY WARRANTY; without even the implied warranty of
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    15
Lesser General Public License for more details.
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    16
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    17
You should have received a copy of the GNU Lesser General Public
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    18
License along with this library; if not, write to the Free Software
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    19
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    20
*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    21
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    22
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    23
/*                                                                    	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    24
/*	LPC2k_ee.H:  Header file enabling EEPROM support		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    25
/* 	for Philips LPC2000 microcontroller's on-chip Flash memory	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    26
/*     	(revision 1.0, May 13th, 2005.)					*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    27
/*                                                             		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    28
/*	This file is to be used with LPC2k_ee.c	file 		  	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    29
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    30
/* IMPORTANT: on-chip Flash memory sector(s) intended to be used as 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    31
/* an EEPROM will be unavailable for regular code storage! The smallest	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    32
/* amount of Flash memory that can be used as an EEPROM is a single 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    33
/* Flash sector (regardless of the Flash sector actual size). 		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    34
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    35
/* If size of desired EEPROM requires several Flash sectors, these	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    36
/* sectors must be a consecutive ones.					*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    37
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    38
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    39
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    40
#define EE_SEC_L		1		//Flash sector where EEPROM begins (see UM for details)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    41
#define EE_SEC_H		3	  	//Flash sector where EEPROM ends (see UM for details)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    42
#define EE_ADDR_L		0x00001000	//Must match the EE_SEC_L Flash sector start address
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    43
#define EE_ADDR_H		0x00003FFF 	//Must match the EE_SEC_H Flash sector end address
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    44
#define EE_CCLK			60000		//system clock cclk expressed in kHz (5*12 MHz)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    45
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    46
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    47
/*                                                                    	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    48
/* ee_data structure can be defined differently from this example.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    49
/* The only requirement is to have _id field as it is defined here	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    50
/* since EE_REC_ID character is used to identify a record's presence	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    51
/* in the EEPROM memory.						*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    52
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    53
/* ====================================================================	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    54
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    55
/* IMPORTANT ARM memory access considerations:				*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    56
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    57
/* char	: byte alligned. Can be accessed at any location in memory.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    58
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    59
/* short int: occupies 2 consecutive bytes. It can be read/write 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    60
/*	  accessed only when half-word alligned. Therefore, it is	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    61
/* 	  located at addresses ending with 0x0, 0x2, 0x4, 0x6, 0x8,	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    62
/*	  0xA, 0xC or 0xE.						*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    63
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    64
/* int	: occupies 4 consecutive bytes.	It can be read/write 		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    65
/*	  accessed only when half-word alligned. Therefore, it is	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    66
/* 	  located at addresses ending with 0x0, 0x4, 0x8 or 0xC.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    67
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    68
/* ====================================================================	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    69
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    70
/* Due to the LPC2000 Flash memory characteristics, an ee_data 		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    71
/* structure size (EE_REC_SIZE) is limited to the following set:	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    72
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    73
/* LPC2101/2/3, LPC2131/2/4/6/8, LPC2141/2/4/6/8: 0x10, 0x20, 0x40,     */ 
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    74
/*                                                0x80 or 0x100         */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    75
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    76
/* LPC2104/5/6, LPC2112/4/9, LPC2124/9, LPC2192/4: 0x10, 0x20, 0x40,    */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    77
/*                                                 0x80, 0x100 or 0x200 */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    78
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    79
/* ====================================================================	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    80
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    81
/* example1:                                                          	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    82
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    83
/* struct ee_data{		//structure starts as word alligned	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    84
/*	unsigned char	_id;	//1 byte  - no allignement restr.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    85
/*                                  // 	    3 BYTE GAP!!!!         	*/		
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    86
/*	unsigned int	_rec_count; //4 bytes - must be word alligned!	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    87
/*	unsigned char	_cs;	//1 byte  - no allignement restr.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    88
/*};				// next structure will start as		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    89
/*                                  // word alligned...                 */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    90
/* Structure in example 1 occupies 12 bytes of memory			*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    91
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    92
/* --------------------------------------------------------------------	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    93
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    94
/* example2:                                                          	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    95
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    96
/* struct ee_data{		//structure starts as word alligned	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    97
/*	unsigned char	_id;	//1 byte  - no allignement restr.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    98
/*	unsigned char	_cs;	//1 byte  - no allignement restr.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    99
/*                              //  	    2 BYTE GAP!!!!         	*/		
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   100
/*	unsigned int	_rec_count; //4 bytes - must be word alligned!	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   101
/*};				// next structure will start as		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   102
/*                                  // word alligned...                 */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   103
/* Structure in example 2 occupies 8 bytes of memory			*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   104
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   105
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   106
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   107
struct ee_data{
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   108
	unsigned char	_id;		//  4 bytes: 1 byte (char) + 3 byte GAP!
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   109
	unsigned int	_rec_count;	//  4 bytes (int)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   110
	unsigned int	_counter;	//  4 bytes (int)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   111
	unsigned char	_cs;		//  4 bytes: 1 byte (char) + 3 byte GAP!
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   112
};					// 16 bytes total
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   113
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   114
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   115
/*									*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   116
/* 	Disclaimer: all observations presented in example1, example 2 and */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   117
/*	ee_data structure defined here are based on Keil's ARM compiler. */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   118
/*	If another compiler is used, memory usage would have to be 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   119
/*	re-examined and verified.					*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   120
/*									*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   121
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   122
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   123
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   124
#define EE_REC_SIZE		0x10	//see restrictions from above
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   125
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   126
/********************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   127
/*									*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   128
/* 	Valid combinations for 						*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   129
/* EE_REC_SIZE, EE_BUFFER_SIZE, EE_BUFFER_MASK and EE_START_MASK	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   130
/*									*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   131
/* EE_BUFFER_SIZE ! EE_START_MASK ! EE_REC_SIZE ! EE_BUFFER_MASK	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   132
/* ----------------------------------------------------------------	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   133
/*    	256	0xFFFFFF00		0x010	  	0xF0		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   134
/*	256	0xFFFFFF00		0x020	 	0xE0		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   135
/*    	256	0xFFFFFF00		0x040	  	0xC0		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   136
/*	256	0xFFFFFF00		0x080	 	0x80		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   137
/*	256	0xFFFFFF00		0x100		0x00		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   138
/* ---------------------------------------------------------------- */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   139
/*    	512	0xFFFFFE00		0x010	  	0x1F0		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   140
/*	512	0xFFFFFE00		0x020	 	0x1E0		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   141
/*    	512	0xFFFFFE00		0x040	  	0x1C0		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   142
/*	512	0xFFFFFE00		0x080		0x180	 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   143
/*	512	0xFFFFFE00		0x100	 	0x100		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   144
/*	512	0xFFFFFE00		0x200	 	0x000		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   145
/********************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   146
/*	For LPC2101/2/3, LPC213x and LPC214x EE_BUFFER_SIZE is 256. */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   147
/*	For all other LPC2000 devices EE_BUFFER_SIZE is always 512. */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   148
/********************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   149
#define EE_BUFFER_SIZE	256
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   150
#define EE_START_MASK	0xFFFFFF00
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   151
#define EE_BUFFER_MASK	0x000000F0
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   152
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   153
/********************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   154
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   155
/*!!								  !!*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   156
/*!!								  !!*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   157
/*!! 	DO NOT MODIFY THE FOLLOWING CODE!!!			  !!*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   158
/*!!	===================================			  !!*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   159
/*!!								  !!*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   160
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   161
/********************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   162
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   163
#define EE_REC_ID 				0xAA
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   164
#define EE_SIZE					(EE_ADDR_H+1-EE_ADDR_L)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   165
#define NO_RECORDS_AVAILABLE	500
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   166
#define NO_SPACE_IN_EEPROM		501
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   167
#define INDEX_OUT_OF_RANGE		502
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   168
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   169
#ifndef _EEPROM_
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   170
	extern const unsigned char eeprom[];
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   171
	extern void ee_erase(unsigned int , unsigned int []);	//function erases EEPROM
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   172
	extern void ee_write(unsigned int , unsigned int []);	//function adds a record in EEPROM
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   173
	extern void ee_read (unsigned int , unsigned int []);	//function reads the latest valid record in EEPROM
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   174
	extern void ee_readn(unsigned int , unsigned int []);	//function reads n-th record in EEPROM
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   175
	extern void ee_count(unsigned int , unsigned int []);	//function counts records in EEPROM
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   176
#endif