1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
.text
.global _start
_start:
b exec
branch_addr:
.word kill
hw_power_sts:
#if defined(CREATIVE_ZEN)
.word 0x800440b0 /* STMP3700 */
#else
.word 0x800440c0 /* IMX233 */
#endif
hw_pinctrl_din0:
.word 0x80018600
hw_pinctrl_din1:
.word 0x80018610
hw_pinctrl_din2:
.word 0x80018620
kill:
ldr pc, branch_addr
exec:
#if defined(SANSA_FUZEPLUS)
/* check PSWITCH=1 (power button pressed) */
ldr r0, hw_power_sts
ldr r0, [r0]
mov r0, r0, lsr #20
and r0, #3
cmp r0, #1
bne ret
/* check B1P30=0 (volume down pressed) */
ldr r0, hw_pinctrl_din1
ldr r0, [r0]
mov r0, r0, lsr #30
ands r0, #1
beq kill
#elif defined(CREATIVE_ZENXFI3)
/* check PSWITCH=1 (power button pressed) */
ldr r0, hw_power_sts
ldr r0, [r0]
mov r0, r0, lsr #20
and r0, #3
cmp r0, #1
bne ret
/* check B2P07=0 (volume down pressed) */
ldr r0, hw_pinctrl_din2
ldr r0, [r0]
mov r0, r0, lsr #7
ands r0, #1
beq kill
#elif defined(CREATIVE_ZENXFI2)
/* check B0P11=0 (power button pressed) and B0P14 (select button pressed) */
ldr r0, hw_pinctrl_din0
ldr r0, [r0]
mov r0, r0, lsr #11
tst r0, #1
bne ret
mov r0, r0, lsr #3
tst r0, #1
beq kill
#elif defined(CREATIVE_ZEN)
/* check PSWITCH=1 (power button pressed) */
ldr r0, hw_power_sts
ldr r0, [r0]
mov r0, r0, lsr #18
and r0, #3
cmp r0, #0
bne kill
#elif defined(SONY_NWZ)
/* check PSWITCH=3 (power button pressed) */
ldr r0, hw_power_sts
ldr r0, [r0]
mov r0, r0, lsr #20
and r0, #3
cmp r0, #3
beq kill
#elif defined(CREATIVE_ZENXFISTYLE)
/* check PSWITCH=1 (power button pressed) */
ldr r0, hw_power_sts
ldr r0, [r0]
mov r0, r0, lsr #20
and r0, #3
cmp r0, #1
beq kill
#else
#error implement me
#endif
ret:
|