	.file	"extr_spi.c_spi_erase_eeprom_chip.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	spi_erase_eeprom_chip
	.type	spi_erase_eeprom_chip, @function
spi_erase_eeprom_chip:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rdi
	call	spi_init_eeprom@PLT
	cmp	DWORD PTR STATUS_SUCCESS[rip], eax
	je	.L2
.L7:
	mov	eax, DWORD PTR STATUS_FAIL[rip]
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	rdi, rbp
	call	spi_eeprom_program_enable@PLT
	cmp	DWORD PTR STATUS_SUCCESS[rip], eax
	jne	.L7
	mov	rdi, rbp
	call	rtsx_init_cmd@PLT
	xor	r8d, r8d
	mov	ecx, 1
	mov	rdi, rbp
	mov	edx, DWORD PTR CARD_GPIO_DIR[rip]
	mov	esi, DWORD PTR WRITE_REG_CMD[rip]
	call	rtsx_add_cmd@PLT
	mov	r8d, DWORD PTR RING_BUFFER[rip]
	mov	edx, DWORD PTR CARD_DATA_SOURCE[rip]
	mov	rdi, rbp
	mov	esi, DWORD PTR WRITE_REG_CMD[rip]
	mov	ecx, 1
	call	rtsx_add_cmd@PLT
	mov	edx, DWORD PTR SPI_COMMAND[rip]
	mov	esi, DWORD PTR WRITE_REG_CMD[rip]
	mov	rdi, rbp
	mov	r8d, 18
	mov	ecx, 255
	call	rtsx_add_cmd@PLT
	mov	edx, DWORD PTR SPI_CA_NUMBER[rip]
	mov	esi, DWORD PTR WRITE_REG_CMD[rip]
	mov	rdi, rbp
	mov	r8d, 132
	mov	ecx, 255
	call	rtsx_add_cmd@PLT
	mov	edx, DWORD PTR SPI_TRANSFER0[rip]
	mov	esi, DWORD PTR WRITE_REG_CMD[rip]
	mov	rdi, rbp
	mov	r8d, DWORD PTR SPI_TRANSFER0_START[rip]
	mov	ecx, 255
	or	r8d, DWORD PTR SPI_CA_MODE0[rip]
	call	rtsx_add_cmd@PLT
	mov	ecx, DWORD PTR SPI_TRANSFER0_END[rip]
	mov	edx, DWORD PTR SPI_TRANSFER0[rip]
	mov	rdi, rbp
	mov	esi, DWORD PTR CHECK_REG_CMD[rip]
	mov	r8d, ecx
	call	rtsx_add_cmd@PLT
	xor	esi, esi
	mov	edx, 100
	mov	rdi, rbp
	call	rtsx_send_cmd@PLT
	test	eax, eax
	js	.L7
	mov	esi, DWORD PTR CARD_GPIO_DIR[rip]
	mov	rdi, rbp
	mov	ecx, 1
	mov	edx, 1
	call	rtsx_write_register@PLT
	pop	rbp
	.cfi_def_cfa_offset 8
	test	eax, eax
	cmove	eax, DWORD PTR STATUS_SUCCESS[rip]
	ret
	.cfi_endproc
.LFE0:
	.size	spi_erase_eeprom_chip, .-spi_erase_eeprom_chip
	.comm	WRITE_REG_CMD,4,4
	.comm	STATUS_SUCCESS,4,4
	.comm	STATUS_FAIL,4,4
	.comm	SPI_TRANSFER0_START,4,4
	.comm	SPI_TRANSFER0_END,4,4
	.comm	SPI_TRANSFER0,4,4
	.comm	SPI_COMMAND,4,4
	.comm	SPI_CA_NUMBER,4,4
	.comm	SPI_CA_MODE0,4,4
	.comm	RING_BUFFER,4,4
	.comm	CHECK_REG_CMD,4,4
	.comm	CARD_GPIO_DIR,4,4
	.comm	CARD_DATA_SOURCE,4,4
	.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_spi.c_spi_erase_eeprom_chip.c"
	.text
	.align	2
	.global	spi_erase_eeprom_chip
	.syntax unified
	.arm
	.fpu softvfp
	.type	spi_erase_eeprom_chip, %function
spi_erase_eeprom_chip:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	sub	sp, sp, #12
	mov	r4, r0
	bl	spi_init_eeprom
	ldr	r5, .L10
	ldr	r3, [r5]
	cmp	r3, r0
	beq	.L2
.L8:
	ldr	r3, .L10+4
	ldr	r0, [r3]
.L1:
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L2:
	mov	r0, r4
	bl	spi_eeprom_program_enable
	ldr	r3, [r5]
	cmp	r3, r0
	bne	.L8
	mov	r7, #0
	ldr	r6, .L10+8
	ldr	r9, .L10+12
	mov	r0, r4
	bl	rtsx_init_cmd
	mov	r3, #1
	ldr	r2, [r9]
	ldr	r1, [r6]
	mov	r0, r4
	str	r7, [sp]
	bl	rtsx_add_cmd
	ldr	r2, .L10+16
	ldr	r3, .L10+20
	ldr	r2, [r2]
	ldr	r1, [r6]
	str	r2, [sp]
	ldr	r2, [r3]
	mov	r0, r4
	mov	r3, #1
	bl	rtsx_add_cmd
	mov	r2, #18
	ldr	r3, .L10+24
	str	r2, [sp]
	ldr	r2, [r3]
	ldr	r1, [r6]
	mov	r3, #255
	mov	r0, r4
	bl	rtsx_add_cmd
	mov	r2, #132
	ldr	r3, .L10+28
	str	r2, [sp]
	ldr	r2, [r3]
	ldr	r1, [r6]
	mov	r3, #255
	mov	r0, r4
	bl	rtsx_add_cmd
	ldr	r3, .L10+32
	ldr	r2, .L10+36
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	r8, .L10+40
	orr	r3, r3, r2
	ldr	r1, [r6]
	ldr	r2, [r8]
	str	r3, [sp]
	mov	r0, r4
	mov	r3, #255
	bl	rtsx_add_cmd
	ldr	r3, .L10+44
	ldr	r1, .L10+48
	ldr	r3, [r3]
	ldr	r2, [r8]
	str	r3, [sp]
	ldr	r1, [r1]
	mov	r0, r4
	bl	rtsx_add_cmd
	mov	r1, r7
	mov	r2, #100
	mov	r0, r4
	bl	rtsx_send_cmd
	cmp	r0, r7
	blt	.L8
	mov	r3, #1
	mov	r0, r4
	mov	r2, r3
	ldr	r1, [r9]
	bl	rtsx_write_register
	cmp	r0, #0
	ldreq	r0, [r5]
	b	.L1
.L11:
	.align	2
.L10:
	.word	STATUS_SUCCESS
	.word	STATUS_FAIL
	.word	WRITE_REG_CMD
	.word	CARD_GPIO_DIR
	.word	RING_BUFFER
	.word	CARD_DATA_SOURCE
	.word	SPI_COMMAND
	.word	SPI_CA_NUMBER
	.word	SPI_TRANSFER0_START
	.word	SPI_CA_MODE0
	.word	SPI_TRANSFER0
	.word	SPI_TRANSFER0_END
	.word	CHECK_REG_CMD
	.size	spi_erase_eeprom_chip, .-spi_erase_eeprom_chip
	.comm	WRITE_REG_CMD,4,4
	.comm	STATUS_SUCCESS,4,4
	.comm	STATUS_FAIL,4,4
	.comm	SPI_TRANSFER0_START,4,4
	.comm	SPI_TRANSFER0_END,4,4
	.comm	SPI_TRANSFER0,4,4
	.comm	SPI_COMMAND,4,4
	.comm	SPI_CA_NUMBER,4,4
	.comm	SPI_CA_MODE0,4,4
	.comm	RING_BUFFER,4,4
	.comm	CHECK_REG_CMD,4,4
	.comm	CARD_GPIO_DIR,4,4
	.comm	CARD_DATA_SOURCE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
