drivers/ecos_lpc2138_sja1000/nvram_iap.c
author etisserant
Thu, 18 May 2006 21:54:24 +0200
changeset 15 e930a0e817de
parent 3 d9cf34cd6823
child 18 2fc8aa46980b
permissions -rw-r--r--
Re-orginized led and nvram related code, for generic target.
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
                   canfestival@canopencanada.ca
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     3
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     4
See COPYING file for copyrights details.
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     5
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     6
This library is free software; you can redistribute it and/or
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     7
modify it under the terms of the GNU Lesser General Public
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     8
License as published by the Free Software Foundation; either
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
     9
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
    10
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    11
This library is distributed in the hope that it will be useful,
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    12
but WITHOUT ANY WARRANTY; without even the implied warranty of
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    14
Lesser General Public License for more details.
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    15
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    16
You should have received a copy of the GNU Lesser General Public
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    17
License along with this library; if not, write to the Free Software
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    18
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    19
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    20
flash.c
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    21
	save to / retrieve from  the non-volatile memory
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    22
	to be tested
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    23
	- can we write/read into an address without working with the whole page (256bytes)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    24
*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    25
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    26
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    27
#include <stdio.h>
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    28
#include <stdlib.h>
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
#include "applicfg.h"
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    31
#include "data.h"
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    32
#include "objdictdef.h"
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    33
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    34
#include "lpc2138_defs.h"                    /* LPC21xx definitions */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    35
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    36
#define IAP_LOCATION 			0x7ffffff1
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
// define a page of data of NVRAM_BLOCK_SIZE bytes
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    40
//
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    41
short data_len; /* 0 to NVRAM_BLOCK_SIZE bytes */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    42
short data_num_pages;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    43
unsigned int *data_page = NULL;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    44
unsigned int data_addr;
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
unsigned int *regs_page = NULL;
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
// local definitons
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    49
void ee_erase(unsigned int ,unsigned int[]);		//function erases EEPROM
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    50
void ee_write_page(unsigned int);	//function adds a record in EEPROM
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    51
void ee_read_page(unsigned int);	//function reads the latest valid record in EEPROM
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
typedef void (*IAP)(unsigned int [],unsigned int[]);
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    54
IAP iap_entry;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    55
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
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
/*                                                                    	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    60
/* function:								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    61
/*  void ee_erase(unsigned int command_ee,unsigned int result_ee[])	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    62
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    63
/* type: void                                                          	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    64
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    65
/* parameters: 								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    66
/* 	command_ee   - Not used.  	               			*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    67
/*  result_ee[0] - Returns a response to the last IAP command used.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    68
/*                 0 - EEPROM successfully erased.			*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    69
/*                 For all other response values, see microcontroller 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    70
/*		   User Manual, IAP Commands and Status Codes Summary.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    71
/*  result_ee[1] - Not used.                         			*/
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
/* version: 1.1 (01/27/2006)                                           	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    74
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    75
/* constants defined in LPC2k_ee.h used in this function:              	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    76
/*  EE_SEC_L 	 - microcontroller's Flash sector where EEPROM begins	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    77
/*  EE_SEC_H 	 - microcontroller's Flash sector where EEPROM ends	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    78
/*  EE_CCLK		 - microcontroller's system clock (cclk)        */
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
/* description:								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    81
/*  This function erases LPC2000 on-chip Flash sectors selected to act 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    82
/*  as an EEPROM. All Flash sectors between EE_SEC_L abd EE_SEC_H	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    83
/*  (including these sectors) will be erased using the In Application	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    84
/*  Programming (IAP) routines (see User Manual for more details). 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    85
/*  Also, this function disables all interrupts while erasing the       */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    86
/*  EEPROM. If this is not needed, three lines of the ee_erase          */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    87
/*  subroutine can simply be commented-out without affecting the        */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    88
/*  routine performance at all.                                         */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    89
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    90
/* revision history:                                                   	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    91
/* - Rev. 1.1 adds interrupt disable feature.				*/
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
void ee_erase(unsigned int command_ee,unsigned int result_ee[])
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
	unsigned int command_iap[5];
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    97
	unsigned int result_iap[3];
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    98
	unsigned long int enabled_interrupts;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
    99
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   100
	enabled_interrupts = VICIntEnable;  //disable all interrupts
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   101
	VICIntEnClr        = enabled_interrupts;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   102
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   103
	command_iap[0]=50;	// prepare sectors from EE_SEC_L to EE_SEC_H for erase
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   104
	command_iap[1]=EE_SEC_L;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   105
	command_iap[2]=EE_SEC_H;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   106
	iap_entry=(IAP) IAP_LOCATION;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   107
	iap_entry(command_iap,result_iap);
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   108
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   109
	command_iap[0]=52;	// erase sectors from EE_SEC_L to EE_SEC_H
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   110
	command_iap[1]=EE_SEC_L;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   111
	command_iap[2]=EE_SEC_H;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   112
	command_iap[3]=EE_CCLK;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   113
	iap_entry=(IAP) IAP_LOCATION;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   114
	iap_entry(command_iap,result_iap);
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
	command_iap[0]=53;	// blankcheck sectors from EE_SEC_L to EE_SEC_H
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   117
	command_iap[1]=EE_SEC_L;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   118
	command_iap[2]=EE_SEC_H;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   119
	iap_entry=(IAP) IAP_LOCATION;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   120
	iap_entry(command_iap,result_iap);
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
	VICIntEnable = enabled_interrupts;  //restore interrupt enable register
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
	result_ee[0]=result_iap[0];
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   125
	return;
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
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   129
/*                                                                    	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   130
/* function: 								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   131
/*  void ee_write(unsigned int command_ee,unsigned int result_ee[])	*/
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
/* type: void                                                          	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   134
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   135
/* parameters: 								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   136
/* 	command_ee   - An address of a content of ee_data type that has	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   137
/*                 to be programmed into EEPROM.                       	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   138
/*  result_ee[0] - Returns a response to the last IAP command used.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   139
/*                 0 - data successfully programmed in EEPROM.		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   140
/*               501 - no space in EEPROM to program data.             	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   141
/*                 For all other response values, see microcontroller 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   142
/*		   User Manual, IAP Commands and Status Codes Summary.	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   143
/*  result_ee[1] - Not used.                           			*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   144
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   145
/* version: 1.1 (01/27/2006)                                           	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   146
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   147
/* constants defined in LPC2k_ee.h used in this function:              	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   148
/*  EE_BUFFER_SIZE 	   - IAP buffer size; must be 256 or 512 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   149
/*  NO_SPACE_IN_EEPROM - EEPROM is full and no data can be programmed	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   150
/*  EE_BUFFER_MASK	   - parameter used for interfacing with IAP	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   151
/*  EE_REC_SIZE   	   - ee_data structure size in bytes        	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   152
/*  EE_SEC_L 	 	   - micro's Flash sector where EEPROM begins	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   153
/*  EE_SEC_H 	 	   - micro's Flash sector where EEPROM ends	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   154
/*  EE_CCLK		 	   - micro's system clock (cclk)       	*/
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
/* description:								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   157
/*  This function writes a single structure of ee_data type into the	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   158
/*  EEPROM using an In Application	Programming (IAP) routines (see */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   159
/*  User Manual for more details). command_ee contains an address of	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   160
/*  this structure. EEPROM is scanned for the last (if any) record 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   161
/*  identifier (EE_REC_ID), and a new record is added next to it.      	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   162
/*  Also, this function disables all interrupts while erasing the       */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   163
/*  EEPROM. If this is not needed, three lines of the ee_write          */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   164
/*  subroutine can simply be commented-out without affecting the        */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   165
/*  routine performance at all.                                         */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   166
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   167
/* revision history:                                                   	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   168
/* - Rev. 1.1 fixes a bug related to verifying a content written into	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   169
/*   the EEPROM. 1.0 was reporting missmatch even when there were no	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   170
/*   problems at all.							*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   171
/*   Rev. 1.1 adds interrupt disable feature.				*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   172
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   173
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   174
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   175
void ee_write_page(unsigned int addr)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   176
{
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   177
	unsigned long int enabled_interrupts;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   178
	// unsigned char ee_buffer[16];
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   179
	unsigned int command_iap[5], result_iap[3];
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   180
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   181
	enabled_interrupts = VICIntEnable;  //disable all interrupts
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   182
	VICIntEnClr        = enabled_interrupts;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   183
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   184
	iap_entry = (IAP) IAP_LOCATION;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   185
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   186
	// prepare sectors from EE_SEC_L to EE_SEC_H for erase
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   187
	command_iap[0] = 50;			
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   188
	command_iap[1] = EE_SEC_L;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   189
	command_iap[2] = EE_SEC_H;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   190
	iap_entry(command_iap, result_iap);
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   191
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   192
	// copy RAM to flash/eeprom
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   193
	command_iap[0] = 51;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   194
	command_iap[1] = (unsigned int) (addr & EE_START_MASK); // 256 kb boundary
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   195
	command_iap[2] = (unsigned int) (data_page);            // should be on a word boundary
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   196
	command_iap[3] = 256;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   197
	command_iap[4] = EE_CCLK;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   198
	iap_entry(command_iap, result_iap);
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   199
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   200
#if 0 
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   201
	// compare RAM and flash/eeprom
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   202
	command_iap[0] = 56;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   203
	command_iap[1] = (unsigned int) data;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   204
	command_iap[2] = addr;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   205
	command_iap[3] = dlen;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   206
	iap_entry(command_iap, result_iap);
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   207
#endif
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   208
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   209
	VICIntEnable = enabled_interrupts;  //restore interrupt enable register
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   210
}
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   211
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   212
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   213
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   214
/*                                                                    	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   215
/* function: 								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   216
/*  void ee_read(unsigned int command_ee,unsigned int result_ee[])	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   217
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   218
/* type: void                                                          	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   219
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   220
/* parameters: 								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   221
/* 	command_ee   - Not used.					*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   222
/*  result_ee[0] - Returns a response.					*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   223
/*                 0 - data successfully found in EEPROM.		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   224
/*               500 - no data/records available in EEPROM.		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   225
/*  result_ee[1] - an address of the last record of ee_data type	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   226
/*				   in EEPROM.  	              		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   227
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   228
/* version: 1.1 (01/27/2006)                                           	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   229
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   230
/* constants defined in LPC2k_ee.h used in this function:              	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   231
/*  NO_RECORDS_AVAILABLE - EEPROM is empty/no records identifiable	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   232
/*			   with a record identifier (EE_REC_ID) found	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   233
/*  EE_ADR_L 	    - micro's Flash address from where EEPROM begins	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   234
/*  EE_REC_SIZE    - size (in bytes) of a ee_data structure        	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   235
/*                                                                 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   236
/* description:								*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   237
/*  This function scans an EEPROM content looking for the last record 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   238
/*  that can be identified with a record identifier (EE_REC_ID). When 	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   239
/*  such data is found, its address is passed as result_ee[1].		*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   240
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   241
/* revision history:                                                   	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   242
/* - Rev. 1.0 had problems with accessing the last record in a fully	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   243
/*   occupied EEPROM. Rev. 1.1 fixes this.				*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   244
/*                                                                     	*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   245
/************************************************************************/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   246
void ee_read_page(unsigned int addr)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   247
{
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   248
	memcpy(data_page, (unsigned int *)addr, sizeof(unsigned int)*64);
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   249
}
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   250
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   251
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   252
//////////////////////////////////////////////////////////////////////////////////////////
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   253
//////////////////////////////////////////////////////////////////////////////////////////
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   254
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   255
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   256
/*
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   257
	CAN FESTIVAL interface functions
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   258
*/
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   259
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   260
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   261
int _get_data_len(int type)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   262
{
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   263
	int len = 0; /* number of bytes */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   264
	switch(type)
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   265
	{
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   266
		case  boolean:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   267
			len = 1;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   268
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   269
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   270
		case  int8:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   271
		case  uint8:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   272
			len = 1;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   273
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   274
		case  int16:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   275
		case  uint16:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   276
			len = 2;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   277
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   278
		case  int24:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   279
		case  uint24:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   280
			len = 3;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   281
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   282
		case  int32:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   283
		case  uint32:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   284
		case  real32:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   285
			len = 4;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   286
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   287
		case  int40:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   288
		case  uint40:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   289
			len = 5;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   290
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   291
		case  int48:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   292
		case  uint48:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   293
			len = 6;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   294
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   295
		case  int56:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   296
		case  uint56:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   297
			len = 7;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   298
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   299
		case  int64:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   300
		case  uint64:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   301
		case  real64:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   302
			len = 8;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   303
			break;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   304
#if 0
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   305
/* TO DO */
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   306
		case  visible_string:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   307
		case  octet_string:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   308
		case  unicode_string:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   309
		case  time_of_day:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   310
		case  time_difference:
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   311
#endif
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   312
	}
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   313
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   314
	return len;
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   315
}
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   316
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   317
d9cf34cd6823 ADDED LED to TESTMASTERSLAVE. It looks nice!
oremeq
parents:
diff changeset
   318