at91sam9263-ek-sram.ini
上传用户:xukun0987
上传日期:2022-07-16
资源大小:216k
文件大小:5k
- // ----------------------------------------------------------------------------
- // ATMEL Microcontroller Software Support
- // ----------------------------------------------------------------------------
- // Copyright (c) 2008, Atmel Corporation
- //
- // All rights reserved.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are met:
- //
- // - Redistributions of source code must retain the above copyright notice,
- // this list of conditions and the disclaimer below.
- //
- // Atmel's name may not be used to endorse or promote products derived from
- // this software without specific prior written permission.
- //
- // 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 : at91sam9263-ek-sdram.ini
- // Object : Generic Macro File for KEIL
- //----------------------------------------------------------------------------
- //----------------------------------------------------------------------------
- // _MapRAMAt0()
- // Function description: Maps RAM at 0.
- //----------------------------------------------------------------------------
- DEFINE INT hold;
- FUNC void _MapRAMAt0(){
-
- printf ("Changing mapping: RAM mapped to 0");
- // Test and set Remap
- hold = _RDWORD(0x00000000);
- _WDWORD(0x00000000,0xAAAAAAAA);
- if(_RDWORD(0x00000000) != 0xAAAAAAAA)
- {
- _WDWORD(0xFFFFED00,0x03); // toggle remap bits
- }
- else
- {
- _WDWORD(0x00000000,hold);
- }
- }
- //----------------------------------------------------------------------------
- // _InitRSTC()
- // Function description
- // Initializes the RSTC (Reset controller).
- // This makes sense since the default is to not allow user resets, which makes it impossible to
- // apply a second RESET via J-Link
- //----------------------------------------------------------------------------
- FUNC void _InitRSTC() {
- _WDWORD(0xFFFFFD08,0xA5000001); // Allow user reset
- }
- //----------------------------------------------------------------------------
- //
- // _PllSetting()
- // Function description
- // Initializes the PMC.
- // 1. Enable the Main Oscillator
- // 2. Configure PLL
- // 3. Switch Master
- //----------------------------------------------------------------------------
- FUNC void __PllSetting()
- {
- if ((_RDWORD(0xFFFFFC30)&0x3) != 0 ) {
- // Disable all PMC interrupt ( $$ JPP)
- // AT91C_PMC_IDR ((AT91_REG *) 0xFFFFFC64) //(PMC) Interrupt Disable Register
- // pPmc->PMC_IDR = 0xFFFFFFFF;
- _WDWORD(0xFFFFFC64,0xFFFFFFFF);
- // AT91C_PMC_PCDR ((AT91_REG *) 0xFFFFFC14) //(PMC) Peripheral Clock Disable Register
- _WDWORD(0xFFFFFC14,0xFFFFFFFF);
- // Disable all clock only Processor clock is enabled.
- _WDWORD(0xFFFFFC04,0xFFFFFFFE);
- // AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) // (PMC) Master Clock Register
- _WDWORD(0xFFFFFC30,0x00000001);
- _sleep_(10);
- // write reset value to PLLA and PLLB
- // AT91C_PMC_PLLAR ((AT91_REG *) 0xFFFFFC28) // (PMC) PLL A Register
- _WDWORD(0xFFFFFC28,0x00003F00);
-
- // AT91C_PMC_PLLBR ((AT91_REG *) 0xFFFFFC2C) // (PMC) PLL B Register
- _WDWORD(0xFFFFFC2C,0x00003F00);
- _sleep_(10);
-
- printf ( "------------------------------- PLL Enable -----------------------------------------n");
- }
- else {
- printf( " ********* Core in SLOW CLOCK mode ********* n");
- }
- }
- //----------------------------------------------------------------------------
- //
- // __PllSetting100MHz()
- // Function description
- // Set core at 200 MHz and MCK at 100 MHz
- //----------------------------------------------------------------------------
- FUNC void __PllSetting100MHz()
- {
- printf( "------------------------------- PLL Set at 100 MHz ----------------------------------n");
- //* pPmc->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN ));
- _WDWORD(0xFFFFFC20,0x00004001);
- _sleep_(10);
- //* AT91C_BASE_CKGR->CKGR_PLLAR = (AT91C_CKGR_SRCA | ((72 << 16) & AT91C_CKGR_MULA) |
- // (AT91C_CKGR_PLLACOUNT | (AT91C_CKGR_OUTA_0 | (7);
- _WDWORD(0xFFFFFC28,0x2048BF07);
- _sleep_(10);
- //* AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_CSS_PLLA_CLK | AT91C_PMC_PRES_CLK | AT91C_PMC_MDIV_2;;
- _WDWORD(0xFFFFFC30,0x00000102);
- _sleep_(10);
-
- }
- __PllSetting(); //* Init PLL
- __PllSetting100MHz();
- _MapRAMAt0(); //* Set the RAM memory at 0x0020 0000 & 0x0000 0000
- _InitRSTC();
- LOAD at91sam9263-sram\at91sam9263-sram.axf INCREMENTAL
- PC = 0x300000
- g,main;