📄 main.lst
字号:
\ FFFF
\ 00000014 02000100 DC8 2, 0, 1, 0
\ 00000018 0000040000F4 DC32 262144, 0FFFFF400H
\ FFFF
\ 00000020 02000100 DC8 2, 0, 1, 0
\ 00000024 0020000000F4 DC32 8192, 0FFFFF400H
\ FFFF
\ 0000002C 02000100 DC8 2, 0, 1, 0
119
120 //------------------------------------------------------------------------------
121 // Lokalna definicia
122 //------------------------------------------------------------------------------
123 #define MULTIPLE_TEST
124
125 #define NB_MULTI_BLOCKS 5
126
127 /// SPI clock frequency, in Hz.
128 #define SPCK 10000000
129
130 //------------------------------------------------------------------------------
131 // Local functions
132 //------------------------------------------------------------------------------
133 //------------------------------------------------------------------------------
134 /// SPI0 interrupt handler. Forwards the event to the SPI driver handler.
135 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
136 void ISR_Spi0(void)
137 {
138 SDSPI_Handler(&sdSpiDrv);
\ ISR_Spi0:
\ 00000000 ........ LDR R0,??DataTable25 ;; sdSpiDrv
\ 00000004 ........ B SDSPI_Handler ;; tailcall
139 }
140 //------------------------------------------------------------------------------
141 // Optional: SD card detection
142 //------------------------------------------------------------------------------
143
144 #ifdef BOARD_SD_PIN_CD
145
146 /// SD card detection pin instance.
147 static const Pin pinSdCardDetect = BOARD_SD_PIN_CD;
148
149 //------------------------------------------------------------------------------
150 /// Waits for a SD card to be connected.
151 //------------------------------------------------------------------------------
152 void WaitSdConn(void)
153 {
154 PIO_Configure(&pinSdCardDetect, 1);
155 printf("-I- Please connect a SD card ...\n\r");
156 while (PIO_Get(&pinSdCardDetect) != 0);
157 printf("-I- SD card connection detected\n\r");
158 }
159
160 #else
161
162 //------------------------------------------------------------------------------
163 /// Dummy function.
164 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
165 void WaitSdConn(void)
166 {
167 printf("-I- SD card detection not available, assuming card is present\n\r");
\ WaitSdConn:
\ 00000000 00009FE5 LDR R0,??WaitSdConn_0 ;; `?<Constant "-I- SD card detection...">`
\ 00000004 ........ B printf ;; tailcall
\ ??WaitSdConn_0:
\ 00000008 ........ DC32 `?<Constant "-I- SD card detection...">`
168 }
169
170 #endif
171
172 //------------------------------------------------------------------------------
173 // Optional: Write protection status
174 //------------------------------------------------------------------------------
175
176 #ifdef BOARD_SD_PIN_WP
177
178 /// Write protection status pin instance.
179 static const Pin pinSdWriteProtect = BOARD_SD_PIN_WP;
180
181 //------------------------------------------------------------------------------
182 /// Checks if the device is write protected.
183 //------------------------------------------------------------------------------
184 void CheckProtection(void)
185 {
186 PIO_Configure(&pinSdWriteProtect, 1);
187 if (PIO_Get(&pinSdWriteProtect) != 0) {
188
189 printf("-I- SD card is write-protected\n\r");
190 }
191 else {
192
193 printf("-I- SD card is NOT write-protected.\n\r");
194 }
195 }
196
197 #else
198
199 //------------------------------------------------------------------------------
200 /// Dummy implementation.
201 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
202 void CheckProtection(void)
203 {
204 printf("-I- Cannot check if SD card is write-protected\n\r");
\ CheckProtection:
\ 00000000 00009FE5 LDR R0,??CheckProtection_0 ;; `?<Constant "-I- Cannot check if S...">`
\ 00000004 ........ B printf ;; tailcall
\ ??CheckProtection_0:
\ 00000008 ........ DC32 `?<Constant "-I- Cannot check if S...">`
205 }
206
207 #endif
208 //------------------------------------------------------------------------------
209 // Wait time in ms
210 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
211 void UTIL_Loop(unsigned int loop)
212 {
213 while(loop--);
214 }
\ UTIL_Loop:
\ 00000000 1EFF2FE1 BX LR ;; return
\ In section .text, align 4, keep-with-next
215 void UTIL_WaitTimeInMs(unsigned int mck, unsigned int time_ms)
216 {
217 register unsigned int i = 0;
218 i = (mck / 1000) * time_ms;
219 i = i / 3;
220 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,??DataTable2 ;; 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
221 }
222 //------------------------------------------------------------------------------
223 // Wait time in us
224 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
225 void UTIL_WaitTimeInUs(unsigned int mck, unsigned int time_us)
226 {
\ UTIL_WaitTimeInUs:
\ 00000000 08D04DE2 SUB SP,SP,#+8
227 volatile unsigned int i = 0;
\ 00000004 0030A0E3 MOV R3,#+0
\ 00000008 00308DE5 STR R3,[SP, #+0]
228 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]
229 i = i / 3;
\ 00000020 00009DE5 LDR R0,[SP, #+0]
\ 00000024 ........ LDR R2,??DataTable2 ;; 0xaaaaaaab
\ 00000028 902281E0 UMULL R2,R1,R0,R2
\ 0000002C A100A0E1 LSR R0,R1,#+1
\ 00000030 00008DE5 STR R0,[SP, #+0]
230 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
231 }
232 //------------------------------------------------------------------------------
233 /// Interrupt handler for the PWM controller. Counts the number of periods and
234 /// updates the duty cycle after a given number.
235 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
236 static void ISR_Pwmc(void)
237 {
\ ISR_Pwmc:
\ 00000000 00502DE9 PUSH {R12,LR}
238 static unsigned int count = 0;
239 static unsigned int duty = MIN_DUTY_CYCLE;
240 static unsigned char fadeIn = 1;
241
242 // Interrupt on channel #1
243 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
244
245 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]
246
247 // Fade in/out
248 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
249
250 // Fade in
251 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
252
253 duty++;
\ 00000050 011080E2 ADD R1,R0,#+1
254 if (duty == MAX_DUTY_CYCLE) {
\ 00000054 320051E3 CMP R1,#+50
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -