source: soft/giet_vm/libs/libsrl/srl_hw_helpers.h @ 203

Last change on this file since 203 was 178, checked in by karaoui, 12 years ago

updating libs.

File size: 1.4 KB
Line 
1#ifndef SRL_HW_HELPERS_H
2#define SRL_HW_HELPERS_H
3
4/**
5 * @file
6 * @module{SRL}
7 * @short Miscellaneous APIs
8 */
9
10#include "stdio.h"
11
12
13/**
14   Standard API call, expands to nothing for this implementation.
15 */
16#define srl_busy_cycles(n) do{}while(0)
17
18//void useless(void *pointless,...){}
19/**
20   @this flushes the cache line containing the address.
21 */
22//TODO
23#define srl_dcache_flush_addr 0
24
25/*
26static inline cpu_dcache_invld(void *ptr){
27         asm volatile (                                                         
28        " cache %0, %1"                                                 
29        : : "i" (0x11) , "R" (*(uint8_t*)(ptr))
30        : "memory"                                                             
31        );                                                     
32}
33*/
34
35/**
36   @this flushes a memory zone from cache.
37 */
38//TODO
39//void dcache_flush(const void * addr, size_t size)
40#define srl_dcache_flush_zone dcache_flush
41
42/**
43   @this waits for at least the given time (in cycles). The actual
44   time spent in this call is not predictable.
45
46   @param time Number of cycles to wait for
47 */
48void srl_sleep_cycles( unsigned int time );
49
50/**
51   @this returns the absolute timestamp counter from the
52   initialization of the platform.
53
54   @return Cycles from the initialization of the system
55 */
56static inline unsigned int srl_cycle_count()
57{
58        return giet_proctime();
59}
60
61/**
62   @this aborts the current execution. On most systems, @this will
63   simply hang.
64 */
65static inline void srl_abort()
66{
67        asm volatile ("break 0");
68        while(1);
69}
70
71/**
72 *
73 */
74static inline void srl_exit()
75{
76    giet_exit();
77}
78
79#endif
Note: See TracBrowser for help on using the repository browser.