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