⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 relocate.c

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 C
字号:
//*-----------------------------------------------------------------------------
//*      ATMEL Microcontroller Software Support  -  ROUSSET  -
//*-----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*-----------------------------------------------------------------------------
//* File Name           : relocate.c
//* Object              : Relocation functions.
//*
//* 1.0 01/04/00 JCZ    : Creation
//*-----------------------------------------------------------------------------

#include    "periph/stdc/std_c.h"

//*-----------------------------------------------------------------------------
//* Function Name           : relocate
//* Object                  : RAM test function
//* Input Parameters        : base = fisrt address to test
//*                         : size = memory size to test
//* Output Parameters       : none
//* Functions called        :
//*-----------------------------------------------------------------------------
u_short *relocate ( u_short *base, u_short *dest, u_int size )
//* Begin
{
    u_int           count ;
    u_short         *src ;
    u_short         *save_dest ;

    if (( (u_int)base & 0x1 ) != 0 )
    {
        src = (u_short *) ((u_int)base & ~0x1 );
        save_dest = (u_short *)((u_int)dest | 0x1) ;
    }
    else
    {
        src = base ;
        save_dest = dest ;
    }

    for ( count = 0 ; count < (size/2) ; count ++ )
    {
        *dest ++ = *src ++; 
    }
    return ( save_dest ) ;

//* End
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -