omap3530/beagleboard/src/variant.cia
changeset 0 6663340f3fc9
child 36 601ea115c8aa
equal deleted inserted replaced
-1:000000000000 0:6663340f3fc9
       
     1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // omap3530/beagleboard/src/variant.cia
       
    15 //
       
    16 
       
    17 #include <e32cmn.h>
       
    18 #include <e32cia.h>
       
    19 #include <beagle/iolines.h>
       
    20 
       
    21 /******************************************************************************
       
    22  * Interrupt handling/dispatch
       
    23  ******************************************************************************/
       
    24 __NAKED__ void XIntDispatch(TAny*)
       
    25 	{
       
    26 	// Service second-level Variant Interrupts
       
    27 	// Enter with r0->{Variant int controller base; Handlers;}
       
    28 	asm("stmfd sp!, {r4,lr} ");
       
    29 	asm("ldmia r0, {r3,r4} ");										// r3=Variant interrupt controller base, r4->handlers
       
    30 	asm("0: ");
       
    31 	asm("ldr r0, [r3, #%a0]" : : "i" ((TInt)KHoIntContEnable));		// r0=bitmask with enabled interrupts
       
    32 	asm("ldr r1, [r3, #%a0]" : : "i" ((TInt)KHoIntContPending));	// r1=bitmask with pending interrupts
       
    33 	asm("mov r2, #31 ");											// int id
       
    34 	asm("and r0, r0, r1 ");
       
    35 	asm("bics r0, r0, #0xf8000000 ");								// mask unused bits (only 26 2nd-level ints defined)
       
    36 	asm("ldmeqfd sp!, {r4,pc} ");									// if no 2nd level interrupts pending, exit
       
    37 	asm("cmp r0, #0x00010000 ");
       
    38 	asm("movcc r0, r0, lsl #16 ");
       
    39 	asm("subcc r2, r2, #16 ");
       
    40 	asm("cmp r0, #0x01000000 ");
       
    41 	asm("movcc r0, r0, lsl #8 ");
       
    42 	asm("subcc r2, r2, #8 ");
       
    43 	asm("cmp r0, #0x10000000 ");
       
    44 	asm("movcc r0, r0, lsl #4 ");
       
    45 	asm("subcc r2, r2, #4 ");
       
    46 	asm("cmp r0, #0x40000000 ");
       
    47 	asm("movcc r0, r0, lsl #2 ");
       
    48 	asm("subcc r2, r2, #2 ");
       
    49 	asm("cmp r0, #0x80000000 ");
       
    50 	asm("subcc r2, r2, #1 ");										// r2=bit no. of MS 1
       
    51 	asm("add r0, r4, r2, lsl #3 ");									// r0->handler for this interrupt
       
    52 	asm("adr lr, 0b ");												// look again after calling handler
       
    53 	asm("ldmia r0, {r0,pc} ");										// jump to handler
       
    54 	}
       
    55 
       
    56 __NAKED__ void ArmWaitForInterrupt()
       
    57 	{
       
    58 	//ARM_WFI;
       
    59 	asm(".word %a0" : : "i" ((TInt)(0x0320f003 | ((14)<<28) )) )
       
    60 	asm("	bx		lr");
       
    61 	}
       
    62 
       
    63