annotate src/cs/layer1/cfile/l1_small_asm.S @ 216:2be687f4476c default tip

l1_init.c: sync with Tourmaline: L1 recovery ABB init fix
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 31 Oct 2022 01:23:14 +0000
parents d43dadd91383
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
76
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Assembly code extracted out of TI's l1_small.c
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * This code is correct ONLY for CHIPSET 10 or 11 as currently used
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * by FreeCalypso; see TI's original code for what changes would be
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * needed to support other CHIPSETs.
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 */
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 .text
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 .code 32
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 /*-------------------------------------------------------*/
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 /* _GSM_Small_Sleep */
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 /* (formerly INT_Small_Sleep) */
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 /*-------------------------------------------------------*/
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 /* */
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 /* Description: small sleep */
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /* ------------ */
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 /* Called by TCT_Schedule main loop of Nucleus */
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 /*-------------------------------------------------------*/
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #define SMALL_SLEEP 0x01
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #define ALL_SLEEP 0x04
150
d43dadd91383 l1_small_asm.S for gcc: same change as in l1_small.c TMS470 version
Mychaela Falconia <falcon@freecalypso.org>
parents: 76
diff changeset
24 #define BIG_SMALL_SLEEP 0x05
76
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #define PWR_MNGT 0x01
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 .globl _GSM_Small_Sleep
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 _GSM_Small_Sleep:
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 ldr r0,Switch
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 ldr r0,[r0]
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 ldrb r1,[r0]
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 cmp r1,#PWR_MNGT
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 bne TCT_Schedule_Loop
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 ldr r0,Mode
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 ldr r0,[r0]
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 ldrb r1,[r0]
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 cmp r1,#SMALL_SLEEP
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 beq Small_sleep_ok
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 cmp r1,#ALL_SLEEP
150
d43dadd91383 l1_small_asm.S for gcc: same change as in l1_small.c TMS470 version
Mychaela Falconia <falcon@freecalypso.org>
parents: 76
diff changeset
42 beq Small_sleep_ok
d43dadd91383 l1_small_asm.S for gcc: same change as in l1_small.c TMS470 version
Mychaela Falconia <falcon@freecalypso.org>
parents: 76
diff changeset
43 cmp r1,#BIG_SMALL_SLEEP
76
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 bne TCT_Schedule_Loop
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 Small_sleep_ok:
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 // *****************************************************
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 //reset the DEEP_SLEEP bit 12 of CNTL_ARM_CLK register
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 // (Cf BUG_1278)
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 ldr r0,addrCLKM @ pick up CNTL_ARM_CLK register address
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 ldrh r1,[r0] @ take the current value of the register
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 orr r1,r1,#0x1000 @ reset the bit
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 strh r1,[r0] @ store the result
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 ldr r0,addrCLKM @ pick up CLKM clock register address
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 ldrh r1,[r0] @ take the current value of the register
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 bic r1,r1,#1 @ disable ARM clock
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 strh r1,[r0]
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 B TCT_Schedule_Loop @ Return to TCT_Schedule main loop
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 addrCLKM: .word 0xfffffd00 @ CLKM clock register address
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 Mode: .word mode_authorized
a2052ac75672 l1_small_asm.S: import from Citrine
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 Switch: .word switch_PWR_MNGT