boot.cpp
资源名称:se06.rar [点击查看]
上传用户:kepeng103
上传日期:2022-07-27
资源大小:2653k
文件大小:1k
源码类别:
DSP编程
开发平台:
C/C++
- #include "..commonhal.h"
- #define TEXT_SIZE 0x00008000
- #define TEXT_RUN 0x00000400
- #define TEXT_LOAD 0x90000400
- extern "C" void c_int00(void);
- void pll_init(void);
- void emif_init(void);
- void text_copy(void);
- #pragma CODE_SECTION(".boot_code")
- extern "C" void boot(void)
- {
- CSR &= (~0x00000001);
- IER = 0;
- pll_init();
- emif_init();
- text_copy();
- c_int00();
- }
- #pragma CODE_SECTION(".boot_code")
- void pll_init(void)
- {
- REG32(PLL_PLLCSR) &= (~0x00000001);
- asm(" NOP 9");
- REG32(PLL_PLLCSR) |= 0x00000008;
- REG32(PLL_PLLDIV0) = 0x00008001;
- REG32(PLL_PLLM) = 0x00000014;
- asm(" NOP 9");
- REG32(PLL_OSCDIV1) = 0x00008000;
- asm(" NOP 9");
- REG32(PLL_PLLDIV1) = 0x00008000;
- asm(" NOP 9");
- REG32(PLL_PLLCSR) &= (~0x00000008);
- asm(" NOP 9");
- REG32(PLL_PLLCSR) |= 0x00000001;
- }
- #pragma CODE_SECTION(".boot_code")
- void emif_init(void)
- {
- REG32(EMIF_GBLCTL) = 0x00000078;
- REG32(EMIF_CECTL0) = 0x20A20292;
- REG32(EMIF_CECTL1) = 0xffffff17;
- REG32(EMIF_CECTL3) = 0xffffff17;
- REG32(EMIF_SDTIM) = 0x00000FFF;
- REG32(EMIF_SDEXT) = 0x000a8529;
- REG32(EMIF_SDCTL) = 0x53115000;
- }
- #pragma DATA_SECTION(".boot_data")
- static int i;
- #pragma CODE_SECTION(".boot_code")
- void text_copy(void)
- {
- for(i=0; i<TEXT_SIZE; i+=2) {
- REG16(TEXT_RUN + i) = REG16(TEXT_LOAD + i);
- }
- }