📄 main.lst
字号:
###############################################################################
# #
# 25/Apr/2009 00:50:16 #
# IAR ANSI C/C++ Compiler V5.20.0.20892/W32 EVALUATION for ARM #
# Copyright 1999-2008 IAR Systems AB. #
# #
# Cpu mode = arm #
# Endian = little #
# Source file = F:\Diplomovka\Atmel\getting-started-project-at91sam7x-ek #
# -iar\getting-started-project-at91sam7x-ek\at91sam7x-ek\g #
# etting-started-project\main.c #
# Command line = F:\Diplomovka\Atmel\getting-started-project-at91sam7x-ek #
# -iar\getting-started-project-at91sam7x-ek\at91sam7x-ek\g #
# etting-started-project\main.c -D at91sam7x128 -D flash #
# -D TRACE_LEVEL=4 -lC F:\Diplomovka\Atmel\getting-started #
# -project-at91sam7x-ek-iar\getting-started-project-at91sa #
# m7x-ek\at91sam7x-ek\getting-started-project\ewp\at91sam7 #
# x128_flash\List\ --remarks --diag_suppress Pe826,Pe1375 #
# -o F:\Diplomovka\Atmel\getting-started-project-at91sam7x #
# -ek-iar\getting-started-project-at91sam7x-ek\at91sam7x-e #
# k\getting-started-project\ewp\at91sam7x128_flash\Obj\ #
# --no_cse --no_unroll --no_inline --no_code_motion #
# --no_tbaa --no_clustering --no_scheduling --debug #
# --endian=little --cpu=ARM7TDMI -e --fpu=None #
# --dlib_config "C:\Program Files (x86)\IAR #
# Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\DLib_Config_Full.h" -I #
# F:\Diplomovka\Atmel\getting-started-project-at91sam7x-ek #
# -iar\getting-started-project-at91sam7x-ek\at91sam7x-ek\g #
# etting-started-project\ewp\..\..\..\at91lib/peripherals\ #
# -I F:\Diplomovka\Atmel\getting-started-project-at91sam7 #
# x-ek-iar\getting-started-project-at91sam7x-ek\at91sam7x- #
# ek\getting-started-project\ewp\..\..\..\at91lib\ -I #
# F:\Diplomovka\Atmel\getting-started-project-at91sam7x-ek #
# -iar\getting-started-project-at91sam7x-ek\at91sam7x-ek\g #
# etting-started-project\ewp\..\..\..\at91lib/components\ #
# -I F:\Diplomovka\Atmel\getting-started-project-at91sam7x #
# -ek-iar\getting-started-project-at91sam7x-ek\at91sam7x-e #
# k\getting-started-project\ewp\..\..\..\at91lib/boards/at #
# 91sam7x-ek\ -I "C:\Program Files (x86)\IAR #
# Systems\Embedded Workbench 5.0 Evaluation\ARM\INC\" #
# --interwork --cpu_mode arm -Oh #
# List file = F:\Diplomovka\Atmel\getting-started-project-at91sam7x-ek #
# -iar\getting-started-project-at91sam7x-ek\at91sam7x-ek\g #
# etting-started-project\ewp\at91sam7x128_flash\List\main. #
# lst #
# Object file = F:\Diplomovka\Atmel\getting-started-project-at91sam7x-ek #
# -iar\getting-started-project-at91sam7x-ek\at91sam7x-ek\g #
# etting-started-project\ewp\at91sam7x128_flash\Obj\main.o #
# #
# #
###############################################################################
F:\Diplomovka\Atmel\getting-started-project-at91sam7x-ek-iar\getting-started-project-at91sam7x-ek\at91sam7x-ek\getting-started-project\main.c
1 //------------------------------------------------------------------------------
2 // Headers
3 //------------------------------------------------------------------------------
4
5 #include <board.h>
6 #include <pio/pio.h>
7 #include <pio/pio_it.h>
8 #include <pit/pit.h>
9 #include <aic/aic.h>
10 #include <tc/tc.h>
11 #include <pwmc/pwmc.h>
12 #include <utility/led.h>
13 #include <utility/trace.h>
14
15 #include <stdio.h>
16
17 //------------------------------------------------------------------------------
18 // Local definitions
19 //------------------------------------------------------------------------------
20 #ifndef AT91C_ID_TC0
21 #if defined(AT91C_ID_TC012)
22 #define AT91C_ID_TC0 AT91C_ID_TC012
23 #elif defined(AT91C_ID_TC)
24 #define AT91C_ID_TC0 AT91C_ID_TC
25 #else
26 #error Pb define ID_TC
27 #endif
28 #endif
29
30 /// Delay for pushbutton debouncing (in milliseconds).
31 #define DEBOUNCE_TIME 500
32
33 /// PIT period value in 祍econds.
34 #define PIT_PERIOD 1000
35
36 /// PWM frequency in Hz.
37 #define PWM_FREQUENCY 20000
38
39 /// Maximum duty cycle value.
40 #define MAX_DUTY_CYCLE 50
41
42 /// Minimum duty cycle value (cannot be 0 or 1 for the SAM7S, c.f. errata)
43
44 #define MIN_DUTY_CYCLE 0
45
\ In section .bss, align 1
46 unsigned char StopSW = 0;
\ StopSW:
\ 00000000 DS8 1
47 //------------------------------------------------------------------------------
48 // Local variables
49 //------------------------------------------------------------------------------
50
51 /// Pushbutton \#1 pin instance.
\ In section .rodata, align 4
52 const Pin pinPB1 = PIN_PUSHBUTTON_1;
\ pinPB1:
\ 00000000 0000800000F4 DC32 8388608, 0FFFFF400H
\ FFFF
\ 00000008 02020300 DC8 2, 2, 3, 0
53
54 /// Pio pins to configure.
\ In section .rodata, align 4
55 static const Pin pins[] = {
\ pins:
\ 00000000 0000001800F4 DC32 402653184, 0FFFFF400H
\ FFFF
\ 00000008 02000000 DC8 2, 0, 0, 0
\ 0000000C 0000100000F6 DC32 1048576, 0FFFFF600H
\ FFFF
\ 00000014 03000000 DC8 3, 0, 0, 0
56 PINS_DBGU,
57 PIN_PWM_LED0
58 };
59
60
61 /// Global timestamp in milliseconds since start of application.
\ In section .bss, align 4
62 volatile unsigned int timestamp = 0;
\ timestamp:
\ 00000000 DS8 4
63
64 //------------------------------------------------------------------------------
65 // Local functions
66 //------------------------------------------------------------------------------
67 //------------------------------------------------------------------------------
68 /// Wait time in ms
69 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
70 void UTIL_Loop(unsigned int loop)
71 {
72 while(loop--);
73 }
\ UTIL_Loop:
\ 00000000 1EFF2FE1 BX LR ;; return
74
75
\ In section .text, align 4, keep-with-next
76 void UTIL_WaitTimeInMs(unsigned int mck, unsigned int time_ms)
77 {
78 register unsigned int i = 0;
79 i = (mck / 1000) * time_ms;
80 i = i / 3;
81 UTIL_Loop(i);
\ UTIL_WaitTimeInMs:
\ 00000000 18309FE5 LDR R3,??UTIL_WaitTimeInMs_0 ;; 0x83126e98
\ 00000004 903382E0 UMULL R3,R2,R0,R3
\ 00000008 A204A0E1 LSR R0,R2,#+9
\ 0000000C 910000E0 MUL R0,R1,R0
\ 00000010 ........ LDR R2,??DataTable1 ;; 0xaaaaaaab
\ 00000014 902281E0 UMULL R2,R1,R0,R2
\ 00000018 A100A0E1 LSR R0,R1,#+1
\ 0000001C ........ B UTIL_Loop ;; tailcall
\ ??UTIL_WaitTimeInMs_0:
\ 00000020 986E1283 DC32 0x83126e98
82 }
83
84 //------------------------------------------------------------------------------
85 /// Wait time in us
86 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
87 void UTIL_WaitTimeInUs(unsigned int mck, unsigned int time_us)
88 {
\ UTIL_WaitTimeInUs:
\ 00000000 08D04DE2 SUB SP,SP,#+8
89 volatile unsigned int i = 0;
\ 00000004 0030A0E3 MOV R3,#+0
\ 00000008 00308DE5 STR R3,[SP, #+0]
90 i = (mck / 1000000) * time_us;
\ 0000000C 2C309FE5 LDR R3,??UTIL_WaitTimeInUs_0 ;; 0x8637bd06
\ 00000010 903382E0 UMULL R3,R2,R0,R3
\ 00000014 A209A0E1 LSR R0,R2,#+19
\ 00000018 910000E0 MUL R0,R1,R0
\ 0000001C 00008DE5 STR R0,[SP, #+0]
91 i = i / 3;
\ 00000020 00009DE5 LDR R0,[SP, #+0]
\ 00000024 ........ LDR R2,??DataTable1 ;; 0xaaaaaaab
\ 00000028 902281E0 UMULL R2,R1,R0,R2
\ 0000002C A100A0E1 LSR R0,R1,#+1
\ 00000030 00008DE5 STR R0,[SP, #+0]
92 UTIL_Loop(i);
\ 00000034 00009DE5 LDR R0,[SP, #+0]
\ 00000038 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
\ 0000003C ........ B UTIL_Loop ;; tailcall
\ ??UTIL_WaitTimeInUs_0:
\ 00000040 06BD3786 DC32 0x8637bd06
93 }
94
95 //------------------------------------------------------------------------------
96 /// Interrupt handler for the PWM controller. Counts the number of periods and
97 /// updates the duty cycle after a given number.
98 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
99 static void ISR_Pwmc(void)
100 {
\ ISR_Pwmc:
\ 00000000 00502DE9 PUSH {R12,LR}
101 static unsigned int count = 0;
102 static unsigned int duty = MIN_DUTY_CYCLE;
103 static unsigned char fadeIn = 1;
104
105 // Interrupt on channel #1
106 if ((AT91C_BASE_PWMC->PWMC_ISR & AT91C_PWMC_CHID1) == AT91C_PWMC_CHID1) {
\ 00000004 B4009FE5 LDR R0,??ISR_Pwmc_0 ;; 0xfffcc01c
\ 00000008 000090E5 LDR R0,[R0, #+0]
\ 0000000C 020010E3 TST R0,#0x2
\ 00000010 2800000A BEQ ??ISR_Pwmc_1
107
108 count++;
\ 00000014 A8009FE5 LDR R0,??ISR_Pwmc_0+0x4 ;; ??count
\ 00000018 000090E5 LDR R0,[R0, #+0]
\ 0000001C 010080E2 ADD R0,R0,#+1
\ 00000020 9C109FE5 LDR R1,??ISR_Pwmc_0+0x4 ;; ??count
\ 00000024 000081E5 STR R0,[R1, #+0]
109
110 // Fade in/out
111 if (count == (PWM_FREQUENCY / (MAX_DUTY_CYCLE - MIN_DUTY_CYCLE))) {
\ 00000028 94009FE5 LDR R0,??ISR_Pwmc_0+0x4 ;; ??count
\ 0000002C 000090E5 LDR R0,[R0, #+0]
\ 00000030 640F50E3 CMP R0,#+400
\ 00000034 1F00001A BNE ??ISR_Pwmc_1
112
113 // Fade in
114 if (fadeIn) {
\ 00000038 88009FE5 LDR R0,??ISR_Pwmc_0+0x8 ;; ??duty
\ 0000003C 000090E5 LDR R0,[R0, #+0]
\ 00000040 84109FE5 LDR R1,??ISR_Pwmc_0+0xC ;; ??fadeIn
\ 00000044 0010D1E5 LDRB R1,[R1, #+0]
\ 00000048 000051E3 CMP R1,#+0
\ 0000004C 0500000A BEQ ??ISR_Pwmc_2
115
116 duty++;
\ 00000050 011080E2 ADD R1,R0,#+1
117 if (duty == MAX_DUTY_CYCLE) {
\ 00000054 320051E3 CMP R1,#+50
\ 00000058 0700001A BNE ??ISR_Pwmc_3
118
119 fadeIn = 0;
\ 0000005C 68009FE5 LDR R0,??ISR_Pwmc_0+0xC ;; ??fadeIn
\ 00000060 0020A0E3 MOV R2,#+0
\ 00000064 030000EA B ??ISR_Pwmc_4
120 }
121 }
122 // Fade out
123 else {
124
125 duty--;
\ ??ISR_Pwmc_2:
\ 00000068 011050E2 SUBS R1,R0,#+1
126 if (duty == MIN_DUTY_CYCLE) {
\ 0000006C 0200001A BNE ??ISR_Pwmc_3
127
128 fadeIn = 1;
\ 00000070 54009FE5 LDR R0,??ISR_Pwmc_0+0xC ;; ??fadeIn
\ 00000074 0120A0E3 MOV R2,#+1
\ ??ISR_Pwmc_4:
\ 00000078 0020C0E5 STRB R2,[R0, #+0]
\ ??ISR_Pwmc_3:
\ 0000007C 44009FE5 LDR R0,??ISR_Pwmc_0+0x8 ;; ??duty
\ 00000080 001080E5 STR R1,[R0, #+0]
129 }
130 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -