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

Last change on this file since 228 was 228, checked in by meunier, 11 years ago

Added support for memspaces and const.
Added an interrupt masking to the "giet_context_switch" syscall
Corrected two bugs in boot/boot_init.c (one minor and one regarding barriers initialization)
Reformatted the code in all files.

File size: 1.7 KB
RevLine 
[160]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/**
[228]14  Standard API call, expands to nothing for this implementation.
15  */
[160]16#define srl_busy_cycles(n) do{}while(0)
17
18//void useless(void *pointless,...){}
19/**
[228]20  @this flushes the cache line containing the address.
21  */
[160]22//TODO
23#define srl_dcache_flush_addr 0
24
25/*
[228]26   static 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   */
[160]34
35/**
[228]36  @this flushes a memory zone from cache.
37  */
[160]38//TODO
39//void dcache_flush(const void * addr, size_t size)
40#define srl_dcache_flush_zone dcache_flush
41
42/**
[228]43  @this waits for at least the given time (in cycles). The actual
44  time spent in this call is not predictable.
[160]45
[228]46  @param time Number of cycles to wait for
47  */
48void srl_sleep_cycles(unsigned int time);
[160]49
50/**
[228]51  @this returns the absolute timestamp counter from the
52  initialization of the platform.
[160]53
[228]54  @return Cycles from the initialization of the system
55  */
56static inline unsigned int srl_cycle_count() {
57    return giet_proctime();
[160]58}
59
[228]60
[160]61/**
[228]62  @this aborts the current execution. On most systems, @this will
63  simply hang.
64  */
65static inline void srl_abort() {
66    asm volatile ("break 0");
67    while (1);
[160]68}
69
[228]70
[175]71/**
72 *
73 */
[228]74static inline void srl_exit() {
[175]75    giet_exit();
76}
77
[160]78#endif
[228]79
80// Local Variables:
81// tab-width: 4
82// c-basic-offset: 4
83// c-file-offsets:((innamespace . 0)(inline-open . 0))
84// indent-tabs-mode: nil
85// End:
86// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
87
Note: See TracBrowser for help on using the repository browser.