scatter_load.c

来自「三星S3C2460 USB DEVICE /USB HOST 监控代码」· C语言 代码 · 共 40 行

C
40
字号

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include "type.h"
#include "Option.h"
#include "2460slib.h"

//===================================================================
#if (USE_SCATTER_LOAD==1)
void ScatterMemcpy (volatile uint32* d, volatile uint32* s, uint32 l)
{
  volatile uint32 i;

  for (i=0,l/=4 ; i<l ; i++)
    d[i] = s[i];
}

void ScatterMemset (volatile uint32* d, uint32 v, uint32 l)
{
  volatile uint32 i;

  for (i=0,l/=4 ; i<l ; i++)
    d[i] = v;
}

void ScatterLoad (void)
{
  extern uint32 Load$$DRAM$$Base, Image$$DRAM$$Base, Image$$DRAM$$Length, Image$$DRAM$$ZI$$Base, Image$$DRAM$$ZI$$Length;
  
  if (&Load$$DRAM$$Base != &Image$$DRAM$$Base)
    ScatterMemcpy(&Image$$DRAM$$Base, &Load$$DRAM$$Base, (uint32)&Image$$DRAM$$Length);
  if ((uint32)&Image$$DRAM$$ZI$$Length != 0)
    ScatterMemset(&Image$$DRAM$$ZI$$Base, 0, (uint32)&Image$$DRAM$$ZI$$Length);
    
  return;
}
#endif

⌨️ 快捷键说明

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