📄 in_main.c
字号:
#ifndef _REFERENCE
//*-----------------------------------------------------------------------------
//* ATMEL Microcontroller Software Support - ROUSSET -
//*-----------------------------------------------------------------------------
//* File Name : in_main.c
//* Librarian : Not applicable
//* Translator : ARM Software Development Toolkit V2.11a
//*
//* Treatments : Get the top of SRAM on the AT91EB01
//*
//* Exported resources : InitMainSram - Main
//* Imported resources : InitResetStacks - MainApplication
//*
//* 1.0 04/09/98 JLV : Creation
//* 2.0 21/10/98 JCZ : Clean up
//*-----------------------------------------------------------------------------
/*----- Called Macro instructions definition -----*/
/* None */
/*----- Files to be included Definition -----*/
#include "../../Include/std_c.h"
#include "../../Include/ebi.h"
/*----- Types and Constants Definition -----*/
/* None */
/*----- Imported Resources Definition -----*/
#define _REFERENCE(x) extern x;
extern void InitResetStacks( void );
extern int MainApplication( void );
#undef _REFERENCE
/*---- Internal Resources Definition -----*/
/* None */
/*---- External Resources Definition -----*/
#define _REFERENCE(x) x
#define CORPS
#endif
#ifndef AT91_DEBUG_NONE
//*-----------------------------------------------------------------------------
//* Function Name : main
//* Object : Main function of the test "delay"
//* Input Parameters : none
//* Output Parameters :
//* Functions called : InitResetStacks - MainApplication
//*-----------------------------------------------------------------------------
int main ( void )
#ifdef CORPS
//* Begin
{
//* | Stack initialization
InitResetStacks();
//* | Application activation
return MainApplication();
//* End
}
#endif
#endif /* AT91_DEBUG_NONE */
#ifdef AT91EB01
//*-----------------------------------------------------------------------------
//* Function Name : InitMainSram
//* Object : Calculate and return the top of the SRAM
//* Input Parameters : None
//* Output Parameters :
//* . size (int) - size of the SRAM
//* Functions called : None
//*-----------------------------------------------------------------------------
_REFERENCE (int InitMainSram(void))
#ifdef CORPS
//* Begin
{
unsigned int offset;
int saved_byte;
int i,done;
int sram_offset;
//* -- Get SRAM base address and save first short in SRAM
int sram_base = (EBI_BASE->EBI_CSR[1] & 0xFFFF0000);
offset = 0;
done = FALSE;
while((offset < 0x7f0000) && (done == FALSE))
{
offset += 0x00010000;
done = TRUE;
sram_offset = sram_base + offset;
for(i=0;(i<8) && (done == TRUE);i++)
if (*(volatile int *)(sram_base + i) != *(volatile int *)(sram_offset + i))
done = FALSE;
saved_byte = *(volatile int *)(sram_base + offset);
*(volatile int *)(sram_base + offset) = 0x55aa55aa;
if (*(volatile int *)(sram_base + offset) != 0x55aa55aa)
done = TRUE;
*(volatile int *)(sram_base + offset) = saved_byte;
}
//* Return the size detected
return (sram_base + offset);
//* End
}/*InitMainSram*/
#endif
#endif /* AT91EB01 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -