changeset 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 8019491a67a9
children 0f466af1eaf0
files src/cs/drivers/drv_app/ffs/board/amdsbdrv.c src/cs/drivers/drv_app/ffs/board/drv.c src/cs/drivers/drv_app/ffs/board/intelsbdrv.c
diffstat 3 files changed, 66 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/drivers/drv_app/ffs/board/amdsbdrv.c	Fri Jul 20 02:48:06 2018 +0000
+++ b/src/cs/drivers/drv_app/ffs/board/amdsbdrv.c	Fri Jul 20 03:35:25 2018 +0000
@@ -13,7 +13,6 @@
 #include "ffs/ffs.h"
 #include "ffs/board/drv.h"
 #include "ffs/board/ffstrace.h"
-#include "nucleus.h"
 
 
 // Due to long branches, we disable all tracing and led function calls.
@@ -142,30 +141,48 @@
  * Interrupt Enable/Disable
  ******************************************************************************/
 
-uint32 amd_int_disable(void)
+#ifdef __GNUC__
+#define NOINLINE __attribute__ ((noinline))
+#else
+#define NOINLINE
+#endif
+
+uint32 NOINLINE amd_int_disable(void)
 {
 #ifdef __GNUC__
-	return NU_Control_Interrupts(0xC0);
+    asm("        .code 16");
 #else
     asm("        .state16");
+#endif
     asm("        mov       A1, #0xC0");
     asm("        ldr       A2, tct_amd_disable");
     asm("        bx        A2      ");
 
+#ifdef __GNUC__
+    asm(".balign 4");
+    asm("tct_amd_disable:");
+    asm("        .word     TCT_Control_Interrupts");
+#else
     asm("tct_amd_disable 	.field     _TCT_Control_Interrupts+0,32");
     asm("	                .global	   _TCT_Control_Interrupts");
 #endif
 }
 
-void amd_int_enable(uint32 cpsr)
+void NOINLINE amd_int_enable(uint32 cpsr)
 {
 #ifdef __GNUC__
-	return NU_Control_Interrupts(cpsr);
+    asm("        .code 16");
 #else
     asm("        .state16");
+#endif
     asm("        ldr       A2, tct_amd_enable");
     asm("        bx        A2      ");
 
+#ifdef __GNUC__
+    asm(".balign 4");
+    asm("tct_amd_enable:");
+    asm("        .word     TCT_Control_Interrupts");
+#else
     asm("tct_amd_enable 	.field     _TCT_Control_Interrupts+0,32");
     asm("	                .global	   _TCT_Control_Interrupts");
 #endif
--- a/src/cs/drivers/drv_app/ffs/board/drv.c	Fri Jul 20 02:48:06 2018 +0000
+++ b/src/cs/drivers/drv_app/ffs/board/drv.c	Fri Jul 20 03:35:25 2018 +0000
@@ -1426,30 +1426,48 @@
 // Note that we use our own interrupt disable/enable function because
 // Nucleus allegedly should have a bug in its implementation for this.
 
-uint32 int_disable(void)
+#ifdef __GNUC__
+#define NOINLINE __attribute__ ((noinline))
+#else
+#define NOINLINE
+#endif
+
+uint32 NOINLINE int_disable(void)
 {
 #ifdef __GNUC__
-	return NU_Control_Interrupts(0xC0);
+    asm("        .code 16");
 #else
     asm("        .state16");
+#endif
     asm("        mov       A1, #0xC0");
     asm("        ldr       A2, tct_disable");
     asm("        bx        A2      ");
 
+#ifdef __GNUC__
+    asm(".balign 4");
+    asm("tct_disable:");
+    asm("        .word     TCT_Control_Interrupts");
+#else
     asm("tct_disable    .field     _TCT_Control_Interrupts+0,32");
     asm("	            .global	   _TCT_Control_Interrupts");
 #endif
 }
 
-void int_enable(uint32 cpsr)
+void NOINLINE int_enable(uint32 cpsr)
 {
 #ifdef __GNUC__
-	return NU_Control_Interrupts(cpsr);
+    asm("        .code 16");
 #else
     asm("        .state16");
+#endif
     asm("        ldr       A2, tct_enable");
     asm("        bx        A2      ");
 
+#ifdef __GNUC__
+    asm(".balign 4");
+    asm("tct_enable:");
+    asm("        .word     TCT_Control_Interrupts");
+#else
     asm("tct_enable 	.field     _TCT_Control_Interrupts+0,32");
     asm("	            .global	   _TCT_Control_Interrupts");
 #endif
--- a/src/cs/drivers/drv_app/ffs/board/intelsbdrv.c	Fri Jul 20 02:48:06 2018 +0000
+++ b/src/cs/drivers/drv_app/ffs/board/intelsbdrv.c	Fri Jul 20 03:35:25 2018 +0000
@@ -13,7 +13,6 @@
 #include "ffs/ffs.h"
 #include "ffs/board/drv.h"
 #include "ffs/board/ffstrace.h"
-#include "nucleus.h"
 
 
 #define INTEL_UNLOCK_SLOW 1
@@ -226,30 +225,48 @@
  * Interrupt Enable/Disable
  ******************************************************************************/
 
-uint32 intel_int_disable(void)
+#ifdef __GNUC__
+#define NOINLINE __attribute__ ((noinline))
+#else
+#define NOINLINE
+#endif
+
+uint32 NOINLINE intel_int_disable(void)
 {
 #ifdef __GNUC__
-	return NU_Control_Interrupts(0xC0);
+    asm("        .code 16");
 #else
     asm("        .state16");
+#endif
     asm("        mov       A1, #0xC0");
     asm("        ldr       A2, tct_intel_disable");
     asm("        bx        A2      ");
 
+#ifdef __GNUC__
+    asm(".balign 4");
+    asm("tct_intel_disable:");
+    asm("        .word     TCT_Control_Interrupts");
+#else
     asm("tct_intel_disable 	.field     _TCT_Control_Interrupts+0,32");
     asm("	                .global	   _TCT_Control_Interrupts");
 #endif
 }
 
-void intel_int_enable(uint32 cpsr)
+void NOINLINE intel_int_enable(uint32 cpsr)
 {
 #ifdef __GNUC__
-	return NU_Control_Interrupts(cpsr);
+    asm("        .code 16");
 #else
     asm("        .state16");
+#endif
     asm("        ldr       A2, tct_intel_enable");
     asm("        bx        A2      ");
 
+#ifdef __GNUC__
+    asm(".balign 4");
+    asm("tct_intel_enable:");
+    asm("        .word     TCT_Control_Interrupts");
+#else
     asm("tct_intel_enable 	.field     _TCT_Control_Interrupts+0,32");
     asm("	                .global	   _TCT_Control_Interrupts");
 #endif