📄 pio.lst
字号:
141 unsigned char enablePullUp,
142 unsigned char enableFilter)
143 {
144 // Disable interrupts
145 WRITE(pio, PIO_IDR, mask);
\ PIO_SetInput:
\ 00000000 441080E5 STR R1,[R0, #+68]
146
147 // Enable pull-up(s) if necessary
148 if (enablePullUp)
\ 00000004 FF2012E2 ANDS R2,R2,#0xFF ;; Zero extend
\ 00000008 000052E3 CMP R2,#+0
\ 0000000C 0100000A BEQ ??PIO_SetInput_0
149 WRITE(pio, PIO_PPUER, mask);
\ 00000010 641080E5 STR R1,[R0, #+100]
\ 00000014 000000EA B ??PIO_SetInput_1
150 else
151 WRITE(pio, PIO_PPUDR, mask);
\ ??PIO_SetInput_0:
\ 00000018 601080E5 STR R1,[R0, #+96]
152
153 // Enable filter(s) if necessary
154 if (enableFilter)
\ ??PIO_SetInput_1:
\ 0000001C FF3013E2 ANDS R3,R3,#0xFF ;; Zero extend
\ 00000020 000053E3 CMP R3,#+0
\ 00000024 0100000A BEQ ??PIO_SetInput_2
155 WRITE(pio, PIO_IFER, mask);
\ 00000028 201080E5 STR R1,[R0, #+32]
\ 0000002C 000000EA B ??PIO_SetInput_3
156 else
157 WRITE(pio, PIO_IFDR, mask);
\ ??PIO_SetInput_2:
\ 00000030 241080E5 STR R1,[R0, #+36]
158
159 // Configure pin as input
160 WRITE(pio, PIO_ODR, mask);
\ ??PIO_SetInput_3:
\ 00000034 141080E5 STR R1,[R0, #+20]
161 WRITE(pio, PIO_PER, mask);
\ 00000038 001080E5 STR R1,[R0, #+0]
162 }
\ 0000003C 1EFF2FE1 BX LR ;; return
163
164 //------------------------------------------------------------------------------
165 /// Configures one or more pin(s) of a PIO controller as outputs, with the
166 /// given default value. Optionally, the multi-drive feature can be enabled
167 /// on the pin(s).
168 /// \param pio Pointer to a PIO controller.
169 /// \param mask Bitmask indicating which pin(s) to configure.
170 /// \param defaultValue Default level on the pin(s).
171 /// \param enableMultiDrive Indicates if the pin(s) shall be configured as
172 /// open-drain.
173 /// \param enablePullUp Indicates if the pin shall have its pull-up activated.
174 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
175 static void PIO_SetOutput(AT91S_PIO *pio,
176 unsigned int mask,
177 unsigned char defaultValue,
178 unsigned char enableMultiDrive,
179 unsigned char enablePullUp)
180 {
\ PIO_SetOutput:
\ 00000000 00C0DDE5 LDRB R12,[SP, #+0]
181 // Disable interrupts
182 WRITE(pio, PIO_IDR, mask);
\ 00000004 441080E5 STR R1,[R0, #+68]
183
184 // Enable pull-up(s) if necessary
185 if (enablePullUp)
\ 00000008 FFC01CE2 ANDS R12,R12,#0xFF ;; Zero extend
\ 0000000C 00005CE3 CMP R12,#+0
\ 00000010 0100000A BEQ ??PIO_SetOutput_0
186 WRITE(pio, PIO_PPUER, mask);
\ 00000014 641080E5 STR R1,[R0, #+100]
\ 00000018 000000EA B ??PIO_SetOutput_1
187 else
188 WRITE(pio, PIO_PPUDR, mask);
\ ??PIO_SetOutput_0:
\ 0000001C 601080E5 STR R1,[R0, #+96]
189
190 // Enable multi-drive if necessary
191 if (enableMultiDrive)
\ ??PIO_SetOutput_1:
\ 00000020 FF3013E2 ANDS R3,R3,#0xFF ;; Zero extend
\ 00000024 000053E3 CMP R3,#+0
\ 00000028 0100000A BEQ ??PIO_SetOutput_2
192 WRITE(pio, PIO_MDER, mask);
\ 0000002C 501080E5 STR R1,[R0, #+80]
\ 00000030 000000EA B ??PIO_SetOutput_3
193 else
194 WRITE(pio, PIO_MDDR, mask);
\ ??PIO_SetOutput_2:
\ 00000034 541080E5 STR R1,[R0, #+84]
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 WRITE(pio, PIO_SODR, mask);
\ 00000044 301080E5 STR R1,[R0, #+48]
\ 00000048 000000EA B ??PIO_SetOutput_5
199 else
200 WRITE(pio, PIO_CODR, mask);
\ ??PIO_SetOutput_4:
\ 0000004C 341080E5 STR R1,[R0, #+52]
201
202 // Configure pin(s) as output(s)
203 WRITE(pio, PIO_OER, mask);
\ ??PIO_SetOutput_5:
\ 00000050 101080E5 STR R1,[R0, #+16]
204 WRITE(pio, PIO_PER, mask);
\ 00000054 001080E5 STR R1,[R0, #+0]
205 }
\ 00000058 1EFF2FE1 BX LR ;; return
206
207 //------------------------------------------------------------------------------
208 // Exported functions
209 //------------------------------------------------------------------------------
210 //------------------------------------------------------------------------------
211 /// Configures a list of Pin instances, which can either hold a single pin or a
212 /// group of pins, depending on the mask value; all pins are configured by this
213 /// function.
214 /// Returns 1 if the configuration has been performed successfully; otherwise 0.
215 /// \param list Pointer to a list of Pin instances.
216 /// \param size Size of the Pin list (see <PIO_LISTSIZE>).
217 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
218 unsigned char PIO_Configure(const Pin *list, unsigned int size)
219 {
\ PIO_Configure:
\ 00000000 38402DE9 PUSH {R3-R5,LR}
\ 00000004 0040B0E1 MOVS R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
220 // Configure pins
221 while (size > 0) {
\ ??PIO_Configure_1:
\ 0000000C 000055E3 CMP R5,#+0
\ 00000010 4200000A BEQ ??PIO_Configure_2
222
223 switch (list->type) {
\ 00000014 0900D4E5 LDRB R0,[R4, #+9]
\ 00000018 040050E3 CMP R0,#+4
\ 0000001C 3A00008A 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
224
225 case PIO_PERIPH_A:
226 PIO_SetPeripheralA(list->pio,
227 list->mask,
228 (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 310000EA B ??PIO_Configure_5
229 break;
230
231 case PIO_PERIPH_B:
232 PIO_SetPeripheralB(list->pio,
233 list->mask,
234 (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 2B0000EA B ??PIO_Configure_5
235 break;
236
237 case PIO_INPUT:
238 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]
239 PIO_SetInput(list->pio,
240 list->mask,
241 (list->attribute & PIO_PULLUP) ? 1 : 0,
242 (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 180000EA B ??PIO_Configure_5
243 break;
244
245 case PIO_OUTPUT_0:
246 case PIO_OUTPUT_1:
247 PIO_SetOutput(list->pio,
248 list->mask,
249 (list->type == PIO_OUTPUT_1),
250 (list->attribute & PIO_OPENDRAIN) ? 1 : 0,
251 (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
\ 000000C0 0100000A BEQ ??PIO_Configure_11
\ 000000C4 0130A0E3 MOV R3,#+1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -