Changeset 430 for soft/giet_vm/giet_common/utils.h
- Timestamp:
- Oct 4, 2014, 3:21:56 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_common/utils.h
r408 r430 8 8 // They define more or less the GIET-VM Hardware Abstraction Layer, 9 9 // and contains various utility functions, that can be used by both the 10 // boot code and the kernel code .10 // boot code and the kernel code (but not by the user applications). 11 11 /////////////////////////////////////////////////////////////////////////////////// 12 12 … … 150 150 /////////////////////////////////////////////////////////////////////////////////// 151 151 /////////////////////////////////////////////////////////////////////////////////// 152 // Physical addressing related functions 153 /////////////////////////////////////////////////////////////////////////////////// 154 /////////////////////////////////////////////////////////////////////////////////// 155 152 // Physical addressing functions 153 /////////////////////////////////////////////////////////////////////////////////// 154 /////////////////////////////////////////////////////////////////////////////////// 155 156 //////////////////////////////////////////////////////////////////////////// 157 // This function makes a physical read access to a 32 bits word in memory, 158 // after a temporary DTLB de-activation and paddr extension. 159 //////////////////////////////////////////////////////////////////////////// 156 160 extern unsigned int _physical_read( unsigned long long paddr ); 161 162 //////////////////////////////////////////////////////////////////////////// 163 // This function makes a physical write access to a 32 bits word in memory, 164 // after a temporary DTLB de-activation and paddr extension. 165 //////////////////////////////////////////////////////////////////////////// 157 166 extern void _physical_write( unsigned long long paddr, 158 167 unsigned int value ); 159 168 169 //////////////////////////////////////////////////////////////////////////// 170 // This function makes a physical read access to a 64 bits word in memory, 171 // after a temporary DTLB de-activation and paddr extension. 172 //////////////////////////////////////////////////////////////////////////// 160 173 extern unsigned long long _physical_read_ull( unsigned long long paddr ); 174 175 //////////////////////////////////////////////////////////////////////////// 176 // This function makes a physical write access to a 64 bits word in memory, 177 // after a temporary DTLB de-activation and paddr extension. 178 //////////////////////////////////////////////////////////////////////////// 161 179 extern void _physical_write_ull( unsigned long long paddr, 162 180 unsigned long long value ); 163 181 182 /////////////////////////////////////////////////////////////////////////////////// 183 // This function makes a memcpy from a source buffer to a destination buffer, 184 // using physical addresses, after a temporary DTLB de-activation. 185 // The source and destination buffers must be word aligned, and size must be 186 // multiple of 4 bytes. 187 /////////////////////////////////////////////////////////////////////////////////// 164 188 extern void _physical_memcpy( unsigned long long dst_paddr, 165 189 unsigned long long src_paddr, 166 190 unsigned int size ); 167 191 192 /////////////////////////////////////////////////////////////////////////////////// 193 // This function set a data value in all words of a destination buffer, 194 // using physical addresses, after a temporary DTLB de-activation. 195 // The destination buffer must be word aligned, and size multiple of 4 bytes. 196 /////////////////////////////////////////////////////////////////////////////////// 197 extern void _physical_memset( unsigned long long buf_paddr, 198 unsigned int size, 199 unsigned int data ); 200 201 /////////////////////////////////////////////////////////////////////////////////// 202 // This function is used by several drivers (_xxx_get_register() function). 203 // If the MMU is not activated, the virtual address is extended using 204 // X_IO and Y_IO to reach the cluster_io. 205 /////////////////////////////////////////////////////////////////////////////////// 168 206 extern unsigned int _io_extended_read( unsigned int* vaddr ); 207 208 /////////////////////////////////////////////////////////////////////////////////// 209 // This function is used by all drivers (_xxx_set_register() function) 210 // If the MMU is not activated, the virtual address is extended using 211 // X_IO and Y_IO to reach the cluster_io. 212 /////////////////////////////////////////////////////////////////////////////////// 169 213 extern void _io_extended_write( unsigned int* vaddr, 170 214 unsigned int value ); … … 174 218 /////////////////////////////////////////////////////////////////////////////////// 175 219 220 221 /////////////////////////////////////////////////////////////////////////////////// 222 // Takes a lock with a blocking ll/sc atomic access. 223 // - When the cache coherence is granted by the hardware, 224 // the first read is a standard (cacheable) lw, as the local copy 225 // can be polled when the lock is already taken by another task, reducing 226 // trafic on the interconnect. When the lock is released by the owner task, 227 // the local copy is updated or invalidated by the coherence protocol. 228 // - If there is no hardware cache coherence a random delay is introduced 229 // between two successive retry. 230 /////////////////////////////////////////////////////////////////////////////////// 176 231 extern void _get_lock(giet_lock_t* lock); 232 233 /////////////////////////////////////////////////////////////////////////////////// 234 // Release a previouly taken lock. 235 /////////////////////////////////////////////////////////////////////////////////// 177 236 extern void _release_lock(giet_lock_t* lock); 237 178 238 179 239 /////////////////////////////////////////////////////////////////////////////////// … … 190 250 extern void _getc( char* byte ); 191 251 252 192 253 /////////////////////////////////////////////////////////////////////////////////// 193 254 // Scheduler and task context access functions 194 255 /////////////////////////////////////////////////////////////////////////////////// 195 256 257 258 /////////////////////////////////////////////////////////////////////////////////// 259 // Returns index of the currently running task from the processor scheduler. 260 /////////////////////////////////////////////////////////////////////////////////// 196 261 extern unsigned int _get_current_task_id(void); 197 262 198 extern unsigned int _get_task_slot( unsigned int gpid, 263 //////////////////////////////////////////////////////////////////////////////////// 264 // This function returns the content of a context slot 265 // for a task identified by the ltid argument (local task index), 266 // and a processor identified by the (x,y,p) arguments. 267 //////////////////////////////////////////////////////////////////////////////////// 268 extern unsigned int _get_task_slot( unsigned int x, 269 unsigned int y, 270 unsigned int p, 199 271 unsigned int ltid, 200 272 unsigned int slot ); 201 extern void _set_task_slot( unsigned int gpid, 273 274 //////////////////////////////////////////////////////////////////////////////////// 275 // This function updates the content of a context slot 276 // for any task identified by the ltid argument (local task index), 277 // and a processor identified by the (x,y,p) arguments. 278 //////////////////////////////////////////////////////////////////////////////////// 279 extern void _set_task_slot( unsigned int x, 280 unsigned int y, 281 unsigned int p, 202 282 unsigned int ltid, 203 283 unsigned int slot, 204 284 unsigned int value ); 205 285 286 //////////////////////////////////////////////////////////////////////////////////// 287 // This function returns the content of a context slot for the running task. 288 //////////////////////////////////////////////////////////////////////////////////// 206 289 extern unsigned int _get_context_slot( unsigned int slot ); 290 291 //////////////////////////////////////////////////////////////////////////////////// 292 // This function updates the content of a context slot for the running task. 293 //////////////////////////////////////////////////////////////////////////////////// 207 294 extern void _set_context_slot( unsigned int slot, 208 295 unsigned int value );
Note: See TracChangeset
for help on using the changeset viewer.