1 ;
2 ; Copyright (c) 2015, Texas Instruments Incorporated
3 ; All rights reserved.
4 ;
5 ; Redistribution and use in source and binary forms, with or without
6 ; modification, are permitted provided that the following conditions
7 ; are met:
8 ;
9 ; * Redistributions of source code must retain the above copyright
10 ; notice, this list of conditions and the following disclaimer.
11 ;
12 ; * Redistributions in binary form must reproduce the above copyright
13 ; notice, this list of conditions and the following disclaimer in the
14 ; documentation and/or other materials provided with the distribution.
15 ;
16 ; * Neither the name of Texas Instruments Incorporated nor the names of
17 ; its contributors may be used to endorse or promote products derived
18 ; from this software without specific prior written permission.
19 ;
20 ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 ; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 ; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 ; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 ; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 ; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 ; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 ; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 ; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 ; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 ;
32 ;
33 ; ======== IpcPowerDsp_idle_dra7xx.s66 ========
34 ;
35 ;
36 .if $isdefed("__TI_ELFABI__")
37 .if __TI_ELFABI__
38 .asg IpcPower_callIdle, _IpcPower_callIdle
39 .endif
40 .endif
42 .global _IpcPower_callIdle
44 .align 4
46 ;
47 ; ======== IpcPower_callIdle ========
48 ;
49 ; IpcPower_callIdle()
50 ;
52 .sect ".text:IpcPower_callIdle"
53 .clink
55 _IpcPower_callIdle:
56 .asmfunc
57 .nocmp
59 ; must enter this function with interrupts disabled
61 ; Workaround: invalidate prefetch buffer in the xmc
62 mfence
63 mvk 0x0300,b5
64 mvkh 0x8000000,b5
65 || mvk 1,b4
66 stw b4,*b5[0]
67 add 4,b5,a3
68 ldw *+a3[0],a3
69 nop ; pad rest of fetch packet
71 ; idle the CPU with a simultaneous interrupt enable (GIE=1)
72 mvc csr, b4
73 or 1, b4, b4 ; set GIE
74 mvc b4, csr
75 || idle
76 nop ; pad rest of fetch packet
77 nop
79 ; return back to IpcPower_idle API
80 b b3
81 nop 5
83 .endasmfunc