📄 main.lst
字号:
131
132 // Set new duty cycle
133 count = 0;
\ 00000084 38009FE5 LDR R0,??ISR_Pwmc_0+0x4 ;; ??count
\ 00000088 0020A0E3 MOV R2,#+0
\ 0000008C 002080E5 STR R2,[R0, #+0]
134 PWMC_SetDutyCycle(CHANNEL_PWM_LED0, duty);
\ 00000090 0118A0E1 MOV R1,R1, LSL #+16
\ 00000094 2118A0E1 MOV R1,R1, LSR #+16
\ 00000098 0100A0E3 MOV R0,#+1
\ 0000009C ........ BL PWMC_SetDutyCycle
135 PWMC_SetDutyCycle(CHANNEL_PWM_LED1, duty);
\ 000000A0 20009FE5 LDR R0,??ISR_Pwmc_0+0x8 ;; ??duty
\ 000000A4 001090E5 LDR R1,[R0, #+0]
\ 000000A8 0118A0E1 MOV R1,R1, LSL #+16
\ 000000AC 2118A0E1 MOV R1,R1, LSR #+16
\ 000000B0 0200A0E3 MOV R0,#+2
\ 000000B4 ........ BL PWMC_SetDutyCycle
136 }
137 }
138 }
\ ??ISR_Pwmc_1:
\ 000000B8 0140BDE8 POP {R0,LR}
\ 000000BC 1EFF2FE1 BX LR ;; return
\ ??ISR_Pwmc_0:
\ 000000C0 1CC0FCFF DC32 0xfffcc01c
\ 000000C4 ........ DC32 ??count
\ 000000C8 ........ DC32 ??duty
\ 000000CC ........ DC32 ??fadeIn
\ In section .bss, align 4
\ ??count:
\ 00000000 DS8 4
\ In section .bss, align 4
\ ??duty:
\ 00000000 DS8 4
\ In section .data, align 1
\ ??fadeIn:
\ 00000000 01 DC8 1
139
140 //------------------------------------------------------------------------------
141 /// Handler for PIT interrupt. Increments the timestamp counter.
142 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
143 void ISR_Pit(void)
144 {
\ ISR_Pit:
\ 00000000 00502DE9 PUSH {R12,LR}
145 unsigned int status;
146
147 // Read the PIT status register
148 status = PIT_GetStatus() & AT91C_PITC_PITS;
\ 00000004 ........ BL PIT_GetStatus
\ 00000008 010010E2 ANDS R0,R0,#0x1
149 if (status != 0) {
\ 0000000C 0500000A BEQ ??ISR_Pit_0
150
151 // Read the PIVR to acknowledge interrupt and get number of ticks
152 timestamp += (PIT_GetPIVR() >> 20);
\ 00000010 ........ BL PIT_GetPIVR
\ 00000014 ........ LDR R1,??DataTable12 ;; timestamp
\ 00000018 001091E5 LDR R1,[R1, #+0]
\ 0000001C 200A81E0 ADD R0,R1,R0, LSR #+20
\ 00000020 ........ LDR R1,??DataTable12 ;; timestamp
\ 00000024 000081E5 STR R0,[R1, #+0]
153 }
154 }
\ ??ISR_Pit_0:
\ 00000028 0140BDE8 POP {R0,LR}
\ 0000002C 1EFF2FE1 BX LR ;; return
155
156 //------------------------------------------------------------------------------
157 /// Configure the periodic interval timer to generate an interrupt every
158 /// millisecond.
159 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
160 void ConfigurePit(void)
161 {
\ ConfigurePit:
\ 00000000 00502DE9 PUSH {R12,LR}
162 // Initialize the PIT to the desired frequency
163 PIT_Init(PIT_PERIOD, BOARD_MCK / 1000000);
\ 00000004 3010A0E3 MOV R1,#+48
\ 00000008 FA0FA0E3 MOV R0,#+1000
\ 0000000C ........ BL PIT_Init
164
165 // Configure interrupt on PIT
166 AIC_DisableIT(AT91C_ID_SYS);
\ 00000010 0100A0E3 MOV R0,#+1
\ 00000014 ........ BL AIC_DisableIT
167 AIC_ConfigureIT(AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, ISR_Pit);
\ 00000018 1C209FE5 LDR R2,??ConfigurePit_0 ;; ISR_Pit
\ 0000001C 0010A0E3 MOV R1,#+0
\ 00000020 0100A0E3 MOV R0,#+1
\ 00000024 ........ BL AIC_ConfigureIT
168 AIC_EnableIT(AT91C_ID_SYS);
\ 00000028 0100A0E3 MOV R0,#+1
\ 0000002C ........ BL AIC_EnableIT
169 PIT_EnableIT();
\ 00000030 ........ BL PIT_EnableIT
170
171 // Enable the pit
172 PIT_Enable();
\ 00000034 0140BDE8 POP {R0,LR}
\ 00000038 ........ B PIT_Enable ;; tailcall
\ ??ConfigurePit_0:
\ 0000003C ........ DC32 ISR_Pit
173 }
174
175 //------------------------------------------------------------------------------
176 /// Interrupt handler for pushbutton\#1. Starts or stops LED\#1.
177 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
178 void ISR_Bp1(void)
179 {
\ ISR_Bp1:
\ 00000000 00502DE9 PUSH {R12,LR}
180 static unsigned int lastPress = 0;
181
182 // Check if the button has been pressed
183 if (!PIO_Get(&pinPB1)) {
\ 00000004 ........ LDR R0,??DataTable10 ;; pinPB1
\ 00000008 ........ BL PIO_Get
\ 0000000C 000050E3 CMP R0,#+0
\ 00000010 0F00001A BNE ??ISR_Bp1_0
184
185 // Simple debounce method: limit push frequency to 1/DEBOUNCE_TIME
186 // (i.e. at least DEBOUNCE_TIME ms between each push)
187 if ((timestamp - lastPress) > DEBOUNCE_TIME) {
\ 00000014 ........ LDR R0,??DataTable12 ;; timestamp
\ 00000018 000090E5 LDR R0,[R0, #+0]
\ 0000001C 38109FE5 LDR R1,??ISR_Bp1_1 ;; ??lastPress
\ 00000020 001091E5 LDR R1,[R1, #+0]
\ 00000024 010040E0 SUB R0,R0,R1
\ 00000028 F510A0E3 MOV R1,#+245
\ 0000002C 401F81E3 ORR R1,R1,#0x100
\ 00000030 010050E1 CMP R0,R1
\ 00000034 0600003A BCC ??ISR_Bp1_0
188
189 lastPress = timestamp;
\ 00000038 1C009FE5 LDR R0,??ISR_Bp1_1 ;; ??lastPress
\ 0000003C ........ LDR R1,??DataTable12 ;; timestamp
\ 00000040 001091E5 LDR R1,[R1, #+0]
\ 00000044 001080E5 STR R1,[R0, #+0]
190
191 StopSW = 1;
\ 00000048 ........ LDR R0,??DataTable14 ;; StopSW
\ 0000004C 0110A0E3 MOV R1,#+1
\ 00000050 0010C0E5 STRB R1,[R0, #+0]
192
193 }
194 }
195 }
\ ??ISR_Bp1_0:
\ 00000054 0140BDE8 POP {R0,LR}
\ 00000058 1EFF2FE1 BX LR ;; return
\ ??ISR_Bp1_1:
\ 0000005C ........ DC32 ??lastPress
\ In section .bss, align 4
\ ??lastPress:
\ 00000000 DS8 4
196
197 //------------------------------------------------------------------------------
198 /// Configures the pushbuttons to generate interrupts when pressed.
199 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
200 void ConfigureButtons(void)
201 {
\ ConfigureButtons:
\ 00000000 00502DE9 PUSH {R12,LR}
202 // Configure pios
203 PIO_Configure(&pinPB1, 1);
\ 00000004 0110A0E3 MOV R1,#+1
\ 00000008 ........ LDR R0,??DataTable10 ;; pinPB1
\ 0000000C ........ BL PIO_Configure
204
205 // Initialize interrupts
206 PIO_InitializeInterrupts(AT91C_AIC_PRIOR_LOWEST);
\ 00000010 0000A0E3 MOV R0,#+0
\ 00000014 ........ BL PIO_InitializeInterrupts
207 PIO_ConfigureIt(&pinPB1, (void (*)(const Pin *)) ISR_Bp1);
\ 00000018 10109FE5 LDR R1,??ConfigureButtons_0 ;; ISR_Bp1
\ 0000001C ........ LDR R0,??DataTable10 ;; pinPB1
\ 00000020 ........ BL PIO_ConfigureIt
208 PIO_EnableIt(&pinPB1);
\ 00000024 ........ LDR R0,??DataTable10 ;; pinPB1
\ 00000028 0240BDE8 POP {R1,LR}
\ 0000002C ........ B PIO_EnableIt ;; tailcall
\ ??ConfigureButtons_0:
\ 00000030 ........ DC32 ISR_Bp1
209
210 }
211
212 //------------------------------------------------------------------------------
213 /// Configures LEDs \#1 and \#2 (cleared by default).
214 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
215 void ConfigureLeds(void)
216 {
217 LED_Configure(0);
\ ConfigureLeds:
\ 00000000 0000A0E3 MOV R0,#+0
\ 00000004 ........ B LED_Configure ;; tailcall
218
219 }
220
221
222 //------------------------------------------------------------------------------
223 /// Waits for the given number of milliseconds (using the timestamp generated
224 /// by the PIT).
225 /// \param delay Delay to wait for, in milliseconds.
226 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
227 void Wait(unsigned long delay)
228 {
\ Wait:
\ 00000000 08D04DE2 SUB SP,SP,#+8
229 volatile unsigned int start = timestamp;
\ 00000004 ........ LDR R2,??DataTable12 ;; timestamp
\ 00000008 002092E5 LDR R2,[R2, #+0]
\ 0000000C 00208DE5 STR R2,[SP, #+0]
230 unsigned int elapsed;
231 do {
232 elapsed = timestamp;
\ ??Wait_0:
\ 00000010 ........ LDR R1,??DataTable12 ;; timestamp
\ 00000014 001091E5 LDR R1,[R1, #+0]
233 elapsed -= start;
\ 00000018 00209DE5 LDR R2,[SP, #+0]
\ 0000001C 021041E0 SUB R1,R1,R2
234 }
235 while (elapsed < delay);
\ 00000020 000051E1 CMP R1,R0
\ 00000024 F9FFFF3A BCC ??Wait_0
236 }
\ 00000028 08D08DE2 ADD SP,SP,#+8 ;; stack cleaning
\ 0000002C 1EFF2FE1 BX LR ;; return
237
238 //------------------------------------------------------------------------------
239 // Exported functions
240 //------------------------------------------------------------------------------
241
242 //------------------------------------------------------------------------------
243 /// Application entry point. Configures the DBGU, PIT, TC0, LEDs and buttons
244 /// and makes LED\#1 blink in its infinite loop, using the Wait function.
245 /// \return Unused (ANSI-C compatibility).
246 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
247 int main(void)
248 { PIO_Configure(pins, PIO_LISTSIZE(pins));
\ main:
\ 00000000 00402DE9 PUSH {LR}
\ 00000004 0CD04DE2 SUB SP,SP,#+12
\ 00000008 0210A0E3 MOV R1,#+2
\ 0000000C 74019FE5 LDR R0,??main_0+0x8 ;; pins
\ 00000010 ........ BL PIO_Configure
249 // DBGU configuration
250 TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK);
\ 00000014 0D00A0E1 MOV R0,SP
\ 00000018 6C119FE5 LDR R1,??main_0+0xC ;; `?<Constant {{402653184, (AT91S_PIO *)429496422`
\ 0000001C 0C10B1E8 LDM R1!,{R2,R3,R12}
\ 00000020 0C10A0E8 STM R0!,{R2,R3,R12}
\ 00000024 0110A0E3 MOV R1,#+1
\ 00000028 0D00A0E1 MOV R0,SP
\ 0000002C ........ BL PIO_Configure
\ 00000030 B727A0E3 MOV R2,#+47972352
\ 00000034 6C2C82E3 ORR R2,R2,#0x6C00
\ 00000038 401BA0E3 MOV R1,#+65536
\ 0000003C C21C81E3 ORR R1,R1,#0xC200
\ 00000040 800EA0E3 MOV R0,#+2048
\ 00000044 ........ BL DBGU_Configure
251 printf("-- Getting Started Project %s --\n\r", SOFTPACK_VERSION);
\ 00000048 4C1F8FE2 ADR R1,??main_0 ;; "1.5"
\ 0000004C 3C019FE5 LDR R0,??main_0+0x10 ;; `?<Constant "-- Getting Started Pr...">`
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -