summaryrefslogtreecommitdiffstats
path: root/arch/metag/tbx/tbidspram.S
blob: 2f27c037221243ef484e8de8f80ddcacbc534391 (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
 * tbidspram.S
 *
 * Copyright (C) 2009, 2012 Imagination Technologies.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 2 as published by the
 * Free Software Foundation.
 *
 * Explicit state save and restore routines forming part of the thread binary
 * interface for META processors
 */

	.file	"tbidspram.S"

/* These aren't generally useful to a user so for now, they arent publically available */
#define _TBIECH_DSPRAM_DUA_S    8
#define _TBIECH_DSPRAM_DUA_BITS 0x7f00
#define _TBIECH_DSPRAM_DUB_S    0
#define _TBIECH_DSPRAM_DUB_BITS 0x007f

/*
 * void *__TBIDspramSaveA( short DspramSizes, void *pExt )
 */
	.text
	.balign	4
	.global	___TBIDspramSaveA
	.type	___TBIDspramSaveA,function
___TBIDspramSaveA:

	SETL	[A0StP++], D0.5, D1.5
	MOV	A0.3, D0Ar2

	/* D1Ar1 - Dspram Sizes
	 * A0.4  - Pointer to buffer
	 */

	/* Save the specified amount of dspram DUA */
DL	MOV	D0AR.0, #0
	LSR	D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUA_S
	AND	D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUA_BITS >> _TBIECH_DSPRAM_DUA_S)
	SUB	TXRPT, D1Ar1, #1
$L1:
DL	MOV	D0Re0, [D0AR.0++]
DL	MOV	D0Ar6, [D0AR.0++]
DL	MOV	D0Ar4, [D0AR.0++]
DL	MOV	D0.5,  [D0AR.0++]
	MSETL	[A0.3++], D0Re0, D0Ar6, D0Ar4, D0.5

	BR	$L1

	GETL	D0.5, D1.5, [--A0StP]
	MOV	PC, D1RtP

	.size	___TBIDspramSaveA,.-___TBIDspramSaveA

/*
 * void *__TBIDspramSaveB( short DspramSizes, void *pExt )
 */
	.balign	4
	.global	___TBIDspramSaveB
	.type	___TBIDspramSaveB,function
___TBIDspramSaveB:

	SETL	[A0StP++], D0.5, D1.5
	MOV	A0.3, D0Ar2

	/* D1Ar1 - Dspram Sizes
	 * A0.3  - Pointer to buffer
	 */

	/* Save the specified amount of dspram DUA */
DL	MOV	D0BR.0, #0
	LSR	D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUB_S
	AND	D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUB_BITS >> _TBIECH_DSPRAM_DUB_S)
	SUB	TXRPT, D1Ar1, #1
$L2:
DL	MOV	D0Re0, [D0BR.0++]
DL	MOV	D0Ar6, [D0BR.0++]
DL	MOV	D0Ar4, [D0BR.0++]
DL	MOV	D0.5,  [D0BR.0++]
	MSETL	[A0.3++], D0Re0, D0Ar6, D0Ar4, D0.5

	BR	$L2

	GETL	D0.5, D1.5, [--A0StP]
	MOV	PC, D1RtP

	.size	___TBIDspramSaveB,.-___TBIDspramSaveB

/*
 * void *__TBIDspramRestoreA( short DspramSizes, void *pExt )
 */
	.balign	4
	.global	___TBIDspramRestoreA
	.type	___TBIDspramRestoreA,function
___TBIDspramRestoreA:

	SETL	[A0StP++], D0.5, D1.5
	MOV	A0.3, D0Ar2

	/* D1Ar1 - Dspram Sizes
	 * A0.3 - Pointer to buffer
	 */

	/* Restore the specified amount of dspram DUA */
DL	MOV	D0AW.0, #0
	LSR	D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUA_S
	AND	D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUA_BITS >> _TBIECH_DSPRAM_DUA_S)
	SUB	TXRPT, D1Ar1, #1
$L3:
	MGETL	D0Re0, D0Ar6, D0Ar4, D0.5, [A0.3++]
DL	MOV	[D0AW.0++], D0Re0
DL	MOV	[D0AW.0++], D0Ar6
DL	MOV	[D0AW.0++], D0Ar4
DL	MOV	[D0AW.0++], D0.5

	BR	$L3

	GETL	D0.5, D1.5, [--A0StP]
	MOV	PC, D1RtP

	.size	___TBIDspramRestoreA,.-___TBIDspramRestoreA

/*
 * void *__TBIDspramRestoreB( short DspramSizes, void *pExt )
 */
	.balign	4
	.global	___TBIDspramRestoreB
	.type	___TBIDspramRestoreB,function
___TBIDspramRestoreB:

	SETL	[A0StP++], D0.5, D1.5
	MOV	A0.3, D0Ar2

	/* D1Ar1 - Dspram Sizes
	 * A0.3 - Pointer to buffer
	 */

	/* Restore the specified amount of dspram DUA */
DL	MOV	D0BW.0, #0
	LSR	D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUB_S
	AND	D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUB_BITS >> _TBIECH_DSPRAM_DUB_S)
	SUB	TXRPT, D1Ar1, #1
$L4:
	MGETL	D0Re0, D0Ar6, D0Ar4, D0.5, [A0.3++]
DL	MOV	[D0BW.0++], D0Re0
DL	MOV	[D0BW.0++], D0Ar6
DL	MOV	[D0BW.0++], D0Ar4
DL	MOV	[D0BW.0++], D0.5

	BR	$L4

	GETL	D0.5, D1.5, [--A0StP]
	MOV	PC, D1RtP

	.size	___TBIDspramRestoreB,.-___TBIDspramRestoreB

/*
 * End of tbidspram.S
 */