	.file	"extr_bxe_elink.c_elink_bsc_read.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"invalid xfer_cnt %d. Max is 16 bytes\n"
	.align 8
.LC1:
	.string	"wr 0 byte timed out after %d try\n"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"rd op timed out after %d try\n"
	.text
	.p2align 4
	.type	elink_bsc_read, @function
elink_bsc_read:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 8
	.cfi_def_cfa_offset 64
	cmp	r8d, 16
	jg	.L14
	mov	ebx, esi
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_COMMAND[rip]
	mov	r13d, ecx
	mov	r12, r9
	mov	r15d, edx
	mov	r14, QWORD PTR ELINK_STATUS_OK[rip]
	call	REG_RD@PLT
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_COMMAND[rip]
	or	eax, DWORD PTR MCPR_IMC_COMMAND_ENABLE[rip]
	mov	rdi, rbp
	mov	edx, eax
	call	REG_WR@PLT
	mov	edx, ebx
	mov	rdi, rbp
	mov	ebx, 1002
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_SLAVE_CONTROL[rip]
	sal	edx, 16
	or	edx, r15d
	call	REG_WR@PLT
	mov	ecx, DWORD PTR MCPR_IMC_COMMAND_OPERATION_BITSHIFT[rip]
	mov	eax, r13d
	mov	edx, DWORD PTR MCPR_IMC_COMMAND_WRITE_OP[rip]
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_COMMAND[rip]
	mov	rdi, rbp
	sal	edx, cl
	mov	ecx, DWORD PTR MCPR_IMC_COMMAND_TRANSFER_ADDRESS_BITSHIFT[rip]
	or	edx, DWORD PTR MCPR_IMC_COMMAND_ENABLE[rip]
	sal	eax, cl
	or	edx, eax
	call	REG_WR@PLT
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_COMMAND[rip]
	mov	rdi, rbp
	call	REG_RD@PLT
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	mov	edi, 10
	call	DELAY@PLT
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_COMMAND[rip]
	mov	rdi, rbp
	call	REG_RD@PLT
	sub	ebx, 1
	je	.L15
.L4:
	mov	ecx, DWORD PTR MCPR_IMC_COMMAND_IMC_STATUS_BITSHIFT[rip]
	sar	eax, cl
	and	eax, 3
	cmp	eax, 1
	jne	.L5
	cmp	QWORD PTR ELINK_STATUS_TIMEOUT[rip], r14
	je	.L1
	mov	ecx, DWORD PTR MCPR_IMC_COMMAND_OPERATION_BITSHIFT[rip]
	mov	edx, DWORD PTR MCPR_IMC_COMMAND_READ_OP[rip]
	mov	eax, r13d
	mov	rdi, rbp
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_COMMAND[rip]
	mov	ebx, 1002
	sal	edx, cl
	mov	ecx, DWORD PTR MCPR_IMC_COMMAND_TRANSFER_ADDRESS_BITSHIFT[rip]
	or	edx, DWORD PTR MCPR_IMC_COMMAND_ENABLE[rip]
	sal	eax, cl
	or	edx, eax
	mov	eax, 16
	sub	eax, r13d
	or	edx, eax
	call	REG_WR@PLT
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_COMMAND[rip]
	mov	rdi, rbp
	call	REG_RD@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	mov	edi, 10
	call	DELAY@PLT
	mov	rsi, QWORD PTR MCP_REG_MCPR_IMC_COMMAND[rip]
	mov	rdi, rbp
	call	REG_RD@PLT
	sub	ebx, 1
	je	.L16
.L6:
	mov	ecx, DWORD PTR MCPR_IMC_COMMAND_IMC_STATUS_BITSHIFT[rip]
	sar	eax, cl
	and	eax, 3
	cmp	eax, 1
	jne	.L7
	cmp	QWORD PTR ELINK_STATUS_TIMEOUT[rip], r14
	je	.L1
	mov	ebx, r13d
	sar	ebx, 2
	cmp	r13d, 15
	jg	.L1
	movsx	rbx, ebx
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rax, QWORD PTR MCP_REG_MCPR_IMC_DATAREG0[rip]
	mov	rdi, rbp
	lea	rsi, [rax+rbx*4]
	call	REG_RD@PLT
	mov	DWORD PTR [r12+rbx*4], eax
	add	rbx, 1
	cmp	ebx, 3
	jle	.L8
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rax, r14
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	mov	edx, r8d
	lea	rsi, .LC0[rip]
	call	ELINK_DEBUG_P1@PLT
	mov	r14, QWORD PTR ELINK_STATUS_ERROR[rip]
	jmp	.L1
.L15:
	mov	edx, 1002
	lea	rsi, .LC1[rip]
	mov	rdi, rbp
	call	ELINK_DEBUG_P1@PLT
	mov	r14, QWORD PTR ELINK_STATUS_TIMEOUT[rip]
	jmp	.L1
.L16:
	mov	edx, 1002
	lea	rsi, .LC2[rip]
	mov	rdi, rbp
	call	ELINK_DEBUG_P1@PLT
	mov	r14, QWORD PTR ELINK_STATUS_TIMEOUT[rip]
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	elink_bsc_read, .-elink_bsc_read
	.comm	MCP_REG_MCPR_IMC_SLAVE_CONTROL,8,8
	.comm	MCP_REG_MCPR_IMC_DATAREG0,8,8
	.comm	MCP_REG_MCPR_IMC_COMMAND,8,8
	.comm	MCPR_IMC_COMMAND_WRITE_OP,4,4
	.comm	MCPR_IMC_COMMAND_TRANSFER_ADDRESS_BITSHIFT,4,4
	.comm	MCPR_IMC_COMMAND_READ_OP,4,4
	.comm	MCPR_IMC_COMMAND_OPERATION_BITSHIFT,4,4
	.comm	MCPR_IMC_COMMAND_IMC_STATUS_BITSHIFT,4,4
	.comm	MCPR_IMC_COMMAND_ENABLE,4,4
	.comm	ELINK_STATUS_TIMEOUT,8,8
	.comm	ELINK_STATUS_OK,8,8
	.comm	ELINK_STATUS_ERROR,8,8
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_bxe_elink.c_elink_bsc_read.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"invalid xfer_cnt %d. Max is 16 bytes\012\000"
	.align	2
.LC1:
	.ascii	"wr 0 byte timed out after %d try\012\000"
	.align	2
.LC2:
	.ascii	"rd op timed out after %d try\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	elink_bsc_read, %function
elink_bsc_read:
	@ args = 8, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r3, r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	ip, [sp, #40]
	cmp	ip, #16
	bgt	.L14
	ldr	r5, .L17
	mov	r6, r3
	ldr	r3, .L17+4
	mov	r10, r1
	ldr	r1, [r5]
	mov	r4, r0
	mov	r9, r2
	ldr	r7, [r3]
	bl	REG_RD
	mov	r2, r0
	ldr	r8, .L17+8
	ldr	r1, [r5]
	ldr	r3, [r8]
	mov	r0, r4
	orr	r2, r2, r3
	bl	REG_WR
	ldr	r3, .L17+12
	orr	r2, r9, r10, lsl #16
	ldr	r1, [r3]
	mov	r0, r4
	bl	REG_WR
	ldr	r2, .L17+16
	ldr	r10, .L17+20
	ldr	r0, [r2]
	ldr	r2, .L17+24
	ldr	r1, [r10]
	ldr	r3, [r8]
	ldr	r2, [r2]
	orr	r3, r3, r0, lsl r1
	orr	r2, r3, r6, lsl r2
	ldr	r1, [r5]
	mov	r0, r4
	bl	REG_WR
	mov	r0, r4
	ldr	r1, [r5]
	bl	REG_RD
	ldr	fp, .L17+28
	ldr	r9, .L17+32
	b	.L4
.L5:
	mov	r0, #10
	bl	DELAY
	mov	r0, r4
	ldr	r1, [r5]
	bl	REG_RD
	subs	fp, fp, #1
	beq	.L15
.L4:
	ldr	r2, [r9]
	asr	r0, r0, r2
	and	r0, r0, #3
	cmp	r0, #1
	bne	.L5
	ldr	fp, .L17+36
	ldr	r2, [fp]
	cmp	r2, r7
	beq	.L1
	ldr	r1, .L17+40
	ldr	r3, .L17+24
	ldr	ip, [r1]
	ldr	r0, [r10]
	ldr	r2, [r8]
	ldr	r1, [r3]
	orr	r2, r2, ip, lsl r0
	orr	r2, r2, r6, lsl r1
	rsb	r1, r6, #16
	orr	r2, r2, r1
	mov	r0, r4
	ldr	r1, [r5]
	bl	REG_WR
	mov	r0, r4
	ldr	r1, [r5]
	bl	REG_RD
	ldr	r8, .L17+28
	b	.L6
.L7:
	mov	r0, #10
	bl	DELAY
	mov	r0, r4
	ldr	r1, [r5]
	bl	REG_RD
	subs	r8, r8, #1
	beq	.L16
.L6:
	ldr	r2, [r9]
	asr	r0, r0, r2
	and	r0, r0, #3
	cmp	r0, #1
	bne	.L7
	ldr	r3, [fp]
	cmp	r3, r7
	beq	.L1
	cmp	r6, #15
	asr	r6, r6, #2
	bgt	.L1
	ldr	r3, [sp, #44]
	sub	r6, r6, #-1073741823
	ldr	r9, .L17+44
	add	r5, r3, r6, lsl #2
	add	r8, r3, #12
	rsb	r6, r3, #4
.L8:
	ldr	r3, [r9]
	add	r1, r6, r5
	mov	r0, r4
	add	r1, r1, r3
	bl	REG_RD
	str	r0, [r5, #4]!
	cmp	r5, r8
	bne	.L8
.L1:
	mov	r0, r7
	pop	{r3, r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L14:
	mov	r2, ip
	ldr	r1, .L17+48
	bl	ELINK_DEBUG_P1
	ldr	r3, .L17+52
	ldr	r7, [r3]
	mov	r0, r7
	pop	{r3, r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L15:
	mov	r0, r4
	ldr	r2, .L17+28
	ldr	r1, .L17+56
	bl	ELINK_DEBUG_P1
	ldr	r3, .L17+36
	ldr	r7, [r3]
	b	.L1
.L16:
	mov	r0, r4
	ldr	r2, .L17+28
	ldr	r1, .L17+60
	bl	ELINK_DEBUG_P1
	ldr	r7, [fp]
	b	.L1
.L18:
	.align	2
.L17:
	.word	MCP_REG_MCPR_IMC_COMMAND
	.word	ELINK_STATUS_OK
	.word	MCPR_IMC_COMMAND_ENABLE
	.word	MCP_REG_MCPR_IMC_SLAVE_CONTROL
	.word	MCPR_IMC_COMMAND_WRITE_OP
	.word	MCPR_IMC_COMMAND_OPERATION_BITSHIFT
	.word	MCPR_IMC_COMMAND_TRANSFER_ADDRESS_BITSHIFT
	.word	1002
	.word	MCPR_IMC_COMMAND_IMC_STATUS_BITSHIFT
	.word	ELINK_STATUS_TIMEOUT
	.word	MCPR_IMC_COMMAND_READ_OP
	.word	MCP_REG_MCPR_IMC_DATAREG0
	.word	.LC0
	.word	ELINK_STATUS_ERROR
	.word	.LC1
	.word	.LC2
	.size	elink_bsc_read, .-elink_bsc_read
	.comm	MCP_REG_MCPR_IMC_SLAVE_CONTROL,4,4
	.comm	MCP_REG_MCPR_IMC_DATAREG0,4,4
	.comm	MCP_REG_MCPR_IMC_COMMAND,4,4
	.comm	MCPR_IMC_COMMAND_WRITE_OP,4,4
	.comm	MCPR_IMC_COMMAND_TRANSFER_ADDRESS_BITSHIFT,4,4
	.comm	MCPR_IMC_COMMAND_READ_OP,4,4
	.comm	MCPR_IMC_COMMAND_OPERATION_BITSHIFT,4,4
	.comm	MCPR_IMC_COMMAND_IMC_STATUS_BITSHIFT,4,4
	.comm	MCPR_IMC_COMMAND_ENABLE,4,4
	.comm	ELINK_STATUS_TIMEOUT,4,4
	.comm	ELINK_STATUS_OK,4,4
	.comm	ELINK_STATUS_ERROR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
