comparison modules/bluespec/Pygar/lab4/ProcessorSystem.cpp @ 8:74716e9a81cc pygar svn.9

[svn r9] Pygar now has the proper directory structure to play nicely with awb. Also, the apm file for audio-core willcompile successfully.
author rlm
date Fri, 23 Apr 2010 02:32:05 -0400
parents
children
comparison
equal deleted inserted replaced
7:7393cd19371e 8:74716e9a81cc
1 #include <stdio.h>
2 #include <pthread.h>
3 #include <semaphore.h>
4
5 #include "asim/provides/connected_application.h"
6 #include "asim/provides/stats_device.h"
7
8
9 using namespace std;
10
11 // constructor
12 CONNECTED_APPLICATION_CLASS::CONNECTED_APPLICATION_CLASS(VIRTUAL_PLATFORM vp) :
13 clientStub(new PROCESSORSYSTEMRRR_CLIENT_STUB_CLASS(this))
14 {
15
16 }
17
18 // destructor
19 CONNECTED_APPLICATION_CLASS::~CONNECTED_APPLICATION_CLASS()
20 {
21 }
22
23 // init
24 void
25 CONNECTED_APPLICATION_CLASS::Init()
26 {
27
28 // enable stats
29 STATS_DEVICE_SERVER_CLASS::GetInstance()->SetupStats();
30
31 }
32
33
34 // main
35 void
36 CONNECTED_APPLICATION_CLASS::Main()
37 {
38 int sleepCount = 0;
39 int result = 0;
40
41 fflush(stdout);
42
43 while ((result = clientStub->ReadCPUToHost(0)) != 1) {
44 sleep(1);
45 //printf("System controller sleeps with result: %d\n", result);
46 sleepCount++;
47 if(sleepCount == 100) {
48 printf("Failed to get response from hardware, bailing\n\n");
49 printf("This means that either your hardware is hanging\n");
50 printf("or that the software hasn't given it enough time\n");
51 printf("to complete. If you think it needs more time, then\n");
52 printf("edit CONNECTED_APPLICATION_CLASS::Main() in ProcessorSystem.cpp\n");
53 printf("(connected_application)\n");
54 exit(0);
55 }
56 }
57
58 if(result == 1) {
59 printf("\n***PASSED***\n");
60 }
61
62 // Dump the stats file
63
64 STATS_DEVICE_SERVER_CLASS::GetInstance()->DumpStats();
65 STATS_DEVICE_SERVER_CLASS::GetInstance()->EmitFile();
66
67 fflush(stdout);
68 exit(0);
69 }