DSP实验四(DSP的定时器)
程序员文章站
2022-03-13 19:21:11
...
DSP实验四(DSP的定时器)
-w
-stack 500
-sysstack 500
-l rts55x.lib
MEMORY
{
DARAM: o=0x100, l=0x07f00
VECT : o=0x0d000, l=0x100
DARAM2: o=0x0d100, l=0x1f00
SARAM: o=0x10000, l=0x30000
SDRAM: o=0x40000, l=0x3e0000
}
SECTIONS
{
.text: {} > DARAM
.vectors: {} > VECT
.trcinit: {} > DARAM
.gblinit: {} > DARAM
frt: {} > DARAM
.cinit: {} > DARAM
.pinit: {} > DARAM
.sysinit: {} > DARAM
.bss: {} > DARAM2
.far: {} > DARAM2
.const: {} > DARAM
.switch: {} > DARAM
.sysmem: {} > DARAM
.cio: {} > DARAM
.MEM$obj: {} > DARAM
.sysheap: {} > DARAM
.sysstack {} > DARAM
.stack: {} > DARAM
}
#include "myapp.h"
// 定义指示灯寄存器地址和寄存器类型
#define LBDS (*((unsigned int *)0x400001))
void INTR_init( void );
void TIMER_init(void);
int nCount;
main()
{
nCount=0;
PLL_Init(40);
SDRAM_init();
LBDS=0;
INTR_init();
TIMER_init();
while ( 1 )
{
}
}
void interrupt Timer()
{
nCount++; nCount%=16;
if ( nCount==0 )
LBDS^=1;
}
void INTR_init( void )
{
IVPD=0xd0;
IVPH=0xd0;
IER0=0x10;
DBIER0 =0x10;
IFR0=0xffff;
asm(" BCLR INTM");
}
void TIMER_init(void)
{
ioport unsigned int *tim0;
ioport unsigned int *prd0;
ioport unsigned int *tcr0;
ioport unsigned int *prsc0;
tim0 = (unsigned int *)0x1000;
prd0 = (unsigned int *)0x1001;
tcr0 = (unsigned int *)0x1002;
prsc0 = (unsigned int *)0x1003;
*tcr0 = 0x04f0;
*tim0 = 0;
*prd0 = 0xfffff;
*prsc0 = 2;
*tcr0 = 0x00e0;
}
;
; Copyright 2003 by Texas Instruments Incorporated.
; All rights reserved. Property of Texas Instruments Incorporated.
; Restricted rights to use, duplicate or disclose this code are
; granted through contract.
;
;
; "@(#) DSP/BIOS 4.90.270 06-11-03 (barracuda-m10)"
;
; ======== vectors.asm ========
; Plug in the entry point at RESET in the interrupt vector table
;
.sect ".vectors"
.ref _c_int00 ; C entry point
.if (.MNEMONIC)
rsv: ; reset vector
B _c_int00 ; branch to C entry point
NOP
.align 8
nmi:
.loop 8
nop
.endloop
int0:
.loop 8
nop
.endloop
int2:
.loop 8
nop
.endloop
.ref _Timer
tint:
B _Timer
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
b $
nop
.align 8
.else
rsv: ; reset vector
goto _c_int00 ; branch to C entry point
NOP
.align 8
.endif