#ifndef SRL_HW_HELPERS_H #define SRL_HW_HELPERS_H /** * @file * @module{SRL} * @short Miscellaneous APIs */ #include "stdio.h" typedef struct __ldscript_symbol_s __ldscript_symbol_t; #define BASE_ADDR_OF(id) \ ({ \ extern __ldscript_symbol_t _dsx_##id##_region_begin; \ (void*)&_dsx_##id##_region_begin; \ }) /** Standard API call, expands to nothing for this implementation. */ #define srl_busy_cycles(n) do{}while(0) //void useless(void *pointless,...){} /** @this flushes the cache line containing the address. */ //TODO #define srl_dcache_flush_addr 0 /* static inline cpu_dcache_invld(void *ptr){ asm volatile ( " cache %0, %1" : : "i" (0x11) , "R" (*(uint8_t*)(ptr)) : "memory" ); } */ /** @this flushes a memory zone from cache. */ //TODO //void dcache_flush(const void * addr, size_t size) #define srl_dcache_flush_zone dcache_flush /** @this waits for at least the given time (in cycles). The actual time spent in this call is not predictable. @param time Number of cycles to wait for */ void srl_sleep_cycles( unsigned int time ); /** @this returns the absolute timestamp counter from the initialization of the platform. @return Cycles from the initialization of the system */ //static: to avoid multiple definition error static inline unsigned int srl_cycle_count() { return giet_proctime(); } /** @this aborts the current execution. On most systems, @this will simply hang. */ static inline void srl_abort() { asm volatile ("break 0"); while(1); } /** * */ static inline void srl_exit() { giet_exit(); } #endif