##// END OF EJS Templates
TC_LFR_LOAD_KCOEFFICIENTS...
TC_LFR_LOAD_KCOEFFICIENTS TC_LFR_DUMP_KCOEFFICIENTS TM_LFR_KCOEFFICIENTS_DUMP

File last commit:

r187:87f7d2226935 VHDL_0_1_28
r194:72cdb2a15242 R3
Show More
GscMemoryLPP.hpp
62 lines | 1.5 KiB | text/x-c++hdr | CppLexer
paul
sync
r181 #ifndef GSCMEMORY_HPP_
#define GSCMEMORY_HPP_
#ifndef LEON3
#define LEON3
#endif
paul
2.0.2.2...
r187 static unsigned int getCacheControlRegister(){
paul
sync
r181 #ifdef LEON3
unsigned int cacheControlRegister = 0;
__asm__ __volatile__("lda [%%g0] 2, %0" : "=r"(cacheControlRegister) : );
return cacheControlRegister;
#endif
}
paul
2.0.2.2...
r187 static void setCacheControlRegister(unsigned int cacheControlRegister)
{
paul
sync
r181 #ifdef LEON3
__asm__ __volatile__("sta %0, [%%g0] 2" : : "r"(cacheControlRegister));
#endif
}
/**
paul
2.0.2.2...
r187 * Flush the data cache and the instruction cache.
*
* @return
*/
paul
sync
r181 static inline void flushCache() {
asm("flush");
}
static void enableInstructionCache() {
#ifdef LEON3
unsigned int cacheControlRegister;
cacheControlRegister = getCacheControlRegister();
cacheControlRegister = (cacheControlRegister | 0x3);
setCacheControlRegister(cacheControlRegister);
#endif
}
static void enableDataCache() {
#ifdef LEON3
unsigned int cacheControlRegister;
cacheControlRegister = getCacheControlRegister();
cacheControlRegister = (cacheControlRegister | 0xc);
setCacheControlRegister(cacheControlRegister);
#endif
}
static void enableInstructionBurstFetch() {
#ifdef LEON3
unsigned int cacheControlRegister;
cacheControlRegister = getCacheControlRegister();
// set the bit IB to 1
cacheControlRegister = (cacheControlRegister | 0x10000);
setCacheControlRegister(cacheControlRegister);
#endif
}
#endif /* GSCMEMORY_HPP_ */