📄 pio.lst
字号:
136 else {
137
138 WRITE(pio, PIO_PPUDR, mask);
\ ??PIO_SetInput_0:
\ 00000018 601080E5 STR R1,[R0, #+96]
139 }
140
141 // Enable filter(s) if necessary
142 if (enableFilter) {
\ ??PIO_SetInput_1:
\ 0000001C FF3013E2 ANDS R3,R3,#0xFF ;; Zero extend
\ 00000020 000053E3 CMP R3,#+0
\ 00000024 0100000A BEQ ??PIO_SetInput_2
143
144 WRITE(pio, PIO_IFER, mask);
\ 00000028 201080E5 STR R1,[R0, #+32]
\ 0000002C 000000EA B ??PIO_SetInput_3
145 }
146 else {
147
148 WRITE(pio, PIO_IFDR, mask);
\ ??PIO_SetInput_2:
\ 00000030 241080E5 STR R1,[R0, #+36]
149 }
150
151 // Configure pin as input
152 WRITE(pio, PIO_ODR, mask);
\ ??PIO_SetInput_3:
\ 00000034 141080E5 STR R1,[R0, #+20]
153 WRITE(pio, PIO_PER, mask);
\ 00000038 001080E5 STR R1,[R0, #+0]
154 }
\ 0000003C 1EFF2FE1 BX LR ;; return
155
156 //------------------------------------------------------------------------------
157 /// Configures one or more pin(s) of a PIO controller as outputs, with the
158 /// given default value. Optionally, the multi-drive feature can be enabled
159 /// on the pin(s).
160 /// \param pio Pointer to a PIO controller.
161 /// \param mask Bitmask indicating which pin(s) to configure.
162 /// \param defaultValue Default level on the pin(s).
163 /// \param enableMultiDrive Indicates if the pin(s) shall be configured as
164 /// open-drain.
165 /// \param enablePullUp Indicates if the pin shall have its pull-up activated.
166 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
167 static void PIO_SetOutput(AT91S_PIO *pio,
168 unsigned int mask,
169 unsigned char defaultValue,
170 unsigned char enableMultiDrive,
171 unsigned char enablePullUp)
172 {
\ PIO_SetOutput:
\ 00000000 00C0DDE5 LDRB R12,[SP, #+0]
173 // Disable interrupts
174 WRITE(pio, PIO_IDR, mask);
\ 00000004 441080E5 STR R1,[R0, #+68]
175
176 // Enable pull-up(s) if necessary
177 if (enablePullUp) {
\ 00000008 FFC01CE2 ANDS R12,R12,#0xFF ;; Zero extend
\ 0000000C 00005CE3 CMP R12,#+0
\ 00000010 0100000A BEQ ??PIO_SetOutput_0
178
179 WRITE(pio, PIO_PPUER, mask);
\ 00000014 641080E5 STR R1,[R0, #+100]
\ 00000018 000000EA B ??PIO_SetOutput_1
180 }
181 else {
182
183 WRITE(pio, PIO_PPUDR, mask);
\ ??PIO_SetOutput_0:
\ 0000001C 601080E5 STR R1,[R0, #+96]
184 }
185
186 // Enable multi-drive if necessary
187 if (enableMultiDrive) {
\ ??PIO_SetOutput_1:
\ 00000020 FF3013E2 ANDS R3,R3,#0xFF ;; Zero extend
\ 00000024 000053E3 CMP R3,#+0
\ 00000028 0100000A BEQ ??PIO_SetOutput_2
188
189 WRITE(pio, PIO_MDER, mask);
\ 0000002C 501080E5 STR R1,[R0, #+80]
\ 00000030 000000EA B ??PIO_SetOutput_3
190 }
191 else {
192
193 WRITE(pio, PIO_MDDR, mask);
\ ??PIO_SetOutput_2:
\ 00000034 541080E5 STR R1,[R0, #+84]
194 }
195
196 // Set default value
197 if (defaultValue) {
\ ??PIO_SetOutput_3:
\ 00000038 FF2012E2 ANDS R2,R2,#0xFF ;; Zero extend
\ 0000003C 000052E3 CMP R2,#+0
\ 00000040 0100000A BEQ ??PIO_SetOutput_4
198
199 WRITE(pio, PIO_SODR, mask);
\ 00000044 301080E5 STR R1,[R0, #+48]
\ 00000048 000000EA B ??PIO_SetOutput_5
200 }
201 else {
202
203 WRITE(pio, PIO_CODR, mask);
\ ??PIO_SetOutput_4:
\ 0000004C 341080E5 STR R1,[R0, #+52]
204 }
205
206 // Configure pin(s) as output(s)
207 WRITE(pio, PIO_OER, mask);
\ ??PIO_SetOutput_5:
\ 00000050 101080E5 STR R1,[R0, #+16]
208 WRITE(pio, PIO_PER, mask);
\ 00000054 001080E5 STR R1,[R0, #+0]
209 }
\ 00000058 1EFF2FE1 BX LR ;; return
210
211 //------------------------------------------------------------------------------
212 // Exported functions
213 //------------------------------------------------------------------------------
214 //------------------------------------------------------------------------------
215 /// Configures a list of Pin instances, which can either hold a single pin or a
216 /// group of pins, depending on the mask value; all pins are configured by this
217 /// function.
218 /// Returns 1 if the configuration has been performed successfully; otherwise 0.
219 /// \param list Pointer to a list of Pin instances.
220 /// \param size Size of the Pin list (see <PIO_LISTSIZE>).
221 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
222 unsigned char PIO_Configure(const Pin *list, unsigned int size)
223 {
\ PIO_Configure:
\ 00000000 31402DE9 PUSH {R0,R4,R5,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
224 // Configure pins
225 while (size > 0) {
\ ??PIO_Configure_1:
\ 0000000C 000055E3 CMP R5,#+0
\ 00000010 4300000A BEQ ??PIO_Configure_2
226
227 switch (list->type) {
\ 00000014 0900D4E5 LDRB R0,[R4, #+9]
\ 00000018 040050E3 CMP R0,#+4
\ 0000001C 3B00008A BHI ??PIO_Configure_3
\ 00000020 04108FE2 ADR R1,??PIO_Configure_0
\ 00000024 0010D1E7 LDRB R1,[R1, R0]
\ 00000028 01F18FE0 ADD PC,PC,R1, LSL #+2
\ ??PIO_Configure_0:
\ 0000002C 01070D20 DC8 +1,+7,+13,+32
\ 00000030 20000000 DC8 +32,+0,+0,+0
228
229 case PIO_PERIPH_A:
230 PIO_SetPeripheralA(list->pio,
231 list->mask,
232 (list->attribute & PIO_PULLUP) ? 1 : 0);
\ ??PIO_Configure_4:
\ 00000034 0A00D4E5 LDRB R0,[R4, #+10]
\ 00000038 012010E2 ANDS R2,R0,#0x1
\ 0000003C 001094E5 LDR R1,[R4, #+0]
\ 00000040 040094E5 LDR R0,[R4, #+4]
\ 00000044 ........ BL PIO_SetPeripheralA
\ 00000048 320000EA B ??PIO_Configure_5
233 break;
234
235 case PIO_PERIPH_B:
236 PIO_SetPeripheralB(list->pio,
237 list->mask,
238 (list->attribute & PIO_PULLUP) ? 1 : 0);
\ ??PIO_Configure_6:
\ 0000004C 0A00D4E5 LDRB R0,[R4, #+10]
\ 00000050 012010E2 ANDS R2,R0,#0x1
\ 00000054 001094E5 LDR R1,[R4, #+0]
\ 00000058 040094E5 LDR R0,[R4, #+4]
\ 0000005C ........ BL PIO_SetPeripheralB
\ 00000060 2C0000EA B ??PIO_Configure_5
239 break;
240
241 case PIO_INPUT:
242 AT91C_BASE_PMC->PMC_PCER = 1 << list->id;
\ ??PIO_Configure_7:
\ 00000064 0100A0E3 MOV R0,#+1
\ 00000068 D810D4E1 LDRSB R1,[R4, #+8]
\ 0000006C 1001B0E1 LSLS R0,R0,R1
\ 00000070 EF10E0E3 MVN R1,#+239
\ 00000074 C01FC1E3 BIC R1,R1,#0x300
\ 00000078 000081E5 STR R0,[R1, #+0]
243 PIO_SetInput(list->pio,
244 list->mask,
245 (list->attribute & PIO_PULLUP) ? 1 : 0,
246 (list->attribute & PIO_DEGLITCH)? 1 : 0);
\ 0000007C 0A00D4E5 LDRB R0,[R4, #+10]
\ 00000080 020010E3 TST R0,#0x2
\ 00000084 0100000A BEQ ??PIO_Configure_8
\ 00000088 0130A0E3 MOV R3,#+1
\ 0000008C 000000EA B ??PIO_Configure_9
\ ??PIO_Configure_8:
\ 00000090 0030A0E3 MOV R3,#+0
\ ??PIO_Configure_9:
\ 00000094 FF3013E2 ANDS R3,R3,#0xFF ;; Zero extend
\ 00000098 0A00D4E5 LDRB R0,[R4, #+10]
\ 0000009C 012010E2 ANDS R2,R0,#0x1
\ 000000A0 001094E5 LDR R1,[R4, #+0]
\ 000000A4 040094E5 LDR R0,[R4, #+4]
\ 000000A8 ........ BL PIO_SetInput
\ 000000AC 190000EA B ??PIO_Configure_5
247 break;
248
249 case PIO_OUTPUT_0:
250 case PIO_OUTPUT_1:
251 PIO_SetOutput(list->pio,
252 list->mask,
253 (list->type == PIO_OUTPUT_1),
254 (list->attribute & PIO_OPENDRAIN) ? 1 : 0,
255 (list->attribute & PIO_PULLUP) ? 1 : 0);
\ ??PIO_Configure_10:
\ 000000B0 0A00D4E5 LDRB R0,[R4, #+10]
\ 000000B4 010010E2 ANDS R0,R0,#0x1
\ 000000B8 0A10D4E5 LDRB R1,[R4, #+10]
\ 000000BC 040011E3 TST R1,#0x4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -