📄 cstartup_df9311.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 : Cstartup_DF9311.c
//* Object : Low level initializations written in C for Green Hills
//* tools
//* Creation : JPP 11/Nov/02
//*
//*----------------------------------------------------------------------------
// Include the board file description containing the EBI value
#include "../ucos_ii/includes.h"
// The following functions must be write in ARM mode this function called directly
// by exception vector
extern void AT91F_Spurious_handler(void);
extern void AT91F_Default_IRQ_handler(void);
extern void AT91F_Default_FIQ_handler(void);
//*----------------------------------------------------------------------------
//* \fn AT91F_LowLevelInit
//* \brief This function performs very low level HW initialization
//* this function can be use a Stack, depending the compilation
//* optimization mode
//* Input Parameters
//* <Vector> vector table Address determinate in Relative addressing
//* <InternalRam> Internal Address determinate in Relative addressing
//* Output Parameters
//* <EBI address>
//*----------------------------------------------------------------------------
at91_reg * AT91F_LowLevelInit( unsigned int * Vector, unsigned int * InternalRam)
{
int i;
//-----------------------------------------------------------------------------
// Speed up the Boot sequence
//---------------------------
// After reset, the number of wait states on chip select 0 is 8. All AT91
// Evaluation Boards fits fast flash memories, so that the number of wait
// states can be optimized to fast up the boot sequence.
//-----------------------------------------------------------------------------
// set sandart Wait State
EBI_CSR0 = EBI_CSR_0 ;
//-----------------------------------------------------------------------------
// Set up EBI value
//--------------------
// After reset, All EBI register are setted at the default value
// The new value will be effective only after the remap command
//-----------------------------------------------------------------------------
// Load System pEbi Base address and CSR0 Init Value
EBI_CSR1 = EBI_CSR_1 ;
EBI_CSR2 = EBI_CSR_2 ;
EBI_CSR3 = EBI_CSR_3 ;
EBI_CSR4 = EBI_CSR_4 ;
EBI_CSR5 = EBI_CSR_5 ;
EBI_CSR6 = EBI_CSR_6 ;
EBI_CSR7 = EBI_CSR_7 ;
// 6 memory regions, early read
EBI_MCR = 0x16 ;
//-----------------------------------------------------------------------------
// Reset the Interrupt Controller
//-------------------------------
// Normally, the code is executed only if a reset has been actually performed.
// So, the AIC initialization resumes at setting up the default vectors.
//-----------------------------------------------------------------------------
// Mask All interrupt
AIC_IDCR = 0xFFFFFFFF;
// Perform 8 End Of Interrupt Command to make sure AIC will not Lock out nIRQ
for (i=0;i < 8; i++)
{
AIC_EOICR = AIC_EOICR;
}
// Set up the default interrupts handler vectors
AIC_BASE->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ;
for (i=1;i < 31; i++)
{
AIC_BASE->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ;
}
AIC_SPU = (int) AT91F_Spurious_handler ;
//-----------------------------------------------------------------------------
// Setup Exception Vectors in Internal RAM before Remap
//-----------------------------------------------------
// That's important to perform this operation before Remap in order to guarantee
// that the core has valid vectors at any time during the remap operation.
// Note: There are only 5 offsets as the vectoring is used.
// Before Remap the internal RAM it's 0x300000
// After Remap the internal RAM it's 0x000000
// Remap it's already executed it's no possible to write to 0x300000.
//-----------------------------------------------------------------------------
// Copy the ARM exception vectors and indirect table
for (i=0;i < (8+5); i++ )
{
*InternalRam++=*Vector++;
}
return ( &EBI_RCR ) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -