memory.c

Go to the documentation of this file.
00001 /*This file is prepared for Doxygen automatic documentation generation.*/
00012 
00013 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
00014  *
00015  * Redistribution and use in source and binary forms, with or without
00016  * modification, are permitted provided that the following conditions are met:
00017  *
00018  * 1. Redistributions of source code must retain the above copyright notice,
00019  * this list of conditions and the following disclaimer.
00020  *
00021  * 2. Redistributions in binary form must reproduce the above copyright notice,
00022  * this list of conditions and the following disclaimer in the documentation
00023  * and/or other materials provided with the distribution.
00024  *
00025  * 3. The name of Atmel may not be used to endorse or promote products derived
00026  * from this software without specific prior written permission.
00027  *
00028  * 4. This software may only be redistributed and used in connection with an Atmel
00029  * AVR product.
00030  *
00031  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
00032  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00033  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
00034  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00035  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00036  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00037  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00038  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00039  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00040  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00041  */
00042 
00043 //_____  I N C L U D E S ___________________________________________________
00044 
00045 #include "config.h"
00046 #include "memory.h"
00047 
00048 //_____ M A C R O S ________________________________________________________
00049 
00050 
00051 
00052 //_____ D E F I N I T I O N S ______________________________________________
00053 
00054 
00055 
00056 //_____ D E C L A R A T I O N S ____________________________________________
00057 
00058 void  code2data       ( U8 _CONST_TYPE_    *src  , U8 _MEM_TYPE_SLOW_ *dest  , U8 nb_data )
00059 {
00060    U8 _CONST_TYPE_ *ptr_code=src;
00061    U8 *ptr_ram=dest;
00062    U8 i=nb_data;
00063    do
00064    {
00065       *ptr_ram=*ptr_code;
00066       ptr_ram++;
00067       ptr_code++;
00068       i--;
00069    } while(i);
00070 }
00071 
00072 int memcmp_code( U8 * ram, U8 _CONST_TYPE_    *rom, U16 n)
00073 {
00074    U16 i;
00075    
00076    for(i=0;i<n;i++)
00077    {
00078       if(ram[i]!=rom[i])
00079       {
00080          return -1;
00081       }
00082    }
00083    return 0;
00084 }

Generated on Wed Sep 23 09:17:02 2009 for ATMEL by  doxygen 1.5.3