OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [arm/] [xscale/] [cores/] [v2_0/] [include/] [hal_xscale.h] - Blame information for rev 565

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
/*=============================================================================
2
//
3
//      hal_xscale.h
4
//
5
//      XScale Core I/O module support.
6
//
7
//=============================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//=============================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):    msalter
44
// Contributors: msalter
45
// Date:         2002-10-18
46
// Purpose:
47
// Description:  XScale core I/O modules support.
48
// Usage:        #include <cyg/hal/hal_xscale.h>
49
//
50
//####DESCRIPTIONEND####
51
//
52
//===========================================================================*/
53
#ifndef CYGONCE_HAL_ARM_XSCALE_HAL_XSCALE_H
54
#define CYGONCE_HAL_ARM_XSCALE_HAL_XSCALE_H
55
 
56
#include <pkgconf/system.h>
57
#include <pkgconf/hal_arm_xscale_core.h>
58
 
59
#ifdef __ASSEMBLER__
60
        // Useful CPU macros
61
 
62
        // Delay a bit
63
        .macro DELAY_FOR cycles, reg0
64
        ldr     \reg0, =\cycles
65
        subs    \reg0, \reg0, #1
66
        subne   pc,  pc, #0xc
67
        .endm
68
 
69
        // wait for coprocessor write complete
70
        .macro CPWAIT reg
71
        mrc  p15,0,\reg,c2,c0,0
72
        mov  \reg,\reg
73
        sub  pc,pc,#4
74
        .endm
75
 
76
        // Enable the BTB
77
        .macro BTB_INIT reg
78
        mrc     p15, 0, \reg, c1, c0, 0
79
#ifdef CYGSEM_HAL_ARM_XSCALE_BTB
80
        orr     \reg, \reg, #MMU_Control_BTB
81
#else
82
        bic     \reg, \reg, #MMU_Control_BTB
83
#endif
84
        mcr     p15, 0, \reg, c1, c0, 0
85
        CPWAIT  \reg
86
        .endm
87
#else
88
static inline void CPWAIT(void) {
89
    cyg_uint32 tmp;
90
    asm volatile ("mrc  p15,0,%0,c2,c0,0\n"
91
                  "mov  %0,%0\n"
92
                  "sub  pc,pc,#4" : "=r" (tmp));
93
}
94
#endif
95
 
96
// Override the default MMU off code. This is intended
97
// to be included in an inline asm statement.
98
#define CYGARC_HAL_MMU_OFF(__paddr__)        \
99
              "   mrc p15,0,r0,c1,c0,0\n"    \
100
              "   bic r0,r0,#0x05\n"         \
101
              "   b 99f\n"                   \
102
              "   .p2align 5\n"              \
103
              "99:\n"                        \
104
              "   mcr p15,0,r0,c1,c0,0\n"    \
105
              "   mrc p15,0,r0,c2,c0,0\n"    \
106
              "   mov r0,r0\n"               \
107
              "   sub pc,pc,#4\n"            \
108
              "   mov pc," #__paddr__ "\n"
109
 
110
#ifdef __ASSEMBLER__
111
 
112
#define REG8(a,b)  (b)
113
#define REG16(a,b) (b)
114
#define REG32(a,b) (b)
115
 
116
#else /* __ASSEMBLER__ */
117
 
118
#define REG8(a,b)  ((volatile unsigned char *)((a)+(b)))
119
#define REG16(a,b) ((volatile unsigned short *)((a)+(b)))
120
#define REG32(a,b) ((volatile unsigned int *)((a)+(b)))
121
 
122
extern void hal_xscale_core_init(void);
123
#endif /* __ASSEMBLER__ */
124
 
125
//--------------------------------------------------------------
126
#endif // CYGONCE_HAL_ARM_XSCALE_HAL_XSCALE_H
127
// EOF hal_xscale.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.