	.file	"extr_daqboard2000.c_db2k_auto_attach.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	db2k_auto_attach, @function
db2k_auto_attach:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	rbx, rsi
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	comedi_to_pci_dev@PLT
	mov	rdi, QWORD PTR db2k_boardtypes[rip]
	mov	r12, rax
	call	ARRAY_SIZE@PLT
	cmp	rax, rbx
	jbe	.L4
	sal	rbx, 4
	add	rbx, QWORD PTR db2k_boardtypes[rip]
	mov	rax, QWORD PTR 8[rbx]
	test	rax, rax
	jne	.L16
.L4:
	mov	eax, DWORD PTR ENODEV[rip]
	neg	eax
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	mov	QWORD PTR 24[rbp], rbx
	mov	esi, 8
	mov	rdi, rbp
	mov	QWORD PTR 16[rbp], rax
	call	comedi_alloc_devpriv@PLT
	mov	r13, rax
	test	rax, rax
	je	.L10
	mov	rdi, rbp
	call	comedi_pci_enable@PLT
	test	eax, eax
	jne	.L1
	xor	esi, esi
	mov	rdi, r12
	call	pci_ioremap_bar@PLT
	mov	esi, 2
	mov	rdi, r12
	mov	QWORD PTR 0[r13], rax
	call	pci_ioremap_bar@PLT
	cmp	QWORD PTR 0[r13], 0
	mov	QWORD PTR 8[rbp], rax
	je	.L10
	test	rax, rax
	je	.L10
	mov	esi, 3
	mov	rdi, rbp
	call	comedi_alloc_subdevices@PLT
	test	eax, eax
	jne	.L1
	mov	r13d, DWORD PTR db2k_load_firmware[rip]
	mov	r12d, DWORD PTR DB2K_FIRMWARE[rip]
	mov	rdi, rbp
	call	comedi_to_pci_dev@PLT
	xor	r8d, r8d
	mov	rdi, rbp
	mov	rsi, rax
	mov	ecx, r13d
	mov	edx, r12d
	call	comedi_load_firmware@PLT
	test	eax, eax
	js	.L1
	mov	rdi, rbp
	call	db2k_initialize_adc@PLT
	mov	rdi, rbp
	call	db2k_dac_disarm@PLT
	mov	rax, QWORD PTR 0[rbp]
	mov	edx, DWORD PTR COMEDI_SUBD_AI[rip]
	movabs	rcx, 281470681743384
	mov	DWORD PTR 28[rax], edx
	mov	edx, DWORD PTR SDF_READABLE[rip]
	lea	rdi, 40[rax]
	or	edx, DWORD PTR SDF_GROUND[rip]
	cmp	QWORD PTR [rbx], 1
	mov	QWORD PTR 4[rax], rcx
	lea	rcx, db2k_ai_range[rip]
	mov	DWORD PTR [rax], edx
	mov	edx, DWORD PTR db2k_ai_insn_read[rip]
	mov	QWORD PTR 16[rax], rcx
	lea	rcx, range_bipolar10[rip]
	mov	DWORD PTR 32[rax], edx
	mov	edx, DWORD PTR COMEDI_SUBD_AO[rip]
	mov	DWORD PTR 48[rax], 65535
	mov	DWORD PTR 68[rax], edx
	mov	edx, DWORD PTR SDF_WRITABLE[rip]
	mov	QWORD PTR 56[rax], rcx
	mov	DWORD PTR 40[rax], edx
	sbb	edx, edx
	and	edx, 2
	add	edx, 2
	mov	DWORD PTR 44[rax], edx
	mov	edx, DWORD PTR db2k_ao_insn_write[rip]
	mov	DWORD PTR 64[rax], edx
	call	comedi_alloc_subdev_readback@PLT
	test	eax, eax
	jne	.L1
	mov	rax, QWORD PTR 0[rbp]
	mov	ecx, DWORD PTR DB2K_REG_DIO_P2_EXP_IO_8_BIT[rip]
	mov	rdi, rbp
	mov	edx, DWORD PTR db2k_8255_cb[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	lea	rsi, 80[rax]
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	jmp	subdev_8255_init@PLT
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	mov	eax, DWORD PTR ENOMEM[rip]
	add	rsp, 8
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	neg	eax
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	db2k_auto_attach, .-db2k_auto_attach
	.comm	range_bipolar10,4,4
	.comm	db2k_load_firmware,4,4
	.comm	db2k_boardtypes,8,8
	.comm	db2k_ao_insn_write,4,4
	.comm	db2k_ai_range,4,4
	.comm	db2k_ai_insn_read,4,4
	.comm	db2k_8255_cb,4,4
	.comm	SDF_WRITABLE,4,4
	.comm	SDF_READABLE,4,4
	.comm	SDF_GROUND,4,4
	.comm	ENOMEM,4,4
	.comm	ENODEV,4,4
	.comm	DB2K_REG_DIO_P2_EXP_IO_8_BIT,4,4
	.comm	DB2K_FIRMWARE,4,4
	.comm	COMEDI_SUBD_AO,4,4
	.comm	COMEDI_SUBD_AI,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_daqboard2000.c_db2k_auto_attach.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	db2k_auto_attach, %function
db2k_auto_attach:
	@ 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	r5, r1
	mov	r6, r0
	bl	comedi_to_pci_dev
	ldr	r4, .L17
	mov	r7, r0
	ldr	r0, [r4]
	bl	ARRAY_SIZE
	cmp	r0, r5
	bls	.L4
	ldr	r8, [r4]
	add	r2, r8, r5, lsl #3
	ldr	r3, [r2, #4]
	cmp	r3, #0
	bne	.L14
.L4:
	ldr	r3, .L17+4
	ldr	r0, [r3]
	rsb	r4, r0, #0
.L1:
	mov	r0, r4
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L14:
	mov	r1, #4
	mov	r0, r6
	str	r2, [r6, #12]
	str	r3, [r6, #8]
	bl	comedi_alloc_devpriv
	subs	r9, r0, #0
	beq	.L15
	mov	r0, r6
	bl	comedi_pci_enable
	subs	r4, r0, #0
	bne	.L1
	mov	r1, r4
	mov	r0, r7
	bl	pci_ioremap_bar
	mov	r1, #2
	str	r0, [r9]
	mov	r0, r7
	bl	pci_ioremap_bar
	ldr	r3, [r9]
	str	r0, [r6, #4]
	cmp	r0, #0
	cmpne	r3, #0
	beq	.L16
	mov	r1, #3
	mov	r0, r6
	bl	comedi_alloc_subdevices
	subs	r4, r0, #0
	bne	.L1
	mov	r0, r6
	bl	comedi_to_pci_dev
	ldr	r3, .L17+8
	ldr	r2, .L17+12
	str	r4, [sp]
	mov	r1, r0
	ldr	r3, [r3]
	mov	r0, r6
	ldr	r2, [r2]
	bl	comedi_load_firmware
	subs	r4, r0, #0
	blt	.L1
	mov	r0, r6
	bl	db2k_initialize_adc
	mov	r0, r6
	bl	db2k_dac_disarm
	ldr	r3, [r8, r5, lsl #3]
	mov	r4, #24
	cmp	r3, #0
	movne	r1, #2
	moveq	r1, #4
	ldr	r3, .L17+16
	ldr	r2, .L17+20
	ldr	r0, [r6]
	ldr	r2, [r2]
	ldr	r3, [r3]
	ldr	ip, .L17+24
	orr	r3, r3, r2
	ldr	ip, [ip]
	str	r1, [r0, #32]
	ldr	lr, .L17+28
	ldr	r1, .L17+32
	ldr	r2, .L17+36
	ldr	lr, [lr]
	ldr	r2, [r2]
	str	ip, [r0, #20]
	ldr	ip, [r1]
	str	r3, [r0]
	ldr	r1, .L17+40
	ldr	r3, .L17+44
	str	r2, [r0, #48]
	str	r3, [r0, #12]
	ldr	r1, [r1]
	ldr	r3, .L17+48
	ldr	r2, .L17+52
	str	r4, [r0, #4]
	str	lr, [r0, #24]
	str	ip, [r0, #28]
	str	r1, [r0, #44]
	str	r2, [r0, #40]
	str	r3, [r0, #8]
	str	r3, [r0, #36]
	add	r0, r0, #28
	bl	comedi_alloc_subdev_readback
	subs	r4, r0, #0
	bne	.L1
	mov	r0, r6
	ldr	r3, .L17+56
	ldr	r2, .L17+60
	ldr	r1, [r6]
	ldr	r3, [r3]
	ldr	r2, [r2]
	add	r1, r1, #56
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, lr}
	b	subdev_8255_init
.L15:
	ldr	r3, .L17+64
	ldr	r0, [r3]
	rsb	r4, r0, #0
	b	.L1
.L16:
	ldr	r3, .L17+64
	ldr	r4, [r3]
	rsb	r4, r4, #0
	b	.L1
.L18:
	.align	2
.L17:
	.word	db2k_boardtypes
	.word	ENODEV
	.word	db2k_load_firmware
	.word	DB2K_FIRMWARE
	.word	SDF_READABLE
	.word	SDF_GROUND
	.word	COMEDI_SUBD_AI
	.word	db2k_ai_insn_read
	.word	SDF_WRITABLE
	.word	COMEDI_SUBD_AO
	.word	db2k_ao_insn_write
	.word	db2k_ai_range
	.word	65535
	.word	range_bipolar10
	.word	DB2K_REG_DIO_P2_EXP_IO_8_BIT
	.word	db2k_8255_cb
	.word	ENOMEM
	.size	db2k_auto_attach, .-db2k_auto_attach
	.comm	range_bipolar10,4,4
	.comm	db2k_load_firmware,4,4
	.comm	db2k_boardtypes,4,4
	.comm	db2k_ao_insn_write,4,4
	.comm	db2k_ai_range,4,4
	.comm	db2k_ai_insn_read,4,4
	.comm	db2k_8255_cb,4,4
	.comm	SDF_WRITABLE,4,4
	.comm	SDF_READABLE,4,4
	.comm	SDF_GROUND,4,4
	.comm	ENOMEM,4,4
	.comm	ENODEV,4,4
	.comm	DB2K_REG_DIO_P2_EXP_IO_8_BIT,4,4
	.comm	DB2K_FIRMWARE,4,4
	.comm	COMEDI_SUBD_AO,4,4
	.comm	COMEDI_SUBD_AI,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
