⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib_at91.s

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 S
字号:
	.file	"c:/at91/software/projects/bench/source/lib_at91.c"
	.option	svr4
	.option	thumb_code
	.option	inter
	.ident	"hc4.5a -O7 \n"
	.option	noswst
	.seg	".rodata1",rodata
.L00STRING2:
	.align	4
	.global	PIO_DESC
PIO_DESC:
	.size	PIO_DESC,0x8
	.type	PIO_DESC, @object
	.long	0xffff0000
	.byte	0x8
	.byte	0x1f
	.block	 0x2
	.align	4
	.global	USART0_DESC
USART0_DESC:
	.size	USART0_DESC,0xc
	.type	USART0_DESC, @object
	.long	0xfffd0000
	.long	PIO_DESC
	.byte	0xf
	.byte	0xe
	.byte	0xd
	.byte	0x2
	.align	4
	.global	USART1_DESC
USART1_DESC:
	.size	USART1_DESC,0xc
	.type	USART1_DESC, @object
	.long	0xfffcc000
	.long	PIO_DESC
	.byte	0x16
	.byte	0x15
	.byte	0x14
	.byte	0x3
	.align	4
	.global	TC0_DESC
TC0_DESC:
	.size	TC0_DESC,0xc
	.type	TC0_DESC, @object
	.long	0xfffe0000
	.long	PIO_DESC
	.byte	0x4
	.byte	0x1
	.byte	0x2
	.byte	0x0
	.align	4
	.global	TC1_DESC
TC1_DESC:
	.size	TC1_DESC,0xc
	.type	TC1_DESC, @object
	.long	0xfffe0040
	.long	PIO_DESC
	.byte	0x5
	.byte	0x4
	.byte	0x5
	.byte	0x3
	.align	4
	.global	TC2_DESC
TC2_DESC:
	.size	TC2_DESC,0xc
	.type	TC2_DESC, @object
	.long	0xfffe0080
	.long	PIO_DESC
	.byte	0x6
	.byte	0x7
	.byte	0x8
	.byte	0x6
	.align	4
	.global	TCB_DESC
TCB_DESC:
	.size	TCB_DESC,0xc
	.type	TCB_DESC, @object
	.long	TC0_DESC
	.long	TC1_DESC
	.long	TC2_DESC
	.seg	".data",data
.L00DATA:
	.align	4
	.global	Pio
Pio:
	.size	Pio,0x4
	.type	Pio, @object
	.long	0xffff0000
	.seg	".text",text
	.option	code16,inter
.L00TEXT:
;-------------| at91_spurious_handler |-------------------
	.global	at91_spurious_handler
at91_spurious_handler:
	.cfa_bf	at91_spurious_handler
.L0014:
	b	.L0014
	.cfa_ef
	.type at91_spurious_handler, @function
	.size at91_spurious_handler, . - at91_spurious_handler
;-------------| at91_default_irq_handler |-------------------
	.global	at91_default_irq_handler
at91_default_irq_handler:
	.cfa_bf	at91_default_irq_handler
.L0024:
	b	.L0024
	.cfa_ef
	.type at91_default_irq_handler, @function
	.size at91_default_irq_handler, . - at91_default_irq_handler
;-------------| at91_default_fiq_handler |-------------------
	.global	at91_default_fiq_handler
at91_default_fiq_handler:
	.cfa_bf	at91_default_fiq_handler
.L0034:
	b	.L0034
	.cfa_ef
	.type at91_default_fiq_handler, @function
	.size at91_default_fiq_handler, . - at91_default_fiq_handler
;-------------| at91_pio_open |-------------------
	.global	at91_pio_open
at91_pio_open:
	.cfa_bf	at91_pio_open
	mov	%r3,#1
	tst	%r2,%r3
	beq	.L0085
	ldr	%r0,[%r0, #0]
	str	%r1,[%r0, #16]
	mov	%r3,#2
	tst	%r2,%r3
	beq	.L0088
	b	.L0087
.L0085:
	ldr	%r0,[%r0, #0]
	str	%r1,[%r0, #20]
	mov	%r3,#2
	tst	%r2,%r3
	beq	.L0088
.L0087:
	str	%r1,[%r0, #32]
	mov	%r3,#4
	tst	%r2,%r3
	beq	.L00811
	b	.L00810
.L0088:
	str	%r1,[%r0, #36]
	mov	%r3,#4
	tst	%r2,%r3
	beq	.L00811
.L00810:
	str	%r1,[%r0, #0x50]
	mov	%r3,#8
	tst	%r2,%r3
	bne	.L00813
	str	%r1,[%r0, #0x44]
	str	%r1,[%r0, #0]
	bx	%lr
.L00811:
	str	%r1,[%r0, #0x58]
	mov	%r3,#8
	tst	%r2,%r3
	beq	.L00814
.L00813:
	ldr	%r3,[%r0, #0x4c]
	str	%r1,[%r0, #64]
	str	%r1,[%r0, #0]
	bx	%lr
.L00814:
	str	%r1,[%r0, #0x44]
	str	%r1,[%r0, #0]
	bx	%lr
	.cfa_ef
	.type at91_pio_open, @function
	.size at91_pio_open, . - at91_pio_open
;-------------| at91_pio_close |-------------------
	.global	at91_pio_close
at91_pio_close:
	.cfa_bf	at91_pio_close
	ldr	%r3,[%r0, #0]
	str	%r1,[%r3, #4]
	bx	%lr
	.cfa_ef
	.type at91_pio_close, @function
	.size at91_pio_close, . - at91_pio_close
;-------------| at91_pio_write |-------------------
	.global	at91_pio_write
at91_pio_write:
	.cfa_bf	at91_pio_write
	cmp	%r2,#1
	bne	.L0105
	ldr	%r3,[%r0, #0]
	str	%r1,[%r3, #52]
	bx	%lr
.L0105:
	ldr	%r3,[%r0, #0]
	str	%r1,[%r3, #48]
	bx	%lr
	.cfa_ef
	.type at91_pio_write, @function
	.size at91_pio_write, . - at91_pio_write
;-------------| at91_pio_read |-------------------
	.global	at91_pio_read
at91_pio_read:
	.cfa_bf	at91_pio_read
	push	{%r7,%lr}
	.cfa_push	{%r7,%lr}
	ldrb	%r2,[%r0, #4]
	mov	%r3,#1
	lsl	%r3,%r2
	ldr	%r7,[%pc, #.LC01-.-4]
	ldr	%r1,[%r7, #12]
	and	%r1,%r3
	str	%r3,[%r7, #4]
	ldr	%r2,[%r0, #0]
	ldr	%r0,[%r2, #60]
	cmp	%r1,#0
	bne	.L0118
	str	%r3,[%r7, #8]
.L0118:
	.cfa_remember_state
	pop	{%r7}
	.cfa_pop	{%r7}
	pop	{%r3}
	.cfa_pop	{%r3}
	bx	%r3
	.cfa_restore_state
	.cfa_ef
	.type at91_pio_read, @function
	.size at91_pio_read, . - at91_pio_read
;-------------| at91_pio_set_mode |-------------------
	.global	at91_pio_set_mode
at91_pio_set_mode:
	.cfa_bf	at91_pio_set_mode
	mov	%r3,#2
	tst	%r2,%r3
	beq	.L0125
	ldr	%r0,[%r0, #0]
	str	%r1,[%r0, #32]
	mov	%r3,#4
	tst	%r2,%r3
	bne	.L0127
	str	%r1,[%r0, #0x58]
	bx	%lr
.L0125:
	ldr	%r0,[%r0, #0]
	str	%r1,[%r0, #36]
	mov	%r3,#4
	tst	%r2,%r3
	beq	.L0128
.L0127:
	str	%r1,[%r0, #0x50]
	bx	%lr
.L0128:
	str	%r1,[%r0, #0x58]
	bx	%lr
	.cfa_ef
	.type at91_pio_set_mode, @function
	.size at91_pio_set_mode, . - at91_pio_set_mode
;-------------| at91_clock_set_mode |-------------------
	.global	at91_clock_set_mode
at91_clock_set_mode:
	.cfa_bf	at91_clock_set_mode
	cmp	%r0,#1
	bne	.L0148
	mov	%r2,#1
	ldr	%r3,[%pc, #.LC01-.-4]
	str	%r2,[%r3, #0]
	bx	%lr
.L0145:
	mov	%r2,#1
	neg	%r2,%r2
	ldr	%r3,[%pc, #.LC01-.-4]
	str	%r2,[%r3, #4]
	bx	%lr
.L0146:
	mov	%r2,#1
	neg	%r2,%r2
	ldr	%r3,[%pc, #.LC01-.-4]
	str	%r2,[%r3, #8]
	bx	%lr
.L0148:
	cmp	%r0,#2
	beq	.L0145
	cmp	%r0,#3
	beq	.L0146
	bx	%lr
	.cfa_ef
	.type at91_clock_set_mode, @function
	.size at91_clock_set_mode, . - at91_clock_set_mode
;-------------| at91_clock_get_status |-------------------
	.global	at91_clock_get_status
at91_clock_get_status:
	.cfa_bf	at91_clock_get_status
	mov	%r2,#1
	lsl	%r2,%r0
	ldr	%r3,[%pc, #.LC01-.-4]
	ldr	%r0,[%r3, #12]
	and	%r0,%r2
	bx	%lr
	.cfa_ef
	.type at91_clock_get_status, @function
	.size at91_clock_get_status, . - at91_clock_get_status
;-------------| at91_clock_open |-------------------
	.global	at91_clock_open
at91_clock_open:
	.cfa_bf	at91_clock_open
	mov	%r2,#1
	lsl	%r2,%r0
	ldr	%r3,[%pc, #.LC01-.-4]
	str	%r2,[%r3, #4]
	bx	%lr
	.cfa_ef
	.type at91_clock_open, @function
	.size at91_clock_open, . - at91_clock_open
;-------------| at91_clock_close |-------------------
	.global	at91_clock_close
at91_clock_close:
	.cfa_bf	at91_clock_close
	mov	%r2,#1
	lsl	%r2,%r0
	ldr	%r3,[%pc, #.LC01-.-4]
	str	%r2,[%r3, #8]
	bx	%lr
	.cfa_ef
	.type at91_clock_close, @function
	.size at91_clock_close, . - at91_clock_close
;-------------| at91_usart_open |-------------------
	.global	at91_usart_open
at91_usart_open:
	.cfa_bf	at91_usart_open
	push	{%r4-%r7,%lr}
	.cfa_push	{%r4-%r7,%lr}
	sub	%sp,#4
	.cfa_push	4
	str	%r2,[%sp, #0]
	ldrb	%r2,[%r0, #11]
	mov	%r7,#1
	mov	%r5,%r7
	lsl	%r5,%r2
	ldr	%r2,[%pc, #.LC01-.-4]
	str	%r5,[%r2, #4]
	ldr	%r2,[%pc, #.LC01+4-.-4]
	tst	%r1,%r2
	beq	.L0297
	ldr	%r2,[%r0, #4]
	ldrb	%r5,[%r0, #9]
	mov	%r4,%r7
	lsl	%r4,%r5
	ldrb	%r6,[%r0, #8]
	mov	%r5,%r7
	lsl	%r5,%r6
	orr	%r5,%r4
	ldrb	%r4,[%r0, #10]
	lsl	%r7,%r4
	orr	%r7,%r5
	ldr	%r2,[%r2, #0]
	b	.L0294
.L0297:
	ldr	%r5,[%r0, #4]
	ldrb	%r4,[%r0, #9]
	mov	%r2,%r7
	lsl	%r2,%r4
	ldrb	%r4,[%r0, #8]
	lsl	%r7,%r4
	orr	%r7,%r2
	ldr	%r2,[%r5, #0]
.L0294:
	str	%r7,[%r2, #4]
	mov	%r2,#172
	ldr	%r0,[%r0, #0]
	str	%r2,[%r0, #0]
	mov	%r2,#0
	str	%r2,[%r0, #52]
	str	%r2,[%r0, #60]
	ldr	%r2,[%sp, #0]
	str	%r2,[%r0, #32]
	str	%r1,[%r0, #4]
	str	%r3,[%r0, #40]
	mov	%r3,#80
	str	%r3,[%r0, #0]
	.cfa_remember_state
	add	%sp,#4
	.cfa_pop	4
	pop	{%r4-%r7}
	.cfa_pop	{%r4-%r7}
	pop	{%r3}
	.cfa_pop	{%r3}
	bx	%r3
	.cfa_restore_state
	.cfa_ef
	.type at91_usart_open, @function
	.size at91_usart_open, . - at91_usart_open
;-------------| at91_usart_close |-------------------
	.global	at91_usart_close
at91_usart_close:
	.cfa_bf	at91_usart_close
	push	{%r7,%lr}
	.cfa_push	{%r7,%lr}
	mov	%r7,%r0
	ldrb	%r2,[%r7, #11]
	mov	%r3,#1
	mov	%r1,%r3
	lsl	%r1,%r2
	ldr	%r2,[%pc, #.LC01-.-4]
	str	%r1,[%r2, #8]
	ldrb	%r2,[%r7, #9]
	mov	%r0,%r3
	lsl	%r0,%r2
	ldrb	%r2,[%r7, #8]
	mov	%r1,%r3
	lsl	%r1,%r2
	orr	%r1,%r0
	ldrb	%r2,[%r7, #10]
	lsl	%r3,%r2
	ldr	%r0,[%r7, #4]
	orr	%r1,%r3
	mov	%r2,#0
	bl	at91_pio_open
	mov	%r3,#1
	neg	%r3,%r3
	ldr	%r2,[%r7, #0]
	str	%r3,[%r2, #12]
	mov	%r3,#0
	str	%r3,[%r2, #52]
	str	%r3,[%r2, #60]
	mov	%r3,#172
	str	%r3,[%r2, #0]
	.cfa_remember_state
	pop	{%r7}
	.cfa_pop	{%r7}
	pop	{%r3}
	.cfa_pop	{%r3}
	bx	%r3
	.cfa_restore_state
	.cfa_ef
	.type at91_usart_close, @function
	.size at91_usart_close, . - at91_usart_close
;-------------| at91_usart_get_status |-------------------
	.global	at91_usart_get_status
at91_usart_get_status:
	.cfa_bf	at91_usart_get_status
	ldr	%r3,[%r0, #0]
	ldr	%r0,[%r3, #20]
	bx	%lr
	.cfa_ef
	.type at91_usart_get_status, @function
	.size at91_usart_get_status, . - at91_usart_get_status
;-------------| at91_usart_trig_cmd |-------------------
	.global	at91_usart_trig_cmd
at91_usart_trig_cmd:
	.cfa_bf	at91_usart_trig_cmd
	ldr	%r3,[%r0, #0]
	str	%r1,[%r3, #0]
	bx	%lr
	.cfa_ef
	.type at91_usart_trig_cmd, @function
	.size at91_usart_trig_cmd, . - at91_usart_trig_cmd
;-------------| at91_usart_write |-------------------
	.global	at91_usart_write
at91_usart_write:
	.cfa_bf	at91_usart_write
	ldr	%r3,[%r0, #0]
	str	%r1,[%r3, #28]
	bx	%lr
	.cfa_ef
	.type at91_usart_write, @function
	.size at91_usart_write, . - at91_usart_write
;-------------| at91_usart_read |-------------------
	.global	at91_usart_read
at91_usart_read:
	.cfa_bf	at91_usart_read
	ldr	%r3,[%r0, #0]
	ldr	%r3,[%r3, #24]
	str	%r3,[%r1, #0]
	bx	%lr
	.cfa_ef
	.type at91_usart_read, @function
	.size at91_usart_read, . - at91_usart_read
;-------------| at91_usart_receive_frame |-------------------
	.global	at91_usart_receive_frame
at91_usart_receive_frame:
	.cfa_bf	at91_usart_receive_frame
	push	{%r7,%lr}
	.cfa_push	{%r7,%lr}
	mov	%r7,#10
	mul	%r7,%r3
	lsr	%r7,#2
	ldr	%r0,[%r0, #0]
	str	%r7,[%r0, #36]
	mov	%r3,#128
	lsl	%r3,#4
	str	%r3,[%r0, #0]
	str	%r1,[%r0, #48]
	str	%r2,[%r0, #52]
	mov	%r0,#1
	.cfa_remember_state
	pop	{%r7}
	.cfa_pop	{%r7}
	pop	{%r3}
	.cfa_pop	{%r3}
	bx	%r3
	.cfa_restore_state
	.cfa_ef
	.type at91_usart_receive_frame, @function
	.size at91_usart_receive_frame, . - at91_usart_receive_frame
;-------------| at91_usart_send_frame |-------------------
	.global	at91_usart_send_frame
at91_usart_send_frame:
	.cfa_bf	at91_usart_send_frame
	push	{%r7,%lr}
	.cfa_push	{%r7,%lr}
	ldr	%r7,[%r0, #0]
	mov	%r0,#16
.L0364:
	ldr	%r3,[%r7, #20]
	tst	%r3,%r0
	beq	.L0364
	str	%r1,[%r7, #56]
	str	%r2,[%r7, #60]
	mov	%r0,#1
	.cfa_remember_state
	pop	{%r7}
	.cfa_pop	{%r7}
	pop	{%r3}
	.cfa_pop	{%r3}
	bx	%r3
	.cfa_restore_state
	.cfa_ef
	.type at91_usart_send_frame, @function
	.size at91_usart_send_frame, . - at91_usart_send_frame
;-------------| at91_tc_open |-------------------
	.global	at91_tc_open
at91_tc_open:
	.cfa_bf	at91_tc_open
	push	{%r4,%r5,%r7,%lr}
	.cfa_push	{%r4,%r5,%r7,%lr}
	ldrb	%r7,[%r0, #8]
	mov	%r5,#1
	mov	%r4,%r5
	lsl	%r4,%r7
	ldr	%r7,[%pc, #.LC01-.-4]
	str	%r4,[%r7, #4]
	ldrb	%r4,[%r0, #11]
	mov	%r7,%r5
	lsl	%r7,%r4
	cmp	%r2,#1
	bne	.L0434
	ldrb	%r2,[%r0, #9]
	mov	%r4,%r5
	lsl	%r4,%r2
	orr	%r7,%r4
.L0434:
	cmp	%r3,#1
	bne	.L0438
	ldrb	%r3,[%r0, #10]
	mov	%r2,%r5
	lsl	%r2,%r3
	orr	%r7,%r2
.L0438:
	ldr	%r3,[%r0, #4]
	ldr	%r3,[%r3, #0]
	str	%r7,[%r3, #4]
	mov	%r3,#2
	ldr	%r2,[%r0, #0]
	str	%r3,[%r2, #0]
	mov	%r3,#1
	neg	%r3,%r3
	str	%r3,[%r2, #40]
	ldr	%r3,[%r2, #32]
	str	%r1,[%r2, #4]
	str	%r5,[%r2, #0]
	.cfa_remember_state
	pop	{%r4,%r5,%r7}
	.cfa_pop	{%r4,%r5,%r7}
	pop	{%r3}
	.cfa_pop	{%r3}
	bx	%r3
	.cfa_restore_state
	.cfa_ef
	.type at91_tc_open, @function
	.size at91_tc_open, . - at91_tc_open
	.align	4
.LC01:
	.long	0xffff4000
	.long	0x40020
;-------------| at91_tc_close |-------------------
	.global	at91_tc_close
at91_tc_close:
	.cfa_bf	at91_tc_close
	mov	%r3,#2
	ldr	%r2,[%r0, #0]
	str	%r3,[%r2, #0]
	mov	%r3,#1
	neg	%r3,%r3
	str	%r3,[%r2, #40]
	ldrb	%r2,[%r0, #8]
	mov	%r3,#1
	lsl	%r3,%r2
	ldr	%r2,[%pc, #.LC02-.-4]
	str	%r3,[%r2, #8]
	bx	%lr
	.cfa_ef
	.type at91_tc_close, @function
	.size at91_tc_close, . - at91_tc_close
;-------------| at91_tc_get_status |-------------------
	.global	at91_tc_get_status
at91_tc_get_status:
	.cfa_bf	at91_tc_get_status
	ldr	%r3,[%r0, #0]
	ldr	%r0,[%r3, #32]
	bx	%lr
	.cfa_ef
	.type at91_tc_get_status, @function
	.size at91_tc_get_status, . - at91_tc_get_status
;-------------| at91_tc_trig_cmd |-------------------
	.global	at91_tc_trig_cmd
at91_tc_trig_cmd:
	.cfa_bf	at91_tc_trig_cmd
	cmp	%r1,#1
	bne	.L0467
	mov	%r2,#4
	ldr	%r3,[%r0, #0]
	str	%r2,[%r3, #0]
	bx	%lr
.L0465:
	ldr	%r2,[%r0, #0]
	mov	%r3,#240
	and	%r3,%r2
	mov	%r2,#1
	add	%r3,#128
	str	%r2,[%r3, #64]
	bx	%lr
.L0467:
	cmp	%r1,#2
	beq	.L0465
	bx	%lr
	.cfa_ef
	.type at91_tc_trig_cmd, @function
	.size at91_tc_trig_cmd, . - at91_tc_trig_cmd
;-------------| at91_tc_set_mode |-------------------
	.global	at91_tc_set_mode
at91_tc_set_mode:
	.cfa_bf	at91_tc_set_mode
	cmp	%r2,#0
	beq	.L0475
	ldr	%r2,[%r0, #0]
	ldr	%r3,[%r2, #4]
	orr	%r3,%r1
	str	%r3,[%r2, #4]
	bx	%lr
.L0475:
	ldr	%r2,[%r0, #0]
	ldr	%r3,[%r2, #4]
	bic	%r3,%r1
	str	%r3,[%r2, #4]
	bx	%lr
	.cfa_ef
	.type at91_tc_set_mode, @function
	.size at91_tc_set_mode, . - at91_tc_set_mode
;-------------| at91_tc_read |-------------------
	.global	at91_tc_read
at91_tc_read:
	.cfa_bf	at91_tc_read
	ldr	%r2,[%r0, #0]
	ldr	%r3,[%r2, #20]
	str	%r3,[%r1, #0]
	ldr	%r3,[%r2, #24]
	str	%r3,[%r1, #4]
	ldr	%r3,[%r2, #28]
	str	%r3,[%r1, #8]
	ldr	%r3,[%r2, #16]
	str	%r3,[%r1, #12]
	bx	%lr
	.cfa_ef
	.type at91_tc_read, @function
	.size at91_tc_read, . - at91_tc_read
;-------------| at91_tc_write |-------------------
	.global	at91_tc_write
at91_tc_write:
	.cfa_bf	at91_tc_write
	ldr	%r3,[%r1, #0]
	ldr	%r2,[%r0, #0]
	str	%r3,[%r2, #20]
	ldr	%r3,[%r1, #4]
	str	%r3,[%r2, #24]
	ldr	%r3,[%r1, #8]
	str	%r3,[%r2, #28]
	bx	%lr
	.cfa_ef
	.type at91_tc_write, @function
	.size at91_tc_write, . - at91_tc_write
	.align	4
.LC02:
	.long	0xffff4000
	.end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -