Bug 1806 - Simplify/Remove use of inline assembler. CompilerCompatibility
authorPeter Fordham <peter.fordham@gmail.com>
Mon, 31 May 2010 16:05:54 -0700
branchCompilerCompatibility
changeset 76 8e8bf3dcfd6b
parent 59 62a56fb37080
Bug 1806 - Simplify/Remove use of inline assembler.
baseport/syborg/specific/interrupts.cia
baseport/syborg/specific/syborg.cia
baseport/syborg/specific/syborg.cpp
--- a/baseport/syborg/specific/interrupts.cia	Tue Apr 13 18:30:00 2010 +0100
+++ b/baseport/syborg/specific/interrupts.cia	Mon May 31 16:05:54 2010 -0700
@@ -50,16 +50,13 @@
 __NAKED__ void SyborgInterrupt::MsTimerTick(TAny* /*aPtr*/)
 {
 	// Service 1ms tick interrupt
-	asm("ldr r1, __KHwCounterTimer");
+	asm("ldr r1, =KHwCounterTimer");
 	asm("push {r0}");
 	asm("mov r0, #1");
 	asm("str r0, [r1, #24]");
 	asm("pop {r0}");
 	asm("b "CSM_ZN7NTimerQ4TickEv);
 	asm("bx lr");
-
-	asm("__KHwCounterTimer:");
-	asm(".word %a0" : : "i" ((TInt)KHwBaseCounterTimer));
 }
 
 /********************************************************************
@@ -72,8 +69,8 @@
 __NAKED__ void SyborgInterrupt::IrqDispatch()
 {
 	asm("push {r4,r5,lr} ");
-	asm("ldr r4, __KHwBaseSic");
-	asm("ldr r12, __SicHandlerStart");
+	asm("ldr r4, =KHwBaseSic");
+	asm("ldr r12, =Handlers");
 	asm("ldr r5, [r4, #8]");  // r5 - pending interrupt
 	asm("adr lr, Clear");
 	asm("add r12, r5, lsl #3");
@@ -83,10 +80,6 @@
 	//	asm("str r5, [r4, #16]");        // TODO: error
 	asm("pop {r4,r5,pc}");
 
-	asm("__KHwBaseSic:");
-	asm(".word %a0" : : "i" ((TInt)KHwBaseSic));
-	asm("__SicHandlerStart:");
-	asm(".word %a0" : : "i" ((TInt)&Handlers[0]));
 }
 
 __NAKED__ void SyborgInterrupt::FiqDispatch()
--- a/baseport/syborg/specific/syborg.cia	Tue Apr 13 18:30:00 2010 +0100
+++ b/baseport/syborg/specific/syborg.cia	Mon May 31 16:05:54 2010 -0700
@@ -51,25 +51,3 @@
     asm("bx lr");
 }
 
-//
-//Interrupt Controller Acces Functions
-//
-
-// Enable specified motherboard Int on either the PIC/SIC
-EXPORT_C void __NAKED__ TSyborg::EnableInt(TUint /*anId*/)
-{
-  asm("ldr r1, __KHwInt");
-  asm("str r0, [r1, #20]");
-  asm("bx lr");
-}
-
-// Disable specified motherboard Int on either the PIC/SIC
-EXPORT_C void __NAKED__ TSyborg::DisableInt(TUint /*anId*/)
-{
-  asm("ldr r1, __KHwInt");
-  asm("str r0, [r1, #16]");
-  asm("bx lr");
-	
-	asm("__KHwInt:");
-	asm(".word %a0" : : "i" (TInt)(KHwBaseSic));
-}
--- a/baseport/syborg/specific/syborg.cpp	Tue Apr 13 18:30:00 2010 +0100
+++ b/baseport/syborg/specific/syborg.cpp	Mon May 31 16:05:54 2010 -0700
@@ -128,3 +128,18 @@
   return 0;
 }
 
+//
+//Interrupt Controller Acces Functions
+//
+
+// Enable specified motherboard Int on either the PIC/SIC
+EXPORT_C void TSyborg::EnableInt(TUint anId)
+{
+   WriteReg(KHwBaseSic, 5, anId);
+}
+
+// Disable specified motherboard Int on either the PIC/SIC
+EXPORT_C void TSyborg::DisableInt(TUint anId)
+{
+   WriteReg(KHwBaseSic, 4, anId);
+}