1 /* $Id: //depot/dev/Foxhill/Xtensa/OS/include/xtensa/mpuasm.h#5 $ */
2 
3 /*
4  * Copyright (c) 2016 Cadence Design Systems, Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 #ifndef _IDMAASM_H_
27 #define _IDMAASM_H_
28 
29 #if XCHAL_HAVE_IDMA
30 #include <xtensa/idma.h>
31 #endif
32 
33 /*
34  * Macro for restore IDMA regs
35  *
36  * Parameters:
37  * 	a_save				=>	address register containing pointer to IDMA save area
38  * 	a_temp1, a_temp2, a_temp3.	=>  address register temporaries
39  */
40 //   IDMA_REG_SETTINGS,
41 //   IDMA_REG_TIMEOUT,
42 //   IDMA_REG_DESC_START,
43 //   IDMA_REG_CONTROL,
44 //   IDMA_REG_USERPRIV,
45 
46 .macro _idma_restore a_save, a_temp1, a_temp2, a_temp3
47 #if XCHAL_HAVE_IDMA
48 	l32i	\a_temp1, \a_save, 0
49 	movi	\a_temp3, idmareg_base
50 	movi	\a_temp2, IDMA_REG_SETTINGS
51 	add	\a_temp2, \a_temp2, \a_temp3
52 	wer	\a_temp1, \a_temp2
53 	l32i	\a_temp1, \a_save, 4
54 	movi	\a_temp2, IDMA_REG_TIMEOUT
55 	add	\a_temp2, \a_temp2, \a_temp3
56 	wer	\a_temp1, \a_temp2
57 	l32i	\a_temp1, \a_save, 8
58 	movi	\a_temp2, IDMA_REG_DESC_START
59 	add	\a_temp2, \a_temp2, \a_temp3
60 	wer	\a_temp1, \a_temp2
61 	l32i	\a_temp1, \a_save, 12
62 	movi	\a_temp2, IDMA_REG_CONTROL
63 	add	\a_temp2, \a_temp2, \a_temp3
64 	wer	\a_temp1, \a_temp2
65 	l32i	\a_temp1, \a_save, 16
66 	movi	\a_temp2, IDMA_REG_USERPRIV
67 	add	\a_temp2, \a_temp2, \a_temp3
68 	wer	\a_temp1, \a_temp2
69 #endif
70 .endm
71 
72 #endif //_IDMAASM_H_
73