00001 #include "../VmeInterface/DummyVmeInterface.h"
00002 #ifndef USE_DUMMY_VME
00003 #include "../VmeInterface/RCCVmeInterface.h"
00004 #endif
00005
00006 #include "rcc_error/rcc_error.h"
00007
00008 #include "VmeDecode.h"
00009
00010 using namespace SctPixelRod;
00011 using namespace std;
00012
00013 namespace SctApi {
00014 namespace Utility {
00015 void decodeVme(VmeException &e) {
00016 #ifdef USE_DUMMY_VME
00017 cout << "Unexpected VmeException in Dummy code!\n";
00018 #else
00019 cout << "VmeException Code: " << e.getErrorCode() << " Class: ";
00020
00021 switch(e.getErrorClass()) {
00022 case VmeException::OK: cout << "OK\n"; break;
00023 case VmeException::INIT_ERROR: cout << "Init error\n"; break;
00024 case VmeException::BUS_ERROR: cout << "Bus error\n"; break;
00025 case VmeException::MAP_ERROR: cout << "Map error\n"; break;
00026 case VmeException::DMA_ERROR: cout << "Dma error\n"; break;
00027 default: cout << "Unknown error class\n"; break;
00028 }
00029
00030 VmePort *p = e.getPort();
00031
00032 if(p) {
00033 cout << "Port: code: " << p->getLastErrcode() << " "
00034 << p->getErrorMessage(p->getLastErrcode()) << endl;
00035 } else {
00036 int code = e.getErrorCode();
00037 if(code >= BT_WRITE_ERROR) {
00038 char err[256];
00039 rcc_error_string(err, code-BT_WRITE_ERROR);
00040
00041 cout << " BT_WRITE_ERROR: " << err;
00042 } else if(code >= BT_READ_ERROR) {
00043 char err[256];
00044 rcc_error_string(err, code-BT_READ_ERROR);
00045
00046 cout << " BT_READ_ERROR: " << err;
00047 }
00048 }
00049 #endif
00050 }
00051 }
00052 }