rlm@8: #include rlm@8: #include rlm@8: #include rlm@8: rlm@8: #include "asim/provides/connected_application.h" rlm@8: #include "asim/provides/stats_device.h" rlm@8: rlm@8: rlm@8: using namespace std; rlm@8: rlm@8: // constructor rlm@8: CONNECTED_APPLICATION_CLASS::CONNECTED_APPLICATION_CLASS(VIRTUAL_PLATFORM vp) : rlm@8: clientStub(new PROCESSORSYSTEMRRR_CLIENT_STUB_CLASS(this)) rlm@8: { rlm@8: rlm@8: } rlm@8: rlm@8: // destructor rlm@8: CONNECTED_APPLICATION_CLASS::~CONNECTED_APPLICATION_CLASS() rlm@8: { rlm@8: } rlm@8: rlm@8: // init rlm@8: void rlm@8: CONNECTED_APPLICATION_CLASS::Init() rlm@8: { rlm@8: rlm@8: // enable stats rlm@8: STATS_DEVICE_SERVER_CLASS::GetInstance()->SetupStats(); rlm@8: rlm@8: } rlm@8: rlm@8: rlm@8: // main rlm@8: void rlm@8: CONNECTED_APPLICATION_CLASS::Main() rlm@8: { rlm@8: int sleepCount = 0; rlm@8: int result = 0; rlm@8: rlm@8: fflush(stdout); rlm@8: rlm@8: while ((result = clientStub->ReadCPUToHost(0)) != 1) { rlm@8: sleep(1); rlm@8: //printf("System controller sleeps with result: %d\n", result); rlm@8: sleepCount++; rlm@8: if(sleepCount == 100) { rlm@8: printf("Failed to get response from hardware, bailing\n\n"); rlm@8: printf("This means that either your hardware is hanging\n"); rlm@8: printf("or that the software hasn't given it enough time\n"); rlm@8: printf("to complete. If you think it needs more time, then\n"); rlm@8: printf("edit CONNECTED_APPLICATION_CLASS::Main() in ProcessorSystem.cpp\n"); rlm@8: printf("(connected_application)\n"); rlm@8: exit(0); rlm@8: } rlm@8: } rlm@8: rlm@8: if(result == 1) { rlm@8: printf("\n***PASSED***\n"); rlm@8: } rlm@8: rlm@8: // Dump the stats file rlm@8: rlm@8: STATS_DEVICE_SERVER_CLASS::GetInstance()->DumpStats(); rlm@8: STATS_DEVICE_SERVER_CLASS::GetInstance()->EmitFile(); rlm@8: rlm@8: fflush(stdout); rlm@8: exit(0); rlm@8: }