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

📄 in_main.c

📁 uC/OS 使用gcc进行开发的例子,可以参考一下
💻 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"
//*---------------
//* Standard types
//*---------------
typedef unsigned int        u_int   ;
typedef unsigned short      u_short ;
typedef unsigned char       u_char ;

//*--------------
//* AT91 Register
//*--------------
#define at91_reg            volatile u_int

//*---------------
//* Boolean values
//*---------------
#define TRUE                1
#define FALSE               0


//#include    "Include/ebi.h"
typedef struct
{
    at91_reg        EBI_CSR[8] ;        /* Chip Select Register */
    at91_reg        EBI_RCR ;           /* Remap Control Register */
    at91_reg        EBI_MCR ;           /* Memory Control Register */
} StructEBI ;
#define EBI_BASE            ((StructEBI *) 0xFFE00000)

/*----- Types and Constants Definition -----*/
/* None */

/*----- Imported Resources Definition -----*/

#define _REFERENCE(x)   extern x;
_REFERENCE (void InitResetStacks( void ))
_REFERENCE (int  MainApplication( void ))
#undef _REFERENCE

/*---- Internal Resources Definition -----*/
/* None */

/*---- External Resources Definition -----*/

#define _REFERENCE(x)   x
#define CORPS
//#endif

//#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
{
    int offset;

    //* -- Get SRAM base address and save first short in SRAM
    int sram_base = (EBI_BASE->EBI_CSR[1] & 0xFFFF0000);
    int save_offset0 = *(volatile int *)(sram_base);

    //* -- Fill SRAM (boundaries) until first long overwritten
    *(volatile int *)(sram_base) = -1;
    for (offset = 0x00010000 ;
            *(volatile int *)(sram_base) == -1 ;)
    {
        offset <<= 1;
        *(volatile int *)(sram_base + offset) = offset;
    }

    //* -- restore first short in SRAM
    *(volatile int *)(sram_base) = save_offset0;

    //* Return the size detected
    return (sram_base + offset);

//* End
}/*InitMainSram*/
#endif
//#endif /* AT91EB01 */

⌨️ 快捷键说明

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