📄 stm32f10x_gpio.lst
字号:
266 * Output : None
267 * Return : The output port pin value.
268 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
269 u8 GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
270 {
\ GPIO_ReadOutputDataBit:
\ 00000000 11B4 PUSH {R0,R4}
\ 00000002 0200 MOVS R2,R0
271 u8 bitstatus = 0x00;
\ 00000004 0023 MOVS R3,#+0
\ 00000006 1800 MOVS R0,R3
272
273 /* Check the parameters */
274 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
275
276 if ((GPIOx->ODR & GPIO_Pin) != (u32)Bit_RESET)
\ 00000008 D368 LDR R3,[R2, #+12]
\ 0000000A 0B40 ANDS R3,R3,R1
\ 0000000C 1C00 MOVS R4,R3
\ 0000000E A4B2 UXTH R4,R4 ;; ZeroExtS R4,R4,#+16,#+16
\ 00000010 641E SUBS R4,R4,#+1
\ 00000012 A441 SBCS R4,R4,R4
\ 00000014 E443 MVNS R4,R4
\ 00000016 E40F LSRS R4,R4,#+31
\ 00000018 2000 MOVS R0,R4
277 {
278 bitstatus = (u8)Bit_SET;
279 }
280 else
281 {
282 bitstatus = (u8)Bit_RESET;
283 }
284 return bitstatus;
\ 0000001A C0B2 UXTB R0,R0 ;; ZeroExtS R0,R0,#+24,#+24
\ 0000001C 01B0 ADD SP,SP,#+4
\ 0000001E 10BC POP {R4}
\ 00000020 7047 BX LR ;; return
285 }
286
287 /*******************************************************************************
288 * Function Name : GPIO_ReadOutputData
289 * Description : Reads the specified GPIO output data port.
290 * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral.
291 * Output : None
292 * Return : GPIO output data port value.
293 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
294 u16 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)
295 {
296 return ((u16)GPIOx->ODR);
\ GPIO_ReadOutputData:
\ 00000000 C068 LDR R0,[R0, #+12]
\ 00000002 80B2 UXTH R0,R0 ;; ZeroExtS R0,R0,#+16,#+16
\ 00000004 7047 BX LR ;; return
297 }
298
299 /*******************************************************************************
300 * Function Name : GPIO_SetBits
301 * Description : Sets the selected data port bits.
302 * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral.
303 * - GPIO_Pin: specifies the port bits to be written.
304 * This parameter can be any combination of GPIO_Pin_x where
305 * x can be (0..15).
306 * Output : None
307 * Return : None
308 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
309 void GPIO_SetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
310 {
311 /* Check the parameters */
312 assert_param(IS_GPIO_PIN(GPIO_Pin));
313 GPIOx->BSRR = GPIO_Pin;
\ GPIO_SetBits:
\ 00000000 89B2 UXTH R1,R1 ;; ZeroExtS R1,R1,#+16,#+16
\ 00000002 0161 STR R1,[R0, #+16]
314 }
\ 00000004 7047 BX LR ;; return
315
316 /*******************************************************************************
317 * Function Name : GPIO_ResetBits
318 * Description : Clears the selected data port bits.
319 * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral.
320 * - GPIO_Pin: specifies the port bits to be written.
321 * This parameter can be any combination of GPIO_Pin_x where
322 * x can be (0..15).
323 * Output : None
324 * Return : None
325 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
326 void GPIO_ResetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
327 {
328 /* Check the parameters */
329 assert_param(IS_GPIO_PIN(GPIO_Pin));
330 GPIOx->BRR = GPIO_Pin;
\ GPIO_ResetBits:
\ 00000000 89B2 UXTH R1,R1 ;; ZeroExtS R1,R1,#+16,#+16
\ 00000002 4161 STR R1,[R0, #+20]
331 }
\ 00000004 7047 BX LR ;; return
332
333 /*******************************************************************************
334 * Function Name : GPIO_WriteBit
335 * Description : Sets or clears the selected data port bit.
336 * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral.
337 * - GPIO_Pin: specifies the port bit to be written.
338 * This parameter can be one of GPIO_Pin_x where x can be (0..15).
339 * - BitVal: specifies the value to be written to the selected bit.
340 * This parameter can be one of the BitAction enum values:
341 * - Bit_RESET: to clear the port pin
342 * - Bit_SET: to set the port pin
343 * Output : None
344 * Return : None
345 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
346 void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin, BitAction BitVal)
347 {
348 /* Check the parameters */
349 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
350 assert_param(IS_GPIO_BIT_ACTION(BitVal));
351
352 if (BitVal != Bit_RESET)
\ GPIO_WriteBit:
\ 00000000 D2B2 UXTB R2,R2 ;; ZeroExtS R2,R2,#+24,#+24
\ 00000002 002A CMP R2,#+0
\ 00000004 02D0 BEQ.N ??GPIO_WriteBit_0
353 {
354 GPIOx->BSRR = GPIO_Pin;
\ 00000006 89B2 UXTH R1,R1 ;; ZeroExtS R1,R1,#+16,#+16
\ 00000008 0161 STR R1,[R0, #+16]
\ 0000000A 01E0 B.N ??GPIO_WriteBit_1
355 }
356 else
357 {
358 GPIOx->BRR = GPIO_Pin;
\ ??GPIO_WriteBit_0:
\ 0000000C 89B2 UXTH R1,R1 ;; ZeroExtS R1,R1,#+16,#+16
\ 0000000E 4161 STR R1,[R0, #+20]
359 }
360 }
\ ??GPIO_WriteBit_1:
\ 00000010 7047 BX LR ;; return
361
362 /*******************************************************************************
363 * Function Name : GPIO_Write
364 * Description : Writes data to the specified GPIO data port.
365 * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral.
366 * - PortVal: specifies the value to be written to the port output
367 * data register.
368 * Output : None
369 * Return : None
370 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
371 void GPIO_Write(GPIO_TypeDef* GPIOx, u16 PortVal)
372 {
373 GPIOx->ODR = PortVal;
\ GPIO_Write:
\ 00000000 89B2 UXTH R1,R1 ;; ZeroExtS R1,R1,#+16,#+16
\ 00000002 C160 STR R1,[R0, #+12]
374 }
\ 00000004 7047 BX LR ;; return
375
376 /*******************************************************************************
377 * Function Name : GPIO_PinLockConfig
378 * Description : Locks GPIO Pins configuration registers.
379 * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral.
380 * - GPIO_Pin: specifies the port bit to be written.
381 * This parameter can be any combination of GPIO_Pin_x where
382 * x can be (0..15).
383 * Output : None
384 * Return : None
385 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
386 void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
387 {
388 u32 tmp = 0x00010000;
\ GPIO_PinLockConfig:
\ 00000000 5FF48033 MOVS R3,#+65536
\ 00000004 1A00 MOVS R2,R3
389
390 /* Check the parameters */
391 assert_param(IS_GPIO_PIN(GPIO_Pin));
392
393 tmp |= GPIO_Pin;
\ 00000006 89B2 UXTH R1,R1 ;; ZeroExtS R1,R1,#+16,#+16
\ 00000008 0A43 ORRS R2,R2,R1
394 /* Set LCKK bit */
395 GPIOx->LCKR = tmp;
\ 0000000A 8261 STR R2,[R0, #+24]
396 /* Reset LCKK bit */
397 GPIOx->LCKR = GPIO_Pin;
\ 0000000C 89B2 UXTH R1,R1 ;; ZeroExtS R1,R1,#+16,#+16
\ 0000000E 8161 STR R1,[R0, #+24]
398 /* Set LCKK bit */
399 GPIOx->LCKR = tmp;
\ 00000010 8261 STR R2,[R0, #+24]
400 /* Read LCKK bit*/
401 tmp = GPIOx->LCKR;
\ 00000012 8369 LDR R3,[R0, #+24]
\ 00000014 1A00 MOVS R2,R3
402 /* Read LCKK bit*/
403 tmp = GPIOx->LCKR;
\ 00000016 8369 LDR R3,[R0, #+24]
\ 00000018 1A00 MOVS R2,R3
404 }
\ 0000001A 7047 BX LR ;; return
405
406 /*******************************************************************************
407 * Function Name : GPIO_EventOutputConfig
408 * Description : Selects the GPIO pin used as Event output.
409 * Input : - GPIO_PortSource: selects the GPIO port to be used as source
410 * for Event output.
411 * This parameter can be GPIO_PortSourceGPIOx where x can be
412 * (A..E).
413 * - GPIO_PinSource: specifies the pin for the Event output.
414 * This parameter can be GPIO_PinSourcex where x can be (0..15).
415 * Output : None
416 * Return : None
417 *******************************************************************************/
\ In section .XML, align 4, keep-with-next
418 void GPIO_EventOutputConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)
419 {
420 u32 tmpreg = 0x00;
\ GPIO_EventOutputConfig:
\ 00000000 0023 MOVS R3,#+0
\ 00000002 1A00 MOVS R2,R3
421
422 /* Check the parameters */
423 assert_param(IS_GPIO_PORT_SOURCE(GPIO_PortSource));
424 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
425
426 tmpreg = AFIO->EVCR;
\ 00000004 064B LDR.N R3,??GPIO_EventOutputConfig_0 ;; 0x40010000
\ 00000006 1B68 LDR R3,[R3, #+0]
\ 00000008 1A00 MOVS R2,R3
427 /* Clear the PORT[6:4] and PIN[3:0] bits */
428 tmpreg &= EVCR_PORTPINCONFIG_MASK;// ((u16)0xFF80)
\ 0000000A 1300 MOVS R3,R2
\ 0000000C 054A LDR.N R2,??GPIO_EventOutputConfig_0+0x4 ;; 0xff80
\ 0000000E 1A40 ANDS R2,R2,R3
429 tmpreg |= (u32)GPIO_PortSource << 0x04;
\ 00000010 C0B2 UXTB R0,R0 ;; ZeroExtS R0,R0,#+24,#+24
\ 00000012 52EA0012 ORRS R2,R2,R0, LSL #+4
430 tmpreg |= GPIO_PinSource;
\ 00000016 C9B2 UXTB R1,R1 ;; ZeroExtS R1,R1,#+24,#+24
\ 00000018 0A43 ORRS R2,R2,R1
431
432 AFIO->EVCR = tmpreg;
\ 0000001A 014B LDR.N R3,??GPIO_EventOutputConfig_0 ;; 0x40010000
\ 0000001C 1A60 STR R2,[R3, #+0]
433 }
\ 0000001E 7047 BX LR ;; return
\ ??GPIO_EventOutputConfig_0:
\ 00000020 00000140 DC32 0x40010000
\ 00000024 80FF0000 DC32 0xff80
434
435 /*******************************************************************************
436 * Function Name : GPIO_EventOutputCmd
437 * Description : Enables or disables the Event Output.
438 * Input : - NewState: new state of the Event output.
439 * This parameter can be: ENABLE or DISABLE.
440 * Output : None
441 * Return : None
442 *******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -