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

Last change on this file since 177 was 175, checked in by karaoui, 12 years ago

+ Adding the init attribute to the mwmr to specify the width of the mwmr channel
+ Fixing bugs in kernels_init

File size: 1.7 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
12typedef struct __ldscript_symbol_s __ldscript_symbol_t;
13
14#define BASE_ADDR_OF(id)                                                                           \
15        ({                                                                                                                                 \
16                extern __ldscript_symbol_t _dsx_##id##_region_begin;               \
17                (void*)&_dsx_##id##_region_begin;                                                                  \
18        })
19
20
21/**
22   Standard API call, expands to nothing for this implementation.
23 */
24#define srl_busy_cycles(n) do{}while(0)
25
26//void useless(void *pointless,...){}
27/**
28   @this flushes the cache line containing the address.
29 */
30//TODO
31#define srl_dcache_flush_addr 0
32
33/*
34static inline cpu_dcache_invld(void *ptr){
35         asm volatile (                                                         
36        " cache %0, %1"                                                 
37        : : "i" (0x11) , "R" (*(uint8_t*)(ptr))
38        : "memory"                                                             
39        );                                                     
40}
41*/
42
43/**
44   @this flushes a memory zone from cache.
45 */
46//TODO
47//void dcache_flush(const void * addr, size_t size)
48#define srl_dcache_flush_zone dcache_flush
49
50/**
51   @this waits for at least the given time (in cycles). The actual
52   time spent in this call is not predictable.
53
54   @param time Number of cycles to wait for
55 */
56void srl_sleep_cycles( unsigned int time );
57
58/**
59   @this returns the absolute timestamp counter from the
60   initialization of the platform.
61
62   @return Cycles from the initialization of the system
63 */
64
65//static: to avoid multiple definition error
66static inline unsigned int srl_cycle_count()
67{
68        return giet_proctime();
69}
70
71/**
72   @this aborts the current execution. On most systems, @this will
73   simply hang.
74 */
75static inline void srl_abort()
76{
77        asm volatile ("break 0");
78        while(1);
79}
80
81/**
82 *
83 */
84static inline void srl_exit()
85{
86    giet_exit();
87}
88
89#endif
Note: See TracBrowser for help on using the repository browser.