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