📄 init_code.asm
字号:
/********************************************************************/
/* This file contains 3 sections: */
/* */
/* 1) A Pre-Init Section - this section saves off all the */
/* registers of the DSP. */
/* */
/* 2) A Init Code Section - this section is the customer */
/* initialization code which can be modified by the customer. */
/* As an example, an SDRAM initialization code is supplied. */
/* */
/* 3) A Post-Init Section - this section restores all the */
/* register from the stack. */
/* */
/* Customers should not modify the Pre-Init and Post-Init Sections.*/
/* The Init Code Section can be modified for application use. */
/********************************************************************/
#include <defBF532.h>
.section program;
/*******Pre-Init Section*********************************************/
/*******DO NOT MODIFY************************************************/
[--SP] = ASTAT; //Save Regs onto stack
[--SP] = RETS;
[--SP] = (r7:0);
[--SP] = (p5:0);
[--SP] = I0;
[--SP] = I1;
[--SP] = I2;
[--SP] = I3;
[--SP] = B0;
[--SP] = B1;
[--SP] = B2;
[--SP] = B3;
[--SP] = M0;
[--SP] = M1;
[--SP] = M2;
[--SP] = M3;
[--SP] = L0;
[--SP] = L1;
[--SP] = L2;
[--SP] = L3;
/********************************************************************/
/*******Init Code Section********************************************/
/**Please insert Initialization code in this section************/
/*******SDRAM Setup************/
Setup_SDRAM:
P0.L = EBIU_SDRRC & 0xFFFF;
P0.H = (EBIU_SDRRC >> 16) & 0xFFFF; //SDRAM Refresh Rate Control Register
R0 = 0x0817(Z);
W[P0] = R0;
SSYNC;
P0.L = EBIU_SDBCTL & 0xFFFF;
P0.H = (EBIU_SDBCTL >> 16) & 0xFFFF; //SDRAM Memory Bank Control Register
R0 = 0x0013(Z);
[P0] = R0;
SSYNC;
P0.L = EBIU_SDGCTL & 0xFFFF;
P0.H = (EBIU_SDGCTL >> 16) & 0xFFFF; //SDRAM Memory Global Control Register
R0.L = 0x998D;
R0.H = 0x0091;
[P0] = R0;
SSYNC;
/******************************/
/********************************************************************/
/*******Post-Init Section********************************************/
/*******DO NOT MODIFY************************************************/
L3 = [SP++];
L2 = [SP++];
L1 = [SP++];
L0 = [SP++];
M3 = [SP++];
M2 = [SP++];
M1 = [SP++];
M0 = [SP++];
B3 = [SP++];
B2 = [SP++];
B1 = [SP++];
B0 = [SP++];
I3 = [SP++];
I2 = [SP++];
I1 = [SP++];
I0 = [SP++];
(p5:0) = [SP++]; //Restore Regs from Stack
(r7:0) = [SP++];
RETS = [SP++];
ASTAT = [SP++];
/********************************************************************/
END: RTS;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -