source: trunk/platforms/caba-ring-ccxcachev4_memcachev4-mips32el/soft/common/common.c @ 137

Last change on this file since 137 was 134, checked in by kane, 14 years ago

add multi write buffer in cc_xcache_v4

File size: 759 bytes
Line 
1#include "common.h"
2#include "stdio.h"
3#include "system.h"
4#include "stdio.h"
5
6#ifdef SIMHELPER_BASE
7#include "soclib/simhelper.h"
8#endif
9
10static uint32_t lock;
11static uint32_t nb_thread;
12
13void system_start (void)
14{
15  lock_lock(&lock);
16  nb_thread ++;
17  lock_unlock(&lock);
18
19  printf("CPU %d\n",procnum());
20}
21
22void system_stop (char* file, int line, int x)
23{
24  printf("Exit(%d) in file \"%s\", line %d\n",x,file,line);
25
26  lock_lock(&lock);
27  uint32_t num_thread = --nb_thread;
28  lock_unlock(&lock);
29
30  // Last thread ?
31  if (num_thread == 0)
32    {
33#ifdef SIMHELPER_BASE
34      soclib_io_set
35        (base(SIMHELPER),
36         SIMHELPER_SC_STOP,
37         0);
38#else
39# warning "No simhelper, exit will do a trap and an infinite loop"
40#endif
41    }
42
43  while(1);
44}
45
Note: See TracBrowser for help on using the repository browser.