Mercurial > flash_v2
annotate packages/hal/mn10300/arch/current/include/hal_cache.h @ 14:01ce82f3e11a ecos-sw-1999-06-11
Merge from eCos master repository on 1999-06-11-17:05:41-BST
| author | jlarmour |
|---|---|
| date | Fri, 11 Jun 1999 09:36:56 +0000 |
| parents | 1d7f19c9e4d1 |
| children | 641b639be825 |
| rev | line source |
|---|---|
| 0 | 1 #ifndef CYGONCE_HAL_CACHE_H |
| 2 #define CYGONCE_HAL_CACHE_H | |
| 3 | |
| 4 //============================================================================= | |
| 5 // | |
| 2 | 6 // hal_cache.h |
| 0 | 7 // |
| 2 | 8 // HAL cache control API |
| 0 | 9 // |
| 10 //============================================================================= | |
| 11 //####COPYRIGHTBEGIN#### | |
| 12 // | |
| 13 // ------------------------------------------- | |
| 14 // The contents of this file are subject to the Cygnus eCos Public License | |
| 15 // Version 1.0 (the "License"); you may not use this file except in | |
| 16 // compliance with the License. You may obtain a copy of the License at | |
| 17 // http://sourceware.cygnus.com/ecos | |
| 18 // | |
| 19 // Software distributed under the License is distributed on an "AS IS" | |
| 20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 21 // License for the specific language governing rights and limitations under | |
| 22 // the License. | |
| 23 // | |
| 24 // The Original Code is eCos - Embedded Cygnus Operating System, released | |
| 25 // September 30, 1998. | |
| 26 // | |
| 27 // The Initial Developer of the Original Code is Cygnus. Portions created | |
| 2 | 28 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
| 0 | 29 // ------------------------------------------- |
| 30 // | |
| 31 //####COPYRIGHTEND#### | |
| 32 //============================================================================= | |
| 33 //#####DESCRIPTIONBEGIN#### | |
| 34 // | |
| 2 | 35 // Author(s): nickg |
| 36 // Contributors: nickg | |
| 37 // Date: 1998-02-17 | |
| 38 // Purpose: Cache control API | |
| 39 // Description: The macros defined here provide the HAL APIs for handling | |
| 0 | 40 // cache control operations. |
| 41 // Usage: | |
| 2 | 42 // #include <cyg/hal/hal_cache.h> |
| 43 // ... | |
| 44 // | |
| 0 | 45 // |
| 46 //####DESCRIPTIONEND#### | |
| 47 // | |
| 48 //============================================================================= | |
| 49 | |
| 2 | 50 #include <pkgconf/hal.h> |
| 0 | 51 #include <cyg/infra/cyg_type.h> |
| 52 | |
| 53 //============================================================================= | |
| 54 // MN10300 Simulator | |
| 55 | |
| 56 #if defined(CYG_HAL_MN10300_SIM) | |
| 57 | |
| 58 //----------------------------------------------------------------------------- | |
| 59 // Cache dimensions | |
| 60 | |
| 61 // Data cache | |
| 62 #define HAL_DCACHE_SIZE 4096 // Size of data cache in bytes | |
| 63 #define HAL_DCACHE_LINE_SIZE 16 // Size of a data cache line | |
| 64 #define HAL_DCACHE_WAYS 2 // Associativity of the cache | |
| 65 | |
| 66 // Instruction cache | |
| 67 #define HAL_ICACHE_SIZE 4096 // Size of cache in bytes | |
| 68 #define HAL_ICACHE_LINE_SIZE 16 // Size of a cache line | |
| 69 #define HAL_ICACHE_WAYS 2 // Associativity of the cache | |
| 70 | |
| 71 #define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) | |
| 72 #define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) | |
| 73 | |
| 74 //----------------------------------------------------------------------------- | |
| 75 // Global control of data cache | |
| 76 | |
| 77 // Enable the data cache | |
| 78 #define HAL_DCACHE_ENABLE() | |
| 79 | |
| 80 // Disable the data cache | |
| 81 #define HAL_DCACHE_DISABLE() | |
| 82 | |
| 83 // Invalidate the entire cache | |
| 84 #define HAL_DCACHE_INVALIDATE_ALL() | |
| 85 | |
| 86 // Synchronize the contents of the cache with memory. | |
| 87 #define HAL_DCACHE_SYNC() | |
| 88 | |
| 89 // Set the data cache refill burst size | |
| 90 //#define HAL_DCACHE_BURST_SIZE(_size_) | |
| 91 | |
| 92 // Set the data cache write mode | |
| 93 //#define HAL_DCACHE_WRITE_MODE( _mode_ ) | |
| 94 | |
| 95 // Load the contents of the given address range into the data cache | |
| 96 // and then lock the cache so that it stays there. | |
| 97 //#define HAL_DCACHE_LOCK(_base_, _size_) | |
| 98 | |
| 99 // Undo a previous lock operation | |
| 100 //#define HAL_DCACHE_UNLOCK(_base_, _size_) | |
| 101 | |
| 2 | 102 // Unlock entire cache |
| 103 //#define HAL_DCACHE_UNLOCK_ALL() | |
| 104 | |
| 0 | 105 //----------------------------------------------------------------------------- |
| 106 // Data cache line control | |
| 107 | |
| 108 // Allocate cache lines for the given address range without reading its | |
| 109 // contents from memory. | |
| 110 //#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) | |
| 111 | |
| 112 // Write dirty cache lines to memory and invalidate the cache entries | |
| 113 // for the given address range. | |
| 114 //#define HAL_DCACHE_FLUSH( _base_ , _size_ ) | |
| 115 | |
| 116 // Invalidate cache lines in the given range without writing to memory. | |
| 117 //#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) | |
| 118 | |
| 119 // Write dirty cache lines to memory for the given address range. | |
| 120 //#define HAL_DCACHE_STORE( _base_ , _size_ ) | |
| 121 | |
| 122 // Preread the given range into the cache with the intention of reading | |
| 123 // from it later. | |
| 124 //#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) | |
| 125 | |
| 126 // Preread the given range into the cache with the intention of writing | |
| 127 // to it later. | |
| 128 //#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) | |
| 129 | |
| 130 // Allocate and zero the cache lines associated with the given range. | |
| 131 //#define HAL_DCACHE_ZERO( _base_ , _size_ ) | |
| 132 | |
| 133 //----------------------------------------------------------------------------- | |
| 134 // Global control of Instruction cache | |
| 135 | |
| 136 // Enable the instruction cache | |
| 137 #define HAL_ICACHE_ENABLE() | |
| 138 | |
| 139 // Disable the instruction cache | |
| 140 #define HAL_ICACHE_DISABLE() | |
| 141 | |
| 142 // Invalidate the entire cache | |
| 143 #define HAL_ICACHE_INVALIDATE_ALL() | |
| 144 | |
| 145 // Synchronize the contents of the cache with memory. | |
| 146 #define HAL_ICACHE_SYNC() | |
| 147 | |
| 148 // Set the instruction cache refill burst size | |
| 149 //#define HAL_ICACHE_BURST_SIZE(_size_) | |
| 150 | |
| 151 // Load the contents of the given address range into the instruction cache | |
| 152 // and then lock the cache so that it stays there. | |
| 153 //#define HAL_ICACHE_LOCK(_base_, _size_) | |
| 154 | |
| 155 // Undo a previous lock operation | |
| 156 //#define HAL_ICACHE_UNLOCK(_base_, _size_) | |
| 157 | |
| 2 | 158 // Unlock entire cache |
| 159 //#define HAL_ICACHE_UNLOCK_ALL() | |
| 160 | |
| 0 | 161 //----------------------------------------------------------------------------- |
| 162 // Instruction cache line control | |
| 163 | |
| 164 // Invalidate cache lines in the given range without writing to memory. | |
| 165 //#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) | |
| 166 | |
| 167 #endif | |
| 168 | |
| 169 | |
| 170 //============================================================================= | |
| 171 // MN103002 implementation | |
| 172 | |
| 173 #if !defined(CYG_HAL_MN10300_SIM) && defined(CYG_HAL_MN10300_MN103002) | |
| 174 | |
| 175 //----------------------------------------------------------------------------- | |
| 176 // Cache dimensions | |
| 177 | |
| 178 | |
| 179 // Data cache | |
| 180 #define HAL_DCACHE_SIZE 4096 // Size of data cache in bytes | |
| 181 #define HAL_DCACHE_LINE_SIZE 16 // Size of a data cache line | |
| 182 #define HAL_DCACHE_WAYS 2 // Associativity of the cache | |
| 183 | |
| 184 // Instruction cache | |
| 185 #define HAL_ICACHE_SIZE 4096 // Size of cache in bytes | |
| 186 #define HAL_ICACHE_LINE_SIZE 16 // Size of a cache line | |
| 187 #define HAL_ICACHE_WAYS 2 // Associativity of the cache | |
| 188 | |
| 189 #define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) | |
| 190 #define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) | |
| 191 | |
| 192 //----------------------------------------------------------------------------- | |
| 193 // Control registers | |
| 194 | |
| 2 | 195 #define HAL_CHCTR ((volatile CYG_ADDRWORD *)0x20000070) |
| 0 | 196 |
| 197 #define HAL_CHCTR_ICEN 0x0001 | |
| 198 #define HAL_CHCTR_DCEN 0x0002 | |
| 199 #define HAL_CHCTR_ICBUSY 0x0004 | |
| 200 #define HAL_CHCTR_DCBUSY 0x0008 | |
| 201 #define HAL_CHCTR_ICINV 0x0010 | |
| 202 #define HAL_CHCTR_DCINV 0x0020 | |
| 203 #define HAL_CHCTR_DCWTMD 0x0040 | |
| 204 #define HAL_CHCTR_ICWMD 0x0300 | |
| 205 #define HAL_CHCTR_DCWMD 0x3000 | |
| 206 | |
| 2 | 207 #define HAL_DCACHE_PURGE_WAY0 ((volatile CYG_BYTE *)0x28400000) |
| 208 #define HAL_DCACHE_PURGE_WAY1 ((volatile CYG_BYTE *)0x28401000) | |
| 0 | 209 |
| 210 //----------------------------------------------------------------------------- | |
| 211 // Global control of data cache | |
| 212 | |
| 213 // Enable the data cache | |
| 214 #define HAL_DCACHE_ENABLE() \ | |
| 215 { \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
216 register CYG_ADDRWORD chctr = *HAL_CHCTR; \ |
| 0 | 217 chctr |= HAL_CHCTR_DCEN; \ |
| 218 *HAL_CHCTR = chctr; \ | |
| 219 } | |
| 220 | |
| 221 // Disable the data cache | |
| 222 #define HAL_DCACHE_DISABLE() \ | |
| 223 { \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
224 register CYG_ADDRWORD chctr = *HAL_CHCTR; \ |
| 0 | 225 chctr &= ~HAL_CHCTR_DCEN; \ |
| 226 *HAL_CHCTR = chctr; \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
227 while( HAL_CHCTR_DCBUSY & *HAL_CHCTR ); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
228 } |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
229 |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
230 // Query the state of the data cache |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
231 #define HAL_DCACHE_IS_ENABLED(_state_) \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
232 { \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
233 register CYG_ADDRWORD chctr = *HAL_CHCTR; \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
234 _state_ = (0 != (chctr & HAL_CHCTR_DCEN)); \ |
| 0 | 235 } |
| 236 | |
| 237 // Invalidate the entire cache | |
| 238 #define HAL_DCACHE_INVALIDATE_ALL() \ | |
| 239 { \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
240 register CYG_ADDRWORD chctr; \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
241 register CYG_ADDRWORD state; \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
242 HAL_DCACHE_IS_ENABLED(state); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
243 if (state) \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
244 HAL_DCACHE_DISABLE(); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
245 chctr = *HAL_CHCTR; \ |
| 0 | 246 chctr |= HAL_CHCTR_DCINV; \ |
| 247 *HAL_CHCTR = chctr; \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
248 while( HAL_CHCTR_DCBUSY & *HAL_CHCTR ); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
249 if (state) \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
250 HAL_DCACHE_ENABLE(); \ |
| 0 | 251 } |
| 252 | |
| 253 // Synchronize the contents of the cache with memory. | |
| 2 | 254 #define HAL_DCACHE_SYNC() HAL_DCACHE_STORE( 0, HAL_DCACHE_SIZE/HAL_DCACHE_WAYS ) |
| 0 | 255 |
| 256 // Set the data cache refill burst size | |
| 257 //#define HAL_DCACHE_BURST_SIZE(_size_) | |
| 258 | |
| 259 // Set the data cache write mode | |
| 260 #define HAL_DCACHE_WRITE_MODE( _mode_ ) \ | |
| 261 { \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
262 register CYG_ADDRWORD chctr; \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
263 register CYG_ADDRWORD state; \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
264 HAL_DCACHE_IS_ENABLED(state); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
265 if (state) \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
266 HAL_DCACHE_DISABLE(); \ |
| 0 | 267 chctr = *HAL_CHCTR; \ |
| 268 chctr |= HAL_CHCTR_DCWTMD*(_mode_); \ | |
| 269 *HAL_CHCTR = chctr; \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
270 while( HAL_CHCTR_DCBUSY & *HAL_CHCTR ); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
271 if (state) \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
272 HAL_DCACHE_ENABLE(); \ |
| 0 | 273 } |
| 274 | |
| 275 #define HAL_DCACHE_WRITEBACK_MODE 0 | |
| 276 #define HAL_DCACHE_WRITETHRU_MODE 1 | |
| 277 | |
| 278 // Load the contents of the given address range into the data cache | |
| 279 // and then lock the cache so that it stays there. | |
| 280 //#define HAL_DCACHE_LOCK(_base_, _size_) | |
| 281 | |
| 282 // Undo a previous lock operation | |
| 283 //#define HAL_DCACHE_UNLOCK(_base_, _size_) | |
| 284 | |
| 2 | 285 // Unlock entire cache |
| 286 //#define HAL_DCACHE_UNLOCK_ALL() | |
| 287 | |
| 0 | 288 //----------------------------------------------------------------------------- |
| 289 // Data cache line control | |
| 290 | |
| 291 // Allocate cache lines for the given address range without reading its | |
| 292 // contents from memory. | |
| 293 //#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) | |
| 294 | |
| 295 // Write dirty cache lines to memory and invalidate the cache entries | |
| 296 // for the given address range. | |
| 297 //#define HAL_DCACHE_FLUSH( _base_ , _size_ ) | |
| 298 | |
| 299 // Invalidate cache lines in the given range without writing to memory. | |
| 300 //#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) | |
| 301 | |
| 302 // Write dirty cache lines to memory for the given address range. | |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
4
diff
changeset
|
303 |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
4
diff
changeset
|
304 // This functionality requires 4 register variables. To prevent register |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
4
diff
changeset
|
305 // spilling, put the code in a separate function. |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
4
diff
changeset
|
306 externC void cyg_hal_dcache_store(CYG_ADDRWORD base, int size); |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
4
diff
changeset
|
307 |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
4
diff
changeset
|
308 #define HAL_DCACHE_STORE( _base_ , _size_ ) \ |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
4
diff
changeset
|
309 cyg_hal_dcache_store((_base_), (_size_)) |
| 0 | 310 |
| 311 // Preread the given range into the cache with the intention of reading | |
| 312 // from it later. | |
| 313 //#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) | |
| 314 | |
| 315 // Preread the given range into the cache with the intention of writing | |
| 316 // to it later. | |
| 317 //#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) | |
| 318 | |
| 319 // Allocate and zero the cache lines associated with the given range. | |
| 320 //#define HAL_DCACHE_ZERO( _base_ , _size_ ) | |
| 321 | |
| 322 //----------------------------------------------------------------------------- | |
| 323 // Global control of Instruction cache | |
| 324 | |
| 325 // Enable the instruction cache | |
| 326 #define HAL_ICACHE_ENABLE() \ | |
| 327 { \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
328 register CYG_ADDRWORD chctr = *HAL_CHCTR; \ |
| 0 | 329 chctr |= HAL_CHCTR_ICEN; \ |
| 330 *HAL_CHCTR = chctr; \ | |
| 331 } | |
| 332 | |
| 333 // Disable the instruction cache | |
| 334 #define HAL_ICACHE_DISABLE() \ | |
| 335 { \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
336 register CYG_ADDRWORD chctr = *HAL_CHCTR; \ |
| 0 | 337 chctr &= ~HAL_CHCTR_ICEN; \ |
| 338 *HAL_CHCTR = chctr; \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
339 while( HAL_CHCTR_ICBUSY & *HAL_CHCTR ); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
340 } |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
341 |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
342 // Query the state of the instruction cache |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
343 #define HAL_ICACHE_IS_ENABLED(_state_) \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
344 { \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
345 register CYG_ADDRWORD chctr = *HAL_CHCTR; \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
346 _state_ = (0 != (chctr & HAL_CHCTR_ICEN)); \ |
| 0 | 347 } |
| 348 | |
| 349 // Invalidate the entire cache | |
| 350 #define HAL_ICACHE_INVALIDATE_ALL() \ | |
| 351 { \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
352 register CYG_ADDRWORD chctr; \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
353 register CYG_ADDRWORD state; \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
354 HAL_ICACHE_IS_ENABLED(state); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
355 if (state) \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
356 HAL_ICACHE_DISABLE(); \ |
| 0 | 357 chctr = *HAL_CHCTR; \ |
| 358 chctr |= HAL_CHCTR_ICINV; \ | |
| 359 *HAL_CHCTR = chctr; \ | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
360 while( HAL_CHCTR_ICBUSY & *HAL_CHCTR ); \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
361 if (state) \ |
|
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
362 HAL_ICACHE_ENABLE(); \ |
| 0 | 363 } |
| 364 | |
| 365 // Synchronize the contents of the cache with memory. | |
| 366 #define HAL_ICACHE_SYNC() | |
| 367 | |
| 368 // Set the instruction cache refill burst size | |
| 369 //#define HAL_ICACHE_BURST_SIZE(_size_) | |
| 370 | |
| 371 // Load the contents of the given address range into the instruction cache | |
| 372 // and then lock the cache so that it stays there. | |
| 373 //#define HAL_ICACHE_LOCK(_base_, _size_) | |
| 374 | |
| 375 // Undo a previous lock operation | |
| 376 //#define HAL_ICACHE_UNLOCK(_base_, _size_) | |
| 377 | |
| 2 | 378 // Unlock entire cache |
| 379 //#define HAL_ICACHE_UNLOCK_ALL() | |
| 380 | |
| 0 | 381 //----------------------------------------------------------------------------- |
| 382 // Instruction cache line control | |
| 383 | |
| 384 // Invalidate cache lines in the given range without writing to memory. | |
| 385 //#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) | |
| 386 | |
| 387 #endif | |
| 388 | |
| 2 | 389 //----------------------------------------------------------------------------- |
| 390 // Check that a supported configuration has actually defined some macros. | |
| 391 | |
| 392 #ifndef HAL_DCACHE_ENABLE | |
| 393 | |
| 394 #error Unsupported MN10300 configuration | |
| 395 | |
| 396 #endif | |
| 0 | 397 |
| 398 //----------------------------------------------------------------------------- | |
| 399 #endif // ifndef CYGONCE_HAL_CACHE_H | |
| 400 // End of hal_cache.h |
