📄 pio.lst
字号:
121 pio->PIO_IDR = mask;
\ PIO_SetInput:
\ 00000000 441080E5 STR R1,[R0, #+68]
122
123 // Enable pull-up(s) if necessary
124 if (enablePullUp) {
\ 00000004 000052E3 CMP R2,#+0
125
126 pio->PIO_PPUER = mask;
\ 00000008 64108015 STRNE R1,[R0, #+100]
127 }
128 else {
129
130 pio->PIO_PPUDR = mask;
\ 0000000C 60108005 STREQ R1,[R0, #+96]
131 }
132
133 // Enable filter(s) if necessary
134 if (enableFilter) {
\ 00000010 000053E3 CMP R3,#+0
135
136 pio->PIO_IFER = mask;
\ 00000014 20108015 STRNE R1,[R0, #+32]
137 }
138 else {
139
140 pio->PIO_IFDR = mask;
\ 00000018 24108005 STREQ R1,[R0, #+36]
141 }
142
143 // Configure pin as input
144 pio->PIO_ODR = mask;
\ 0000001C 141080E5 STR R1,[R0, #+20]
145 pio->PIO_PER = mask;
\ 00000020 001080E5 STR R1,[R0, #+0]
146 }
\ 00000024 1EFF2FE1 BX LR ;; return
147
148 //------------------------------------------------------------------------------
149 /// Configures one or more pin(s) of a PIO controller as outputs, with the
150 /// given default value. Optionally, the multi-drive feature can be enabled
151 /// on the pin(s).
152 /// \param pio Pointer to a PIO controller.
153 /// \param mask Bitmask indicating which pin(s) to configure.
154 /// \param defaultValue Default level on the pin(s).
155 /// \param enableMultiDrive Indicates if the pin(s) shall be configured as
156 /// open-drain.
157 /// \param enablePullUp Indicates if the pin shall have its pull-up activated.
158 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
159 static void PIO_SetOutput(
160 AT91S_PIO *pio,
161 unsigned int mask,
162 unsigned char defaultValue,
163 unsigned char enableMultiDrive,
164 unsigned char enablePullUp)
165 {
\ PIO_SetOutput:
\ 00000000 00C0DDE5 LDRB R12,[SP, #+0]
166 // Disable interrupts
167 pio->PIO_IDR = mask;
\ 00000004 441080E5 STR R1,[R0, #+68]
168
169 // Enable pull-up(s) if necessary
170 if (enablePullUp) {
\ 00000008 00005CE3 CMP R12,#+0
171
172 pio->PIO_PPUER = mask;
\ 0000000C 64108015 STRNE R1,[R0, #+100]
173 }
174 else {
175
176 pio->PIO_PPUDR = mask;
\ 00000010 60108005 STREQ R1,[R0, #+96]
177 }
178
179 // Enable multi-drive if necessary
180 if (enableMultiDrive) {
\ 00000014 000053E3 CMP R3,#+0
181
182 pio->PIO_MDER = mask;
\ 00000018 50108015 STRNE R1,[R0, #+80]
183 }
184 else {
185
186 pio->PIO_MDDR = mask;
\ 0000001C 54108005 STREQ R1,[R0, #+84]
187 }
188
189 // Set default value
190 if (defaultValue) {
\ 00000020 000052E3 CMP R2,#+0
191
192 pio->PIO_SODR = mask;
\ 00000024 30108015 STRNE R1,[R0, #+48]
193 }
194 else {
195
196 pio->PIO_CODR = mask;
\ 00000028 34108005 STREQ R1,[R0, #+52]
197 }
198
199 // Configure pin(s) as output(s)
200 pio->PIO_OER = mask;
\ 0000002C 101080E5 STR R1,[R0, #+16]
201 pio->PIO_PER = mask;
\ 00000030 001080E5 STR R1,[R0, #+0]
202 }
\ 00000034 1EFF2FE1 BX LR ;; return
203
204 //------------------------------------------------------------------------------
205 // Global Functions
206 //------------------------------------------------------------------------------
207
208 //------------------------------------------------------------------------------
209 /// Configures a list of Pin instances, each of which can either hold a single
210 /// pin or a group of pins, depending on the mask value; all pins are configured
211 /// by this function. The size of the array must also be provided and is easily
212 /// computed using PIO_LISTSIZE whenever its length is not known in advance.
213 /// \param list Pointer to a list of Pin instances.
214 /// \param size Size of the Pin list (calculated using PIO_LISTSIZE).
215 /// \return 1 if the pins have been configured properly; otherwise 0.
216 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
217 unsigned char PIO_Configure(const Pin *list, unsigned int size)
218 {
\ PIO_Configure:
\ 00000000 38402DE9 PUSH {R3-R5,LR}
\ 00000004 0040A0E1 MOV R4,R0
\ 00000008 0150B0E1 MOVS R5,R1
\ 0000000C 0F00000A BEQ ??PIO_Configure_1
219 // Configure pins
220 while (size > 0) {
221
222 switch (list->type) {
\ ??PIO_Configure_2:
\ 00000010 0900D4E5 LDRB R0,[R4, #+9]
\ 00000014 040050E3 CMP R0,#+4
\ 00000018 3200008A BHI ??PIO_Configure_3
\ 0000001C 04108FE2 ADR R1,??PIO_Configure_0
\ 00000020 0010D1E7 LDRB R1,[R1, R0]
\ 00000024 01F18FE0 ADD PC,PC,R1, LSL #+2
\ ??PIO_Configure_0:
\ 00000028 010C1220 DC8 +1,+12,+18,+32
\ 0000002C 20000000 DC8 +32,+0,+0,+0
223
224 case PIO_PERIPH_A:
225 PIO_SetPeripheralA(list->pio,
226 list->mask,
227 (list->attribute & PIO_PULLUP) ? 1 : 0);
\ ??PIO_Configure_4:
\ 00000030 0A00D4E5 LDRB R0,[R4, #+10]
\ 00000034 012000E2 AND R2,R0,#0x1
\ 00000038 001094E5 LDR R1,[R4, #+0]
\ 0000003C 040094E5 LDR R0,[R4, #+4]
\ 00000040 ........ BL PIO_SetPeripheralA
228 break;
229
230 case PIO_PERIPH_B:
231 PIO_SetPeripheralB(list->pio,
232 list->mask,
233 (list->attribute & PIO_PULLUP) ? 1 : 0);
234 break;
235
236 case PIO_INPUT:
237 AT91C_BASE_PMC->PMC_PCER = 1 << list->id;
238 PIO_SetInput(list->pio,
239 list->mask,
240 (list->attribute & PIO_PULLUP) ? 1 : 0,
241 (list->attribute & PIO_DEGLITCH)? 1 : 0);
242 break;
243
244 case PIO_OUTPUT_0:
245 case PIO_OUTPUT_1:
246 PIO_SetOutput(list->pio,
247 list->mask,
248 (list->type == PIO_OUTPUT_1),
249 (list->attribute & PIO_OPENDRAIN) ? 1 : 0,
250 (list->attribute & PIO_PULLUP) ? 1 : 0);
251 break;
252
253 default: return 0;
254 }
255
256 list++;
\ ??PIO_Configure_5:
\ 00000044 0C4084E2 ADD R4,R4,#+12
257 size--;
\ 00000048 015055E2 SUBS R5,R5,#+1
\ 0000004C EFFFFF1A BNE ??PIO_Configure_2
258 }
259
260 return 1;
\ ??PIO_Configure_1:
\ 00000050 0100A0E3 MOV R0,#+1
\ ??PIO_Configure_6:
\ 00000054 3240BDE8 POP {R1,R4,R5,LR}
\ 00000058 1EFF2FE1 BX LR ;; return
\ ??PIO_Configure_7:
\ 0000005C 0A00D4E5 LDRB R0,[R4, #+10]
\ 00000060 012000E2 AND R2,R0,#0x1
\ 00000064 001094E5 LDR R1,[R4, #+0]
\ 00000068 040094E5 LDR R0,[R4, #+4]
\ 0000006C ........ BL PIO_SetPeripheralB
\ 00000070 F3FFFFEA B ??PIO_Configure_5
\ ??PIO_Configure_8:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -