Mercurial > pygar
view modules/bluespec/Pygar/lab4/ProcessorSystem.cpp @ 11:50af57801d6e pygar svn.12
[svn r12] working on getting audio pipe processor working
author | punk |
---|---|
date | Sun, 25 Apr 2010 08:31:47 -0400 |
parents | 74716e9a81cc |
children |
line wrap: on
line source
1 #include <stdio.h>2 #include <pthread.h>3 #include <semaphore.h>5 #include "asim/provides/connected_application.h"6 #include "asim/provides/stats_device.h"9 using namespace std;11 // constructor12 CONNECTED_APPLICATION_CLASS::CONNECTED_APPLICATION_CLASS(VIRTUAL_PLATFORM vp) :13 clientStub(new PROCESSORSYSTEMRRR_CLIENT_STUB_CLASS(this))14 {16 }18 // destructor19 CONNECTED_APPLICATION_CLASS::~CONNECTED_APPLICATION_CLASS()20 {21 }23 // init24 void25 CONNECTED_APPLICATION_CLASS::Init()26 {28 // enable stats29 STATS_DEVICE_SERVER_CLASS::GetInstance()->SetupStats();31 }34 // main35 void36 CONNECTED_APPLICATION_CLASS::Main()37 {38 int sleepCount = 0;39 int result = 0;41 fflush(stdout);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 }58 if(result == 1) {59 printf("\n***PASSED***\n");60 }62 // Dump the stats file64 STATS_DEVICE_SERVER_CLASS::GetInstance()->DumpStats();65 STATS_DEVICE_SERVER_CLASS::GetInstance()->EmitFile();67 fflush(stdout);68 exit(0);69 }