source: trunk/Softwares/Common/src/c/service_clock.c

Last change on this file was 101, checked in by rosiere, 16 years ago

1) Add soc test
2) fix bug (Pc management, Decod and execute, Update prediction ...)

  • Property svn:keywords set to Id
File size: 795 bytes
RevLine 
[101]1/* #include <time.h> */
2/* #include <errno.h> */
3/* #include <sys/lock.h> */
4/* #include "mapping_memory.h" */
5/* #include "sim2os.h" */
6/* #include "service_clock.h" */
[2]7
[101]8/* unsigned int service_clock () */
9/* { */
10/*   unsigned int * addr   = (unsigned int *)(SIM2OS_BASE); */
11/*   unsigned int   result = -1; */
[2]12
[101]13/*   __lock_init    (service_lock); */
[2]14 
[101]15/*   __lock_acquire (service_lock); */
[2]16
[101]17/*   *(addr+0) = (unsigned int)SERVICE_CLOCK; */
[2]18 
[101]19/*   // memory synchronisation */
20/*   // (else read (with an address that depend not of store address) can be lunch before a store) */
21/*   asm("l.msync;"); */
[2]22
[101]23/*   result    = (clock_t) *(addr+1); */
[2]24 
[101]25/*   if (result == (clock_t)-1) */
26/*     errno = (int) *(addr+2); */
[2]27
[101]28/*   __lock_release (service_lock); */
[2]29
[101]30/*   return result; */
31/* } */
Note: See TracBrowser for help on using the repository browser.