comparison src/cs/drivers/drv_app/ffs/board/amdsbdrv.c @ 72:4484ab3f6ab3

FFS interrupt voodoo: made original TMS470 approach work with gcc
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 20 Jul 2018 03:35:25 +0000
parents 559a8b3ef10b
children
comparison
equal deleted inserted replaced
71:8019491a67a9 72:4484ab3f6ab3
11 #include "ffs.cfg" 11 #include "ffs.cfg"
12 12
13 #include "ffs/ffs.h" 13 #include "ffs/ffs.h"
14 #include "ffs/board/drv.h" 14 #include "ffs/board/drv.h"
15 #include "ffs/board/ffstrace.h" 15 #include "ffs/board/ffstrace.h"
16 #include "nucleus.h"
17 16
18 17
19 // Due to long branches, we disable all tracing and led function calls. 18 // Due to long branches, we disable all tracing and led function calls.
20 #undef tlw 19 #undef tlw
21 #define tlw(contents) 20 #define tlw(contents)
140 139
141 /****************************************************************************** 140 /******************************************************************************
142 * Interrupt Enable/Disable 141 * Interrupt Enable/Disable
143 ******************************************************************************/ 142 ******************************************************************************/
144 143
145 uint32 amd_int_disable(void) 144 #ifdef __GNUC__
146 { 145 #define NOINLINE __attribute__ ((noinline))
147 #ifdef __GNUC__ 146 #else
148 return NU_Control_Interrupts(0xC0); 147 #define NOINLINE
148 #endif
149
150 uint32 NOINLINE amd_int_disable(void)
151 {
152 #ifdef __GNUC__
153 asm(" .code 16");
149 #else 154 #else
150 asm(" .state16"); 155 asm(" .state16");
156 #endif
151 asm(" mov A1, #0xC0"); 157 asm(" mov A1, #0xC0");
152 asm(" ldr A2, tct_amd_disable"); 158 asm(" ldr A2, tct_amd_disable");
153 asm(" bx A2 "); 159 asm(" bx A2 ");
154 160
161 #ifdef __GNUC__
162 asm(".balign 4");
163 asm("tct_amd_disable:");
164 asm(" .word TCT_Control_Interrupts");
165 #else
155 asm("tct_amd_disable .field _TCT_Control_Interrupts+0,32"); 166 asm("tct_amd_disable .field _TCT_Control_Interrupts+0,32");
156 asm(" .global _TCT_Control_Interrupts"); 167 asm(" .global _TCT_Control_Interrupts");
157 #endif 168 #endif
158 } 169 }
159 170
160 void amd_int_enable(uint32 cpsr) 171 void NOINLINE amd_int_enable(uint32 cpsr)
161 { 172 {
162 #ifdef __GNUC__ 173 #ifdef __GNUC__
163 return NU_Control_Interrupts(cpsr); 174 asm(" .code 16");
164 #else 175 #else
165 asm(" .state16"); 176 asm(" .state16");
177 #endif
166 asm(" ldr A2, tct_amd_enable"); 178 asm(" ldr A2, tct_amd_enable");
167 asm(" bx A2 "); 179 asm(" bx A2 ");
168 180
181 #ifdef __GNUC__
182 asm(".balign 4");
183 asm("tct_amd_enable:");
184 asm(" .word TCT_Control_Interrupts");
185 #else
169 asm("tct_amd_enable .field _TCT_Control_Interrupts+0,32"); 186 asm("tct_amd_enable .field _TCT_Control_Interrupts+0,32");
170 asm(" .global _TCT_Control_Interrupts"); 187 asm(" .global _TCT_Control_Interrupts");
171 #endif 188 #endif
172 } 189 }
173 190