1 |
27 |
unneback |
#ifndef CYGONCE_VAR_CACHE_H
|
2 |
|
|
#define CYGONCE_VAR_CACHE_H
|
3 |
|
|
//=============================================================================
|
4 |
|
|
//
|
5 |
|
|
// var_cache.h
|
6 |
|
|
//
|
7 |
|
|
// Variant HAL cache control API
|
8 |
|
|
//
|
9 |
|
|
//=============================================================================
|
10 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
18 |
|
|
//
|
19 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
20 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
21 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
22 |
|
|
// for more details.
|
23 |
|
|
//
|
24 |
|
|
// You should have received a copy of the GNU General Public License along
|
25 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
26 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
27 |
|
|
//
|
28 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
29 |
|
|
// or inline functions from this file, or you compile this file and link it
|
30 |
|
|
// with other works to produce a work based on this file, this file does not
|
31 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
32 |
|
|
// License. However the source code for this file must still be made available
|
33 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
36 |
|
|
// this file might be covered by the GNU General Public License.
|
37 |
|
|
//
|
38 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
39 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//=============================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): Bob Koninckx
|
46 |
|
|
// Contributors:Bob Koninckx
|
47 |
|
|
// Date: 2001-12-11
|
48 |
|
|
// Purpose: Variant cache control API
|
49 |
|
|
// Description: The macros defined here provide the HAL APIs for handling
|
50 |
|
|
// cache control operations on the MPC8xx variant CPUs.
|
51 |
|
|
// Usage: Is included via the architecture cache header:
|
52 |
|
|
// #include <cyg/hal/hal_cache.h>
|
53 |
|
|
// ...
|
54 |
|
|
//
|
55 |
|
|
//####DESCRIPTIONEND####
|
56 |
|
|
//
|
57 |
|
|
//=============================================================================
|
58 |
|
|
|
59 |
|
|
#include <pkgconf/hal.h>
|
60 |
|
|
#include <cyg/infra/cyg_type.h>
|
61 |
|
|
|
62 |
|
|
#include <cyg/hal/ppc_regs.h>
|
63 |
|
|
|
64 |
|
|
#include <cyg/hal/plf_cache.h>
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
//-----------------------------------------------------------------------------
|
68 |
|
|
// MPC5xx has no data or instruction cache. This is going to be a relatively
|
69 |
|
|
// simple file
|
70 |
|
|
|
71 |
|
|
//-----------------------------------------------------------------------------
|
72 |
|
|
// Global control of data cache
|
73 |
|
|
|
74 |
|
|
// Enable the data cache
|
75 |
|
|
#define HAL_DCACHE_ENABLE() \
|
76 |
|
|
CYG_MACRO_START \
|
77 |
|
|
CYG_MACRO_END
|
78 |
|
|
|
79 |
|
|
// Disable the data cache
|
80 |
|
|
#define HAL_DCACHE_DISABLE() \
|
81 |
|
|
CYG_MACRO_START \
|
82 |
|
|
CYG_MACRO_END
|
83 |
|
|
|
84 |
|
|
// Invalidate the entire cache
|
85 |
|
|
#define HAL_DCACHE_INVALIDATE_ALL() \
|
86 |
|
|
CYG_MACRO_START \
|
87 |
|
|
CYG_MACRO_END
|
88 |
|
|
|
89 |
|
|
// Synchronize the contents of the cache with memory.
|
90 |
|
|
#define HAL_DCACHE_SYNC() \
|
91 |
|
|
CYG_MACRO_START \
|
92 |
|
|
CYG_MACRO_END
|
93 |
|
|
|
94 |
|
|
// Query the state of the data cache
|
95 |
|
|
#define HAL_DCACHE_IS_ENABLED(_state_) \
|
96 |
|
|
CYG_MACRO_START \
|
97 |
|
|
_state_ = 0; \
|
98 |
|
|
CYG_MACRO_END
|
99 |
|
|
|
100 |
|
|
// Load the contents of the given address range into the data cache
|
101 |
|
|
// and then lock the cache so that it stays there.
|
102 |
|
|
|
103 |
|
|
//#define HAL_DCACHE_LOCK(_base_, _size_)
|
104 |
|
|
|
105 |
|
|
// Undo a previous lock operation
|
106 |
|
|
//#define HAL_DCACHE_UNLOCK(_base_, _size_)
|
107 |
|
|
|
108 |
|
|
// Unlock entire cache
|
109 |
|
|
//#define HAL_DCACHE_UNLOCK_ALL()
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
//-----------------------------------------------------------------------------
|
113 |
|
|
// Data cache line control
|
114 |
|
|
|
115 |
|
|
// Write dirty cache lines to memory and invalidate the cache entries
|
116 |
|
|
// for the given address range.
|
117 |
|
|
//#define HAL_DCACHE_FLUSH( _base_ , _size_ )
|
118 |
|
|
|
119 |
|
|
// Invalidate cache lines in the given range without writing to memory.
|
120 |
|
|
//#define HAL_DCACHE_INVALIDATE( _base_ , _size_ )
|
121 |
|
|
|
122 |
|
|
// Write dirty cache lines to memory for the given address range.
|
123 |
|
|
//#define HAL_DCACHE_STORE( _base_ , _size_ )
|
124 |
|
|
|
125 |
|
|
// Preread the given range into the cache with the intention of reading
|
126 |
|
|
// from it later.
|
127 |
|
|
//#define HAL_DCACHE_READ_HINT( _base_ , _size_ )
|
128 |
|
|
|
129 |
|
|
// Preread the given range into the cache with the intention of writing
|
130 |
|
|
// to it later.
|
131 |
|
|
//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ )
|
132 |
|
|
|
133 |
|
|
// Allocate and zero the cache lines associated with the given range.
|
134 |
|
|
//#define HAL_DCACHE_ZERO( _base_ , _size_ )
|
135 |
|
|
|
136 |
|
|
//-----------------------------------------------------------------------------
|
137 |
|
|
// Global control of Instruction cache
|
138 |
|
|
|
139 |
|
|
// Enable the instruction cache
|
140 |
|
|
#define HAL_ICACHE_ENABLE() \
|
141 |
|
|
CYG_MACRO_START \
|
142 |
|
|
CYG_MACRO_END
|
143 |
|
|
|
144 |
|
|
// Disable the instruction cache
|
145 |
|
|
#define HAL_ICACHE_DISABLE() \
|
146 |
|
|
CYG_MACRO_START \
|
147 |
|
|
CYG_MACRO_END
|
148 |
|
|
|
149 |
|
|
// Invalidate the entire cache
|
150 |
|
|
#define HAL_ICACHE_INVALIDATE_ALL() \
|
151 |
|
|
CYG_MACRO_START \
|
152 |
|
|
CYG_MACRO_END
|
153 |
|
|
|
154 |
|
|
// Synchronize the contents of the cache with memory.
|
155 |
|
|
#define HAL_ICACHE_SYNC() \
|
156 |
|
|
CYG_MACRO_START \
|
157 |
|
|
CYG_MACRO_END
|
158 |
|
|
|
159 |
|
|
// Query the state of the instruction cache
|
160 |
|
|
#define HAL_ICACHE_IS_ENABLED(_state_) \
|
161 |
|
|
CYG_MACRO_START \
|
162 |
|
|
_state_ = 0; \
|
163 |
|
|
CYG_MACRO_END
|
164 |
|
|
|
165 |
|
|
// Load the contents of the given address range into the instruction cache
|
166 |
|
|
// and then lock the cache so that it stays there.
|
167 |
|
|
//#define HAL_ICACHE_LOCK(_base_, _size_)
|
168 |
|
|
|
169 |
|
|
// Undo a previous lock operation
|
170 |
|
|
//#define HAL_ICACHE_UNLOCK(_base_, _size_)
|
171 |
|
|
|
172 |
|
|
// Unlock entire cache
|
173 |
|
|
//#define HAL_ICACHE_UNLOCK_ALL()
|
174 |
|
|
|
175 |
|
|
//-----------------------------------------------------------------------------
|
176 |
|
|
#endif // ifndef CYGONCE_VAR_CACHE_H
|
177 |
|
|
// End of var_cache.h
|