Mercurial > ecos
annotate packages/hal/arm/pid/current/include/hal_cache.h @ 161:ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
| author | jlarmour |
|---|---|
| date | Sun, 10 Jun 2001 19:35:23 +0000 |
| parents | b939e9cada46 |
| children | e0c0827131d1 |
| rev | line source |
|---|---|
| 2 | 1 #ifndef CYGONCE_HAL_CACHE_H |
| 2 #define CYGONCE_HAL_CACHE_H | |
| 3 | |
| 4 //============================================================================= | |
| 5 // | |
| 6 // hal_cache.h | |
| 7 // | |
| 8 // HAL cache control API | |
| 9 // | |
| 10 //============================================================================= | |
| 11 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
12 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
13 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
14 // The contents of this file are subject to the Red Hat eCos Public License |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
15 // Version 1.1 (the "License"); you may not use this file except in |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
16 // compliance with the License. You may obtain a copy of the License at |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
17 // http://www.redhat.com/ |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
18 // |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
19 // Software distributed under the License is distributed on an "AS IS" |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
21 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
22 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
24 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
25 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
26 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
27 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
28 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
29 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
30 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
31 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
32 // |
| 2 | 33 //####COPYRIGHTEND#### |
| 34 //============================================================================= | |
| 35 //#####DESCRIPTIONBEGIN#### | |
| 36 // | |
| 37 // Author(s): nickg, gthomas | |
| 38 // Contributors: nickg, gthomas | |
| 39 // Date: 1998-09-28 | |
| 40 // Purpose: Cache control API | |
| 41 // Description: The macros defined here provide the HAL APIs for handling | |
| 42 // cache control operations. | |
| 43 // Usage: | |
| 44 // #include <cyg/hal/hal_cache.h> | |
| 45 // ... | |
| 46 // | |
| 47 // | |
| 48 //####DESCRIPTIONEND#### | |
| 49 // | |
| 50 //============================================================================= | |
| 51 | |
| 52 #include <cyg/infra/cyg_type.h> | |
| 53 | |
| 54 //----------------------------------------------------------------------------- | |
| 55 // Cache dimensions | |
| 56 | |
| 57 // Data cache | |
|
161
ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
jlarmour
parents:
156
diff
changeset
|
58 //#define HAL_DCACHE_SIZE 0 // Size of data cache in bytes |
|
ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
jlarmour
parents:
156
diff
changeset
|
59 //#define HAL_DCACHE_LINE_SIZE 0 // Size of a data cache line |
|
ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
jlarmour
parents:
156
diff
changeset
|
60 //#define HAL_DCACHE_WAYS 0 // Associativity of the cache |
| 2 | 61 |
| 62 // Instruction cache | |
|
161
ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
jlarmour
parents:
156
diff
changeset
|
63 //#define HAL_ICACHE_SIZE 0 // Size of cache in bytes |
|
ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
jlarmour
parents:
156
diff
changeset
|
64 //#define HAL_ICACHE_LINE_SIZE 0 // Size of a cache line |
|
ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
jlarmour
parents:
156
diff
changeset
|
65 //#define HAL_ICACHE_WAYS 0 // Associativity of the cache |
| 2 | 66 |
|
161
ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
jlarmour
parents:
156
diff
changeset
|
67 //#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS)) |
|
ac086aa3217e
Merge from eCos master repository on 2001-06-08-21:11:51-BST
jlarmour
parents:
156
diff
changeset
|
68 //#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS)) |
| 2 | 69 |
| 70 //----------------------------------------------------------------------------- | |
| 71 // Global control of data cache | |
| 72 | |
| 73 // Enable the data cache | |
| 74 #define HAL_DCACHE_ENABLE() | |
| 75 | |
| 76 // Disable the data cache | |
| 77 #define HAL_DCACHE_DISABLE() | |
| 78 | |
| 79 // Invalidate the entire cache | |
| 80 #define HAL_DCACHE_INVALIDATE_ALL() | |
| 81 | |
| 82 // Synchronize the contents of the cache with memory. | |
| 83 #define HAL_DCACHE_SYNC() | |
| 84 | |
| 85 // Purge contents of data cache | |
| 86 #define HAL_DCACHE_PURGE_ALL() | |
| 87 | |
|
156
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
88 // Query the state of the data cache (does not affect the caching) |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
89 #define HAL_DCACHE_IS_ENABLED(_state_) \ |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
90 CYG_MACRO_START \ |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
91 (_state_) = 0; \ |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
92 CYG_MACRO_END |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
93 |
| 2 | 94 // Set the data cache refill burst size |
| 95 //#define HAL_DCACHE_BURST_SIZE(_size_) | |
| 96 | |
| 97 // Set the data cache write mode | |
| 98 //#define HAL_DCACHE_WRITE_MODE( _mode_ ) | |
| 99 | |
| 100 //#define HAL_DCACHE_WRITETHRU_MODE 0 | |
| 101 //#define HAL_DCACHE_WRITEBACK_MODE 1 | |
| 102 | |
| 103 // Load the contents of the given address range into the data cache | |
| 104 // and then lock the cache so that it stays there. | |
| 105 //#define HAL_DCACHE_LOCK(_base_, _size_) | |
| 106 | |
| 107 // Undo a previous lock operation | |
| 108 //#define HAL_DCACHE_UNLOCK(_base_, _size_) | |
| 109 | |
| 110 // Unlock entire cache | |
| 111 //#define HAL_DCACHE_UNLOCK_ALL() | |
| 112 | |
| 113 //----------------------------------------------------------------------------- | |
| 114 // Data cache line control | |
| 115 | |
| 116 // Allocate cache lines for the given address range without reading its | |
| 117 // contents from memory. | |
| 118 //#define HAL_DCACHE_ALLOCATE( _base_ , _size_ ) | |
| 119 | |
| 120 // Write dirty cache lines to memory and invalidate the cache entries | |
| 121 // for the given address range. | |
| 122 //#define HAL_DCACHE_FLUSH( _base_ , _size_ ) | |
| 123 | |
| 124 // Invalidate cache lines in the given range without writing to memory. | |
| 125 //#define HAL_DCACHE_INVALIDATE( _base_ , _size_ ) | |
| 126 | |
| 127 // Write dirty cache lines to memory for the given address range. | |
| 128 //#define HAL_DCACHE_STORE( _base_ , _size_ ) | |
| 129 | |
| 130 // Preread the given range into the cache with the intention of reading | |
| 131 // from it later. | |
| 132 //#define HAL_DCACHE_READ_HINT( _base_ , _size_ ) | |
| 133 | |
| 134 // Preread the given range into the cache with the intention of writing | |
| 135 // to it later. | |
| 136 //#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ ) | |
| 137 | |
| 138 // Allocate and zero the cache lines associated with the given range. | |
| 139 //#define HAL_DCACHE_ZERO( _base_ , _size_ ) | |
| 140 | |
| 141 //----------------------------------------------------------------------------- | |
| 142 // Global control of Instruction cache | |
| 143 | |
| 144 // Enable the instruction cache | |
| 145 #define HAL_ICACHE_ENABLE() | |
| 146 | |
| 147 // Disable the instruction cache | |
| 148 #define HAL_ICACHE_DISABLE() | |
| 149 | |
| 150 // Invalidate the entire cache | |
| 151 #define HAL_ICACHE_INVALIDATE_ALL() | |
| 152 | |
| 153 // Synchronize the contents of the cache with memory. | |
| 154 #define HAL_ICACHE_SYNC() | |
| 155 | |
|
156
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
156 // Query the state of the instruction cache (does not affect the caching) |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
157 #define HAL_ICACHE_IS_ENABLED(_state_) \ |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
158 CYG_MACRO_START \ |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
159 (_state_) = 0; \ |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
160 CYG_MACRO_END |
|
b939e9cada46
Merge from eCos master repository on 2001-03-29-21:44:39-BST
jlarmour
parents:
66
diff
changeset
|
161 |
| 2 | 162 // Set the instruction cache refill burst size |
| 163 //#define HAL_ICACHE_BURST_SIZE(_size_) | |
| 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 // Instruction cache line control | |
| 177 | |
| 178 // Invalidate cache lines in the given range without writing to memory. | |
| 179 //#define HAL_ICACHE_INVALIDATE( _base_ , _size_ ) | |
| 180 | |
| 181 //----------------------------------------------------------------------------- | |
| 182 #endif // ifndef CYGONCE_HAL_CACHE_H | |
| 183 // End of hal_cache.h |
