//-----------------------------------------------------------------------------
// ATMEL Microcontroller Software Support - ROUSSET -
//-----------------------------------------------------------------------------
// DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
// DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//*----------------------------------------------------------------------------
//* File Name : Cstartup_SAM9.c
//* Object : Low level initializations written in C for IAR
//* tools
//* Creation : 12/Jun/04
//* 1.2 28/Feb/05 JPP : LIB change AT91C_WDTC_WDDIS & PLL
//*----------------------------------------------------------------------------
// Include the board file description
#include "project.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_TestRemap
//* \brief This function test if the SRAM is remapped to zero
//* \return value:
//* 0 : Remap done
//* 1 : Remap not Done
//*----------------------------------------------------------------------------
unsigned int AT91F_TestRemap()
{
volatile unsigned int *pSram = (unsigned int *)0;
unsigned int val, data_test;
val = *pSram;
(val != 0xAA55AA55)?(data_test=0xAA55AA55):(data_test=0x55AA55AA);
*pSram = data_test;
(*pSram == data_test)?(data_test = 0):(data_test=1);
*pSram = val;
return data_test;
}
//*---------------------------------------------------------------------------*/
//* Function Name : AT91F_SetPLL
//* Object : Set the PLLA to 200 and Master clock to 100 Mhz
//*---------------------------------------------------------------------------*/
static void AT91F_SetPLL(void)
{
AT91PS_PMC pPmc = AT91C_BASE_PMC;
///////////////////////////////////////////////////////////////////////////
// Init PMC Step 1. Enable Main Oscillator
// Main Oscillator startup time is board specific:
// Main Oscillator Startup Time worst case (18MHz) corresponds to 1,4ms
// (0x08 for AT91C_CKGR_OSCOUNT field)
///////////////////////////////////////////////////////////////////////////
pPmc->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x8 <<8) | AT91C_CKGR_MOSCEN ));
// Wait Main Oscillator stabilization
while(!(pPmc->PMC_SR & AT91C_PMC_MOSCS));
// Switch to main ocilator
AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_CSS_MAIN_CLK;
///////////////////////////////////////////////////////////////////////////
// Init PMC Step 2.
// Set PLL to 96MHz (96,109MHz) and UDP Clock to 48MHz
// PLL Startup time depends on PLL RC filter: worst case is choosen
// UDP Clock (48,058MHz) is compliant with the Universal Serial Bus
// Specification (+/- 0.25% for full speed)
/* -Setup the PLL A */
AT91C_BASE_CKGR->CKGR_PLLAR = (AT91C_CKGR_SRCA) |
((172 << 16) & AT91C_CKGR_MULA) |
(AT91C_CKGR_PLLACOUNT) |
(AT91C_CKGR_OUTA_2) |
(16);
while (!(pPmc->PMC_SR & AT91C_PMC_LOCKA));
// Wait until the master clock is established for the case we already
// turn on the PLL
///////////////////////////////////////////////////////////////////////////
// Init PMC Step 3.
// Selection of Master Clock MCK equal to (Processor Clock PCK) PLL/2=48MHz
///////////////////////////////////////////////////////////////////////////
AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_CSS_PLLA_CLK | AT91C_PMC_PRES_CLK | AT91C_PMC_MDIV_2;;
// Wait until the master clock is established
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) );
}
//*----------------------------------------------------------------------------
//* \fn AT91F_LowLevelInit
//* \brief This function performs very low level HW initialization
//*----------------------------------------------------------------------------
void AT91F_LowLevelInit(void)
{
unsigned int i;
AT91C_BASE_CCFG->CCFG_EBICSA |= 0x1003A;
if (AT91F_TestRemap())
AT91F_MATRIX_Remap_ARM (AT91C_BASE_MATRIX);
///////////////////////////////////////////////////////////////////////////
// PLL setting
///////////////////////////////////////////////////////////////////////////
// AT91F_SetPLL();
///////////////////////////////////////////////////////////////////////////
// Disable Watchdog (write once register)
///////////////////////////////////////////////////////////////////////////
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
///////////////////////////////////////////////////////////////////////////
// Init AIC: assign corresponding handler for each interrupt source
///////////////////////////////////////////////////////////////////////////
AT91C_BASE_AIC->AIC_SVR[0] = (int) AT91F_Default_FIQ_handler ;
for (i = 1; i < 31; i++) {
AT91C_BASE_AIC->AIC_SVR[i] = (int) AT91F_Default_IRQ_handler ;
}
AT91C_BASE_AIC->AIC_SPU = (unsigned int) AT91F_Spurious_handler;
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
adc.rar_9260_at9260 (120个子文件)
Basic.cspy.bat 2KB
Cstartup_SAM9.c 6KB
main.c 6KB
ADC RUN main.c 6KB
dbgu.c 5KB
原 main.c 5KB
interrupt_timer.c 5KB
interrupt_Usart.c 5KB
led.c 4KB
ext_irq.c 2KB
at91cdrom.css 7KB
Basic.d79 139KB
Basic.dbgdt 6KB
ioat91sam9260.ddf 210KB
Basic.dep 7KB
Basic.dni 519B
Basic.ewd 15KB
Basic.ewp 23KB
StartupScreen.ewsample 0B
basic.eww 159B
ioat91sam9260.h 447KB
AT91SAM9260.h 260KB
AT91SAM9260_inc.h 229KB
lib_AT91SAM9260.h 175KB
at91sam9260_smc.h 27KB
at91sam9260_usart.h 18KB
at91sam9260_tc.h 18KB
at91sam9260_sys.h 17KB
at91sam9260_sdramc.h 17KB
at91sam9260_mci.h 17KB
at91sam9260_matrix.h 16KB
at91sam9260_emac.h 16KB
at91sam9260_ssc.h 15KB
at91sam9260_adc.h 15KB
at91sam9260_pmc.h 14KB
at91sam9260_isi.h 13KB
at91sam9260_spi.h 11KB
at91sam9260_udp.h 11KB
at91sam9260_dbgu.h 10KB
at91sam9260_twi.h 7KB
at91sam9260_aic.h 6KB
at91sam9260_ckgr.h 6KB
at91sam9260_pio.h 5KB
at91sam9260_shdwc.h 5KB
at91sam9260_pdc.h 5KB
at91sam9260_rstc.h 4KB
at91sam9260_ccfg.h 4KB
at91sam9260_tcb.h 4KB
at91sam9260_uhp.h 4KB
AT91SAM9260-EK.h 4KB
at91sam9260_wdtc.h 4KB
at91sam9260_ebi.h 4KB
at91sam9260_ecc.h 4KB
at91sam9260_pitc.h 4KB
at91sam9260_rttc.h 4KB
dbgu.h 2KB
led.h 2KB
project.h 2KB
project.h 2KB
AT91SAM9260_h.html 731KB
lib_AT91SAM9260_h.html 389KB
AT91SAM9260_search.html 307KB
AT91SAM9260_SMC.html 108KB
AT91SAM9260_USART.html 99KB
AT91SAM9260_EMAC.html 80KB
AT91SAM9260_TC.html 76KB
AT91SAM9260_UDP.html 64KB
AT91SAM9260_MCI.html 63KB
AT91SAM9260_ADC.html 62KB
AT91SAM9260_SSC.html 61KB
AT91SAM9260_PMC.html 57KB
AT91SAM9260_SYS.html 56KB
AT91SAM9260_SPI.html 55KB
AT91SAM9260_ISI.html 49KB
AT91SAM9260_MATRIX.html 49KB
AT91SAM9260_SDRAMC.html 48KB
AT91SAM9260_DBGU.html 43KB
AT91SAM9260_PIO.html 38KB
AT91SAM9260_PDC.html 31KB
tools.html 27KB
AT91SAM9260_TWI.html 27KB
AT91SAM9260_AIC.html 23KB
basic.html 20KB
AT91SAM9260_UHP.html 15KB
AT91SAM9260_CKGR.html 13KB
AT91SAM9260_SHDWC.html 11KB
AT91SAM9260_RSTC.html 11KB
AT91SAM9260_CCFG.html 10KB
AT91SAM9260_CCR.html 10KB
AT91SAM9260_list.html 9KB
AT91SAM9260_PITC.html 9KB
AT91SAM9260_TCB.html 9KB
AT91SAM9260_WDTC.html 9KB
AT91SAM9260_RTTC.html 9KB
AT91SAM9260_ECC.html 9KB
AT91SAM9260_EBI.html 8KB
ReadMe.html 438B
AT91SAM9260_idx.html 394B
AT91_title.html 349B
AT91SAM9260.html 345B
共 120 条
- 1
- 2
APei
- 粉丝: 64
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0