📄 t0int.lst
字号:
ARM COMPILER V2.50a, T0Int 23/09/08 18:04:45 PAGE 1
ARM COMPILER V2.50a, COMPILATION OF MODULE T0Int
OBJECT MODULE PLACED IN .\Obj\T0Int.obj
COMPILER INVOKED BY: d:\Keil\ARM\BIN\CA.exe T0Int.c ARM OPTIMIZE(7,SPEED) BROWSE DEBUG PRINT(.\FLASH\T0INT.LST) TABS(4)
-OBJECT(.\Obj\T0Int.obj)
stmt level source
1 // Header: Main Interrupt Routine
2 // File Name: T0Int.c
3 // Author: Matthias Hertel
4 // Date: 21-Oct-2004
5
6 #include <LPC213x.H> /* LPC21xx definitions */
7 #include "modes.h"
8 #include "riffwave.h"
9
10 #define T0_RlFreq 1874 /* Timer 0 Reload Frequency in Peripheral Clocks */
11
12 /* Data for Record&Block handling */
13 #define FIRSTBLOCK 1 /* The 1st free block - application is in Block 0 */
14 //#define LASTBLOCK 7 /* The last block */
15 #define LASTBLOCK 2 /* The last block */
16 //#define BLOCKSIZE 0x10000L /* Size of each block - 64KB */
17 #define BLOCKSIZE 0x8000L /* Size of each block - 32KB */
18 #define SIZE_OF_BOOTLOADER 0x3000; /* Size of the Bootloader that is in the last flash Sector */
19
20 enum modes mode; /* Keeps the state that the player is in */
21
22 unsigned int timeval = 0; /* Global timer - overflows every 10 sec */
23 signed short *p_record; /* pointer to the wave sample */
24 unsigned int eot; /* end of track */
25 unsigned int blockindex; /* current Block */
26 extern signed int volume; /* Volume - Range: 0-1023; */
27
28 unsigned char print_info = 0; /* flag that instructs the main loop to print track information */
29
30 struct wav_hdr* p_wav_hdr; /* Wave file header */
31
32
33 /*
34 * Timer Counter 0 Interrupt executes in 8Khz frequency
35 */
36 void tc0 (void) __irq __ram {
37 1 int sample;
38 1
39 1 static unsigned short DA_val = 0;
40 1 static unsigned short DA_record = 0;
41 1 if (timeval++ >= 40000l){ /* 5 sec frames */
42 2 timeval =0;
43 2 mode = NEXT;
44 2 }
45 1 switch (mode) {
46 2 /* State: Playing */
47 2 case PLAY:
48 2 sample = *p_record++;
49 2 sample *= volume;
50 2 DA_val = ((sample >> 15) + 0x8000) & 0xFFFF;
51 2 //DA_val |= 0x10000; /* Bias */
52 2 DACR = DA_val;
53 2 if (p_record >= eot) {
54 3 IOCLR1 = 0x00FF0000; /* Turn off LEDs */
55 3 IOSET1 = (0x01 << 16) & 0xFF0000; /* Turn on LED */
56 3 mode = PAUSE; /* Next time the tc0 routine is entered, it playin
-g is paused */
57 3 }
ARM COMPILER V2.50a, T0Int 23/09/08 18:04:45 PAGE 2
58 2 break;
59 2 /* State: Pause - wait until interval counter overflows*/
60 2 case PAUSE:
61 2 if (timeval == 0)
62 2 mode = NEXT; /* After 10 seconds are up, switch to next record
-block */
63 2 break;
64 2 /* State: Next Track */
65 2 case NEXT:
66 2 if (blockindex < LASTBLOCK) { blockindex++; } else { blockindex = FIRSTBLOCK; } /* goto first block
- when last was played */
67 2 /* State: Previous Track */
68 2 case PREV:
69 2 if (mode != NEXT)
70 2 if (blockindex > FIRSTBLOCK) { blockindex--; } else { blockindex = LASTBLOCK; } /* goto last blo
-ck when first was played */
71 2
72 2 {
73 3 unsigned int blockaddress = (blockindex * BLOCKSIZE); /* calculate the
- absolute memory address of the block*/
74 3 p_wav_hdr = (void*) blockaddress; /* point the Wav
-e/RIFF structure to the new block */
75 3 p_record = (signed short*)(void*) blockaddress + 0x24; /* Set the sampl
-e pointer after the wave file header */
76 3
77 3 if (p_wav_hdr->length < BLOCKSIZE){
78 4 eot = (unsigned int)(blockaddress + p_wav_hdr->length); /* Get the end o
-f the file from either the header or */
79 4 } else {
80 4 eot = (unsigned int)(blockaddress + BLOCKSIZE) -1; /* set to the max
-imum (block boundary) */
81 4 }
82 3 if (blockindex == LASTBLOCK) /* don't play the
- content of the bootloader */
83 3 eot -= SIZE_OF_BOOTLOADER;
84 3 }
85 2
86 2 IOCLR1 = 0x00FF0000; /* Turn off LEDs */
87 2 IOSET1 = (0x01 << (blockindex + 16)) & 0xFF0000; /* Turn on LED */
88 2
89 2 print_info = 1; /* indicate that track information is pri
-nted in the main loop */
90 2 mode = PLAY; /* Next time the tc0 routine is entered,
-it starts playing */
91 2 break;
92 2 }
93 1 T0IR = 1; // Clear interrupt flag
94 1 VICVectAddr = 0; // Acknowledge Interrupt
95 1
96 1 }
97
98
99 /* Setup the Timer Counter 0 Interrupt */
100 void init_timer (void) {
101 1 T0MR0 = T0_RlFreq; // 0.125uSec = 1875-1 counts
102 1 T0MCR = 3; // Interrupt and Reset on MR0
103 1 T0TCR = 1; // Timer0 Enable
104 1 VICVectAddr0 = (unsigned long)tc0; // set interrupt vector in 0
105 1 VICVectCntl0 = 0x20 | 4; // use it for Timer 0 Interrupt
106 1 VICIntEnable = 0x00000010; // Enable Timer0 Interrupt
107 1 mode = NEXT;
108 1 blockindex = FIRSTBLOCK - 1l;
109 1 }
ARM COMPILER V2.50a, T0Int 23/09/08 18:04:45 PAGE 3
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN DATA (volume)
*** PUBLICS:
PUBLIC tc0?A
PUBLIC init_timer?A
PUBLIC mode
PUBLIC timeval
PUBLIC p_record
PUBLIC eot
PUBLIC blockindex
PUBLIC print_info
PUBLIC p_wav_hdr
*** DATA SEGMENT '?DT0?T0Int':
00000000 mode:
00000000 DS 4
00000004 timeval:
00000004 BEGIN_INIT
00000004 00000000 DD 0x0
00000008 END_INIT
00000008 p_record:
00000008 DS 4
0000000C eot:
0000000C DS 4
00000010 blockindex:
00000010 DS 4
00000014 p_wav_hdr:
00000014 DS 4
00000018 DA_val:
00000018 BEGIN_INIT
00000018 0000 DW 0x0
0000001A END_INIT
0000001A DA_record:
0000001A BEGIN_INIT
0000001A 0000 DW 0x0
0000001C END_INIT
0000001C print_info:
0000001C BEGIN_INIT
0000001C 00 DB 0x0
0000001D END_INIT
*** CODE SEGMENT '?PR?tc0?A?T0Int':
36: void tc0 (void) __irq __ram {
00000000 E92D001F STMDB R13!,{R0-R4}
00000004 ; SCOPE-START
41: if (timeval++ >= 40000l){ /* 5 sec frames */
00000004 E5101000 LDR R1,=timeval ; timeval
00000008 E5910000 LDR R0,[R1,#0x0] ; timeval
0000000C E2802001 ADD R2,R0,#0x0001
00000010 E5812000 STR R2,[R1,#0x0] ; timeval
00000014 E5101000 LDR R1,=0x9C40
00000018 E1500001 CMP R0,R1
0000001C 3A000005 BCC L_1 ; Targ=0x38
42: timeval =0;
00000020 E3A01000 MOV R1,#0x0
00000024 E5100000 LDR R0,=timeval ; timeval
00000028 E5801000 STR R1,[R0,#0x0] ; timeval
43: mode = NEXT;
0000002C E3A01002 MOV R1,#0x2
00000030 E5100000 LDR R0,=mode ; mode
00000034 E5801000 STR R1,[R0,#0x0] ; mode
44: }
ARM COMPILER V2.50a, T0Int 23/09/08 18:04:45 PAGE 4
00000038 L_1:
45: switch (mode) {
00000038 E5100000 LDR R0,=mode ; mode
0000003C E5900000 LDR R0,[R0,#0x0] ; mode
00000040 E3500001 CMP R0,#0x0001
00000044 0A00002D BEQ L_4 ; Targ=0x100
00000048 E3500002 CMP R0,#0x0002
0000004C 0A000033 BEQ L_5 ; Targ=0x120
00000050 E3500003 CMP R0,#0x0003
00000054 0A00003C BEQ L_6 ; Targ=0x14C
00000058 E3500000 CMP R0,#0x0000
0000005C 1A000078 BNE L_2 ; Targ=0x244
47: case PLAY:
00000060 L_3:
48: sample = *p_record++;
00000060 E5102000 LDR R2,=p_record ; p_record
00000064 E5921000 LDR R1,[R2,#0x0] ; p_record
00000068 E2813002 ADD R3,R1,#0x0002
0000006C E5823000 STR R3,[R2,#0x0] ; p_record
00000070 E1D110B0 LDRH R1,[R1,#0x0]
00000074 E1A01801 MOV R1,R1,LSL #16
00000078 E1A01841 MOV R1,R1,ASR #16
0000007C ---- Variable 'sample' assigned to Register 'R1' ----
49: sample *= volume;
0000007C E5102000 LDR R2,=volume ; volume
00000080 E5922000 LDR R2,[R2,#0x0] ; volume
00000084 E0010192 MUL R1,R2,R1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -