changeset 259:ea66ce1a0d2e

pirelli/fw-disasm: pwr_cal_timer_process() analyzed
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Dec 2017 04:47:58 +0000
parents 61d8d70ca7b0
children 863b483bf9e7
files pirelli/fw-disasm
diffstat 1 files changed, 155 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pirelli/fw-disasm	Tue Dec 26 04:12:06 2017 +0000
+++ b/pirelli/fw-disasm	Tue Dec 26 04:47:58 2017 +0000
@@ -953,6 +953,160 @@
   2e25c0:	b002		add	sp, #8
   2e25c2:	bd70		pop	{r4, r5, r6, pc}
 
+$pwr_open_test_timer_process:
+  2e2610:	b510		push	{r4, lr}
+  2e2612:	b082		sub	sp, #8
+  2e2614:	48e5		ldr	r0, =0xa0020	; via 0x2e29ac
+  2e2616:	9000		str	r0, [sp, #0]
+  2e2618:	a0e6		add	r0, pc, #920	; 0x398
+  2e261a:	2119		mov	r1, #25	; 0x19
+  2e261c:	2200		mov	r2, #0
+  2e261e:	43d2		mvn	r2, r2
+  2e2620:	2302		mov	r3, #2
+  2e2622:	f0f8 fb07	bl	0x3dac34
+  2e2626:	2001		mov	r0, #1
+  2e2628:	2122		mov	r1, #34	; 0x22
+  2e262a:	f066 fe16	bl	0x34925a
+  2e262e:	1c04		add	r4, r0, #0
+  2e2630:	48de		ldr	r0, =0xa0020	; via 0x2e29ac
+  2e2632:	9000		str	r0, [sp, #0]
+  2e2634:	a06e		add	r0, pc, #440	; 0x1b8
+  2e2636:	211b		mov	r1, #27	; 0x1b
+  2e2638:	1c22		add	r2, r4, #0
+  2e263a:	2305		mov	r3, #5
+  2e263c:	f0f8 fafa	bl	0x3dac34
+  2e2640:	f7ff fe55	bl	0x2e22ee
+  2e2644:	2c00		cmp	r4, #0
+  2e2646:	d11a		bne	0x2e267e
+  2e2648:	48d8		ldr	r0, =0xa0020	; via 0x2e29ac
+  2e264a:	9000		str	r0, [sp, #0]
+  2e264c:	a0e0		add	r0, pc, #896	; 0x380
+  2e264e:	210c		mov	r1, #12	; 0xc
+  2e2650:	2200		mov	r2, #0
+  2e2652:	43d2		mvn	r2, r2
+  2e2654:	2302		mov	r3, #2
+  2e2656:	f0f8 faed	bl	0x3dac34
+  2e265a:	2001		mov	r0, #1
+  2e265c:	f0b2 fc31	bl	0x394ec2
+  2e2660:	2132		mov	r1, #50	; 0x32
+  2e2662:	480f		ldr	r0, =0x1774e38	; via 0x2e26a0
+  2e2664:	6800		ldr	r0, [r0, #0]
+  2e2666:	5c08		ldrb	r0, [r1, r0]
+  2e2668:	2800		cmp	r0, #0
+  2e266a:	d105		bne	0x2e2678
+  2e266c:	2001		mov	r0, #1
+  2e266e:	213c		mov	r1, #60	; 0x3c
+  2e2670:	2201		mov	r2, #1
+  2e2672:	f066 fdcb	bl	0x34920c
+  2e2676:	e011		b	0x2e269c
+  2e2678:	f0d1 fa9b	bl	0x3b3bb2
+  2e267c:	e00e		b	0x2e269c
+  2e267e:	48cb		ldr	r0, =0xa0020	; via 0x2e29ac
+  2e2680:	9000		str	r0, [sp, #0]
+  2e2682:	a062		add	r0, pc, #392	; 0x188
+  2e2684:	210a		mov	r1, #10	; 0xa
+  2e2686:	2200		mov	r2, #0
+  2e2688:	43d2		mvn	r2, r2
+  2e268a:	2305		mov	r3, #5
+  2e268c:	f0f8 fad2	bl	0x3dac34
+  2e2690:	48c7		ldr	r0, =0x1774e70	; via 0x2e29b0
+  2e2692:	6800		ldr	r0, [r0, #0]
+  2e2694:	2101		mov	r1, #1
+  2e2696:	6041		str	r1, [r0, #4]
+  2e2698:	f04b fad2	bl	0x32dc40
+  2e269c:	b002		add	sp, #8
+  2e269e:	bd10		pop	{r4, pc}
+
+$pwr_cal_timer_process:
+  2e26fc:	b510		push	{r4, lr}
+  2e26fe:	b082		sub	sp, #8
+; same check for charger presence and active state as seen before
+  2e2700:	f066 fe04	bl	0x34930c	; $ABB_Read_Status
+  2e2704:	49aa		ldr	r1, =0x1774e70	; via 0x2e29b0
+  2e2706:	6809		ldr	r1, [r1, #0]
+  2e2708:	6849		ldr	r1, [r1, #4]
+  2e270a:	2900		cmp	r1, #0
+  2e270c:	d001		beq	0x2e2712
+  2e270e:	09c0		lsr	r0, r0, #7
+  2e2710:	d205		bcs	0x2e271e
+  2e2712:	2001		mov	r0, #1
+  2e2714:	2138		mov	r1, #56	; 0x38
+  2e2716:	2201		mov	r2, #1
+  2e2718:	f066 fd78	bl	0x34920c
+  2e271c:	e042		b	0x2e27a4
+; checks passed
+; "TIMER0: Battery calibration" trace
+  2e271e:	48a3		ldr	r0, =0xa0020	; via 0x2e29ac
+  2e2720:	9000		str	r0, [sp, #0]
+  2e2722:	a0c7		add	r0, pc, #796	; 0x31c
+  2e2724:	211b		mov	r1, #27	; 0x1b
+  2e2726:	2200		mov	r2, #0
+  2e2728:	43d2		mvn	r2, r2
+  2e272a:	2302		mov	r3, #2
+  2e272c:	f0f8 fa82	bl	0x3dac34
+; write 0 into ADIN2REG
+  2e2730:	2001		mov	r0, #1
+  2e2732:	2128		mov	r1, #40	; 0x28
+  2e2734:	2200		mov	r2, #0
+  2e2736:	f066 fd69	bl	0x34920c
+; delay 2 ticks
+  2e273a:	2002		mov	r0, #2
+  2e273c:	f7cf f8af	bl	0x2b189e
+; back to expected code
+  2e2740:	4c9b		ldr	r4, =0x1774e70	; via 0x2e29b0
+  2e2742:	2001		mov	r0, #1
+  2e2744:	2122		mov	r1, #34	; 0x22
+  2e2746:	f066 fd88	bl	0x34925a
+  2e274a:	6821		ldr	r1, [r4, #0]
+  2e274c:	8108		strh	r0, [r1, #8]
+; i2v offset (raw ADC) also stored in this other var
+  2e274e:	48a4		ldr	r0, =0x1774b82	; via 0x2e29e0
+  2e2750:	6821		ldr	r1, [r4, #0]
+  2e2752:	8909		ldrh	r1, [r1, #8]
+  2e2754:	8001		strh	r1, [r0, #0]
+; back to expected code
+; "i2v offset (MADC code) " trace
+  2e2756:	6820		ldr	r0, [r4, #0]
+  2e2758:	8902		ldrh	r2, [r0, #8]
+  2e275a:	4894		ldr	r0, =0xa0020	; via 0x2e29ac
+  2e275c:	9000		str	r0, [sp, #0]
+  2e275e:	a0bf		add	r0, pc, #764	; 0x2fc
+  2e2760:	2117		mov	r1, #23	; 0x17
+  2e2762:	2305		mov	r3, #5
+  2e2764:	f0f8 fa66	bl	0x3dac34
+  2e2768:	f7ff fdc1	bl	0x2e22ee	; $pwr_stop_charging
+  2e276c:	6820		ldr	r0, [r4, #0]
+  2e276e:	3004		add	r0, #4
+  2e2770:	8881		ldrh	r1, [r0, #4]
+  2e2772:	2900		cmp	r1, #0
+  2e2774:	d109		bne	0x2e278a
+; i2v offset is zero
+; pwr_env_ctrl_blk->charging_state = TESTING_BATTERY;
+  2e2776:	2101		mov	r1, #1
+  2e2778:	6001		str	r1, [r0, #0]
+; setting BCICONF to 0x18
+  2e277a:	2002		mov	r0, #2
+  2e277c:	211a		mov	r1, #26	; 0x1a
+  2e277e:	2218		mov	r2, #24	; 0x18
+  2e2780:	f066 fd44	bl	0x34920c	; $ABB_Write_Register_on_page
+  2e2784:	f7ff fdce	bl	0x2e2324	; $pwr_current_loop_cal
+  2e2788:	e00c		b	0x2e27a4	; return;
+; i2v offset is not zero
+  2e278a:	317a		add	r1, #122	; 0x7a
+  2e278c:	80c1		strh	r1, [r0, #6]
+; "End of charge current (MADC code) " trace
+  2e278e:	6820		ldr	r0, [r4, #0]
+  2e2790:	8942		ldrh	r2, [r0, #10]	; 0xa
+  2e2792:	4886		ldr	r0, =0xa0020	; via 0x2e29ac
+  2e2794:	9000		str	r0, [sp, #0]
+  2e2796:	a0b7		add	r0, pc, #732	; 0x2dc
+  2e2798:	2122		mov	r1, #34	; 0x22
+  2e279a:	2305		mov	r3, #5
+  2e279c:	f0f8 fa4a	bl	0x3dac34
+  2e27a0:	f7ff fe17	bl	0x2e23d2	; $pwr_start_fast_charge
+  2e27a4:	b002		add	sp, #8
+  2e27a6:	bd10		pop	{r4, pc}
+
 $l1_abb_power_on:
   31c036:	b510		push	{r4, lr}
   31c038:	b084		sub	sp, #16	; 0x10
@@ -4784,6 +4938,7 @@
 0x1774b7c:	16-bit var battery voltage in mV
 0x1774b7e:	16-bit var zeroed in pwr_stop_charging()
 0x1774b80:	16-bit var zeroed in pwr_stop_charging()
+0x1774b82:	16-bit var gets i2v offset (raw ADC) written into it
 
 0x1774ccc:	16-bit var initial battery % is stored here