navienginebsp/naviengine_assp/interrupts.cia
changeset 0 5de814552237
equal deleted inserted replaced
-1:000000000000 0:5de814552237
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 * naviengine_assp\interrupts.cia
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #include <naviengine_priv.h>
       
    22 
       
    23 #ifndef __SMP__
       
    24 __NAKED__ void NaviEngineInterrupt::IrqDispatch()
       
    25 	{
       
    26 	asm("stmfd sp!, {r4,r5,lr}");
       
    27 	asm("ldr r4, __KHwBaseIntIf");							// Base address of Interrupt interface
       
    28 	asm("ldr r12, __Handlers");								// Base address of interrupt handlers
       
    29 
       
    30 
       
    31  	asm("ldr r5, [r4, #%a0]" : : "i" ((TInt)KHoCIIIntAck));	// Acknowledge the interrupt
       
    32 
       
    33 	asm("ldr lr, __KHmIntMask");							// Interrupt mask in end-of-interrupt register
       
    34     asm("and r5, r5, lr");									// r5 = interruptID
       
    35 
       
    36     asm("cmp r5, lr");										// Spurious interrupt has ID 1023
       
    37     asm("beq IRQ_End");				
       
    38 
       
    39     // Call handler
       
    40 	asm("add r12, r12, r5, lsl #3");
       
    41 	asm("adr lr, IRQ_End");
       
    42 	asm("ldmia r12, {r0, pc}");       						// Call interrupt handler. This will alse clear interrupt cause.
       
    43     
       
    44 	// End of Interrupt
       
    45 	asm("IRQ_End:");
       
    46 	asm("str r5, [r4, #%a0]" : : "i" ((TInt)KHoCIIEndOfInt));
       
    47 	asm("ldmfd sp!, {r4,r5,pc}");          						// No more pending, so finish
       
    48 
       
    49 	asm("__KHwBaseIntIf:");
       
    50 	asm(".word %a0" : : "i" ((TInt)KHwBaseIntIf));
       
    51 	asm("__Handlers: ");
       
    52 	asm(".word %a0" : : "i" ((TInt)&NaviEngineInterrupt::Handlers[0]));
       
    53 	asm("__KHmIntMask:");
       
    54 	asm(".word %a0" : : "i" ((TInt)1023));
       
    55 	}
       
    56 #endif
       
    57 
       
    58 //FIQ is not used, so this should never be called.
       
    59 __NAKED__ void NaviEngineInterrupt::FiqDispatch()
       
    60 	{
       
    61 	asm("mov r0, #0");
       
    62 	asm("sub r0, r0, #1"); 	//	r0 = -1
       
    63 	asm("str r0, [r0]"); 	//	Generate exception
       
    64 	}