📄 test1.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include <c6x.h>
#define EMIF_GCR 0x1800000 /* Address of EMIF global control */
#define EMIF_CE0 0x1800008 /* Address of EMIF CE0 control */
#define EMIF_CE1 0x1800004 /* Address of EMIF CE1 control */
#define EMIF_CE2 0x1800010 /* Address of EMIF CE2 control */
#define EMIF_CE3 0x1800014 /* Address of EMIF CE3 control */
#define EMIF_SDCTRL 0x1800018 /* Address of EMIF SDRAM control */
#define EMIF_SDRP 0x180001c /* Address of EMIF SDRM refresh period */
#define EMIF_SDEXT 0x1800020 /* Address of EMIF SDRAM extension */
#define ADADDR 0x3380000 /* Address of AD */
/*
* ======== main ========
*/
void main()
{
int i;
int b0,b1,b2;
b0=0;
b1=0;
b2=0x0fffff000;
puts("Initializing the DSP! Please waiting ....\n");
/* DSP initialization */
CSR=0x100; /* Disable all interrupts */
IER=1; /* Disable all interrupts except NMI */
ICR=0xffff; /* Clear all pending interrupts */
*(unsigned volatile int *)EMIF_GCR = 0x33E9; /* EMIF global control */
*(unsigned volatile int *)EMIF_CE0 = 0x40; /* EMIF CE0 control, 32bit */
*(unsigned volatile int *)EMIF_CE1 = 0x0B300A21; /* EMIF CE1 control, 32bit */
*(unsigned volatile int *)EMIF_CE2 = 0x30; /* EMIF CE2 control, 32bit */
*(unsigned volatile int *)EMIF_CE3 = 0x0B300A21; /* EMIF CE3 control, 32bit */
*(unsigned volatile int *)EMIF_SDCTRL = 0x07238000; /* EMIF SDRAM control */
*(unsigned volatile int *)EMIF_SDRP = 0x410; /* EMIF SDRM refresh period */
*(unsigned volatile int *)ADADDR = 0x1F; /* ad start */
puts("A/D begin to start! Please waiting ....\n");
for(i=0;i<100;i++)
{
}
*(unsigned volatile int *)ADADDR = 0x0; /* ad stop */
/* write a string to stdout */
puts("A/D is stopped! Processing data please waiting ...\n");
while (b0<0x1000)
{
/*(unsigned volatile int *)(0x404000+b0)=*(unsigned volatile int *)(0x1400000+B0)>>16 & 0xFFF;*/
*(unsigned volatile int *)(0x400000+b0)=*(unsigned volatile int *)(0x1400000+b0) & 0xFFF;
/* *(unsigned volatile int *)(0x400000+b0)-=0x170;*/
b1=*(unsigned volatile int *)(0x400000+b0)& 0x800;
if(b1)
*(unsigned volatile int *)(0x400000+b0)|=b2;
/*(int *)(0x404000+B0)=*(int *)(0x1400000+B0)>>16 & 0xFFF;*/
b0=b0+4;
}
puts("Processing data is finished!\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -