📄 lib_at91.lst
字号:
593 //* Store the address of the buffer
594 usart_pt->usart_base->US_RPR = (u_int) pt_buffer ;
\ 00000024 003090E5 LDR R3,[R0, #+0]
\ 00000028 301083E5 STR R1,[R3, #+48]
595
596 //* Store the number of bytes to receive
597 usart_pt->usart_base->US_RCR = max_size ;
\ 0000002C 001090E5 LDR R1,[R0, #+0]
\ 00000030 342081E5 STR R2,[R1, #+52]
598
599 //* Return true
600 return ( TRUE ) ;
\ 00000034 0100A0E3 MOV R0,#+0x1
\ 00000038 3000BDE8 LDMIA SP!,{R4,R5} ;; Pop
\ 0000003C 0EF0A0E1 MOV PC,LR ;; return
601 }
602 //* End
603 //*----------------------------------------------------------------------------
604 //* Function Name : at91_tc_open
605 //* Object : Initialize Timer Counter Channel and enable is clock
606 //* Input Parameters : <tc_pt> = TC Channel Descriptor Pointer
607 //* <mode> = Timer Counter Mode
608 //* : <tioa> = TIOA enabled as peripheral if non null
609 //* : <tiob> = TIOB enabled as peripheral if non null
610 //* Output Parameters : None
611 //* Functions called : at91_clock_open, at91_pio_close
612 //*----------------------------------------------------------------------------
\ In segment NEARFUNC_A, align 4, keep-with-next
\ 00000000 CODE32
613 void at91_tc_open ( const TCDesc *tc_pt, u_int mode, u_int tioa, u_int tiob )
614 //* Begin
615 {
\ at91_tc_open:
\ 00000000 F0412DE9 STMDB SP!,{R4-R8,LR} ;; Push
\ 00000004 0040A0E1 MOV R4,R0
\ 00000008 0150A0E1 MOV R5,R1
\ 0000000C 0280A0E1 MOV R8,R2
\ 00000010 0370A0E1 MOV R7,R3
616 u_int pio = 0 ;
617 //* Start the Clock of the Timer
618 at91_clock_open ( tc_pt->periph_id ) ;
\ 00000014 0460A0E1 MOV R6,R4
\ 00000018 0800D6E5 LDRB R0,[R6, #+8]
\ 0000001C ........ BL at91_clock_open
619
620 pio = 1<<tc_pt->pin_tclk ;
\ 00000020 0100A0E3 MOV R0,#+0x1
\ 00000024 0B20D6E5 LDRB R2,[R6, #+11]
\ 00000028 1012A0E1 MOV R1,R0, LSL R2
621 //* Enable TIOA pin if requested
622 if ( tioa == TRUE )
\ 0000002C 010058E3 CMP R8,#+0x1
623 {
624 pio |= 1<<tc_pt->pin_tioa ;
\ 00000030 0920D605 LDREQB R2,[R6, #+9]
\ 00000034 10128101 ORREQ R1,R1,R0, LSL R2
625 }
626 //* Enable TIOB pin if requested
627 if ( tiob == TRUE )
\ 00000038 010057E3 CMP R7,#+0x1
628 {
629 pio |= 1<<tc_pt->pin_tiob ;
\ 0000003C 0A20D605 LDREQB R2,[R6, #+10]
\ 00000040 10128101 ORREQ R1,R1,R0, LSL R2
630 }
631 at91_pio_close ( tc_pt->pio_ctrl, pio ) ;
\ 00000044 040096E5 LDR R0,[R6, #+4]
\ 00000048 ........ BL at91_pio_close
632
633 //* Disable the clock and the interrupts
634 tc_pt->tc_base->TC_CCR = TC_CLKDIS ;
\ 0000004C 0200A0E3 MOV R0,#+0x2
\ 00000050 001096E5 LDR R1,[R6, #+0]
\ 00000054 000081E5 STR R0,[R1, #+0]
635 tc_pt->tc_base->TC_IDR = 0xFFFFFFFF ;
\ 00000058 0000E0E3 MVN R0,#+0x0
\ 0000005C 001096E5 LDR R1,[R6, #+0]
\ 00000060 280081E5 STR R0,[R1, #+40]
636 pio = tc_pt->tc_base->TC_SR ;
\ 00000064 000096E5 LDR R0,[R6, #+0]
\ 00000068 201090E5 LDR R1,[R0, #+32]
637
638 //* Set the Mode of the Timer Counter
639 tc_pt->tc_base->TC_CMR = mode ;
\ 0000006C 045080E5 STR R5,[R0, #+4]
640
641 //* Enable the clock
642 tc_pt->tc_base->TC_CCR = TC_CLKEN ;
\ 00000070 0100A0E3 MOV R0,#+0x1
\ 00000074 001096E5 LDR R1,[R6, #+0]
\ 00000078 000081E5 STR R0,[R1, #+0]
643 //* End
644 }
\ 0000007C F081BDE8 LDMIA SP!,{R4-R8,PC} ;; return
645
646 //*----------------------------------------------------------------------------
647 //* Function Name : at91_tc_close
648 //* Object : Stop a Timer Counter Channel and disable is clock
649 //* Input Parameters : <tc_pt> = the channel number
650 //* Output Parameters : None
651 //* Functions called : at91_clock_close
652 //*----------------------------------------------------------------------------
\ In segment NEARFUNC_A, align 4, keep-with-next
\ 00000000 CODE32
653 void at91_tc_close ( const TCDesc *tc_pt )
654 //* Begin
655 {
\ at91_tc_close:
\ 00000000 00402DE9 STMDB SP!,{LR} ;; Push
656 //* Disable the clock and interrupts
657 tc_pt->tc_base->TC_CCR = TC_CLKDIS ;
\ 00000004 0010A0E1 MOV R1,R0
\ 00000008 0200A0E3 MOV R0,#+0x2
\ 0000000C 002091E5 LDR R2,[R1, #+0]
\ 00000010 000082E5 STR R0,[R2, #+0]
658 tc_pt->tc_base->TC_IDR = 0xFFFFFFFF ;
\ 00000014 0000E0E3 MVN R0,#+0x0
\ 00000018 002091E5 LDR R2,[R1, #+0]
\ 0000001C 280082E5 STR R0,[R2, #+40]
659
660 //* Stop the Clock of the Timer
661 at91_clock_close ( tc_pt->periph_id ) ;
\ 00000020 0800D1E5 LDRB R0,[R1, #+8]
\ 00000024 ........ BL at91_clock_close
662 //* End
663 }
\ 00000028 0080BDE8 LDMIA SP!,{PC} ;; return
664
665 //*----------------------------------------------------------------------------
666 //* Function Name : at91_tc_get_status
667 //* Object : Read the Status of a Timer Counter Channel
668 //* Input Parameters : <tc_pt> = the channel number
669 //* Output Parameters : the status value
670 //* Functions called : None
671 //*----------------------------------------------------------------------------
\ In segment NEARFUNC_A, align 4, keep-with-next
\ 00000000 CODE32
672 u_int at91_tc_get_status ( const TCDesc *tc_pt )
673 //* Begin
674 {
675 //* Return the value of the Status Register
676 return ( tc_pt->tc_base->TC_SR ) ;
\ at91_tc_get_status:
\ 00000000 001090E5 LDR R1,[R0, #+0]
\ 00000004 200091E5 LDR R0,[R1, #+32]
\ 00000008 0EF0A0E1 MOV PC,LR ;; return
677
678 //* End
679 }
680
681 //*----------------------------------------------------------------------------
682 //* Function Name : at91_tc_trig_cmd
683 //* Object : Generate a software trigger on a TC channel
684 //* Input Parameters : <tc_pt> = the channel number to trig
685 //* Output Parameters : None
686 //* Functions called : at91_error
687 //*----------------------------------------------------------------------------
\ In segment NEARFUNC_A, align 4, keep-with-next
\ 00000000 CODE32
688 void at91_tc_trig_cmd ( const TCDesc *tc_pt, u_int cmd )
689 //* Begin
690 {
\ at91_tc_trig_cmd:
\ 00000000 00402DE9 STMDB SP!,{LR} ;; Push
691 //* Depending on the command
692 switch (cmd)
\ 00000004 010051E3 CMP R1,#+0x1
\ 00000008 0200000A BEQ ??at91_tc_trig_cmd_0
\ 0000000C 020051E3 CMP R1,#+0x2
\ 00000010 0400000A BEQ ??at91_tc_trig_cmd_1
693 {
694 //* Case Channel Trigger
695 case TC_TRIG_CHANNEL:
696 //* Perform a Software trigger on the corresponding channel
697 tc_pt->tc_base->TC_CCR = TC_SWTRG ;
698 break ;
699
700 //* Case Synchronization Trigger
701 case TC_TRIG_BLOCK:
702 //* Perform a synchronization trigger
703 ((StructTCBlock *) ((u_int)tc_pt->tc_base & 0xF0))->TC_BCR = TC_SYNC ;
704 break ;
705
706 //* Unkonwn
707 // default :
708 //* Run the AT91 Library Error Macro
709 //$$$$ at91_error ("__FILE__","__LINE__") ;
710 //* End Switch
711 }
712 //* End
713 }
\ 00000014 0080BDE8 LDMIA SP!,{PC} ;; return
\ ??at91_tc_trig_cmd_0:
\ 00000018 0410A0E3 MOV R1,#+0x4
\ 0000001C 002090E5 LDR R2,[R0, #+0]
\ 00000020 001082E5 STR R1,[R2, #+0]
\ 00000024 0080BDE8 LDMIA SP!,{PC} ;; return
\ ??at91_tc_trig_cmd_1:
\ 00000028 0110A0E3 MOV R1,#+0x1
\ 0000002C 002090E5 LDR R2,[R0, #+0]
\ 00000030 F00002E2 AND R0,R2,#+0xF0
\ 00000034 C01080E5 STR R1,[R0, #+192]
\ 00000038 0080BDE8 LDMIA SP!,{PC} ;; return
714
715 //*----------------------------------------------------------------------------
716 //* Function Name : at91_tc_set_mode
717 //* Object : Update Timer Counter Mode Register with mask
718 //* Input Parameters : <tc_pt> = the channel number
719 //* : <mask> = bit to modify in the mode register
720 //* : <data> = set/clear bits in the mode register
721 //* Output Parameters : none
722 //* Functions called : none
723 //*----------------------------------------------------------------------------
\ In segment NEARFUNC_A, align 4, keep-with-next
\ 00000000 CODE32
724 void at91_tc_set_mode ( const TCDesc *tc_pt, u_int mask, u_int data )
725 //* Begin
726 {
727 //* If data is not null
728 if (data != 0)
\ at91_tc_set_mode:
\ 00000000 000052E3 CMP R2,#+0x0
\ 00000004 0300000A BEQ ??at91_tc_set_mode_0
729 //* Set bits in the Mode Register corresponding to the mask
730 tc_pt->tc_base->TC_CMR |= mask ;
\ 00000008 002090E5 LDR R2,[R0, #+0]
\ 0000000C 040092E5 LDR R0,[R2, #+4]
\ 00000010 010080E1 ORR R0,R0,R1
\ 00000014 030000EA B ??at91_tc_set_mode_1
731 //* Else
732 else
733 //* Clear bits in the Mode Register corresponding to the mask
734 tc_pt->tc_base->TC_CMR &= ~mask ;
\ ??at91_tc_set_mode_0:
\ 00000018 0110E0E1 MVN R1,R1
\ 0000001C 002090E5 LDR R2,[R0, #+0]
\ 00000020 040092E5 LDR R0,[
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -