diff --git a/slsDetectorSoftware/commonFiles/communication_funcs.c b/slsDetectorSoftware/commonFiles/communication_funcs.c index f1031d734..d97468a75 100755 --- a/slsDetectorSoftware/commonFiles/communication_funcs.c +++ b/slsDetectorSoftware/commonFiles/communication_funcs.c @@ -263,6 +263,55 @@ void exitServer(int socketDescriptor) { +void swapData(void* val,int length,intType itype){ + switch(itype){ + case INT16: swap16(val,length); break; + case INT32: swap32(val,length); break; + case INT64: swap64(val,length); break; + default: break; + } +} + +void swap16(int16_t* val,int length){ +printf("not implemented\n"); +} + +void swap32(int32_t* val,int length){ + int i; + for(i=0; length > 0; i++){ + val[i] = ((val[i] << 8) & 0xFF00FF00) | ((val[i] >> 8) & 0xFF00FF ); + val[i] = (val[i] << 16) | ((val[i] >> 16) & 0xFFFF); + length -= sizeof(int32_t); + } +} + +void swap64(int64_t* val,int length){ + int i; + for(i=0; length > 0; i++){ + val[i] = ((val[i] << 8) & 0xFF00FF00FF00FF00ULL ) | ((val[i] >> 8) & 0x00FF00FF00FF00FFULL ); + val[i] = ((val[i] << 16) & 0xFFFF0000FFFF0000ULL ) | ((val[i] >> 16) & 0x0000FFFF0000FFFFULL ); + val[i] = (val[i] << 32) | ((val[i] >> 32) & 0xFFFFFFFFULL); + length -= sizeof(int64_t); + } +} + +int sendData(int file_des, void* buf,int length, intType itype){ + int ret = sendDataOnly(file_des, buf, length); +#ifdef EIGERD + swapData(buf, length, itype); +#endif + return ret; +} + +int receiveData(int file_des, void* buf,int length, intType itype){ + int ret = receiveDataOnly(file_des, buf, length); +#ifdef EIGERD + swapData(buf, length, itype); +#endif + return ret; +} + + int sendDataOnly(int file_des, void* buf,int length) { diff --git a/slsDetectorSoftware/commonFiles/communication_funcs.h b/slsDetectorSoftware/commonFiles/communication_funcs.h index 3999b6213..35946e983 100755 --- a/slsDetectorSoftware/commonFiles/communication_funcs.h +++ b/slsDetectorSoftware/commonFiles/communication_funcs.h @@ -14,18 +14,39 @@ #include "sls_detector_defs.h" + + + char lastClientIP[INET_ADDRSTRLEN]; char thisClientIP[INET_ADDRSTRLEN]; int lockStatus; int differentClients; +typedef enum{ + INT16, + INT32, + INT64, + OTHER +}intType; + + + int bindSocket(unsigned short int port_number); int acceptConnection(int socketDescriptor); void closeConnection(int file_Des); void exitServer(int socketDescriptor); + +void swapData(void* val,int length,intType itype); +void swap16(int16_t* val,int length); +void swap32(int32_t* val,int length); +void swap64(int64_t* val,int length); + +int sendData(int file_des, void* buf,int length, intType itype); +int receiveData(int file_des, void* buf,int length, intType itype); int sendDataOnly(int file_des, void* buf,int length); int receiveDataOnly(int file_des, void* buf,int length); + int getServerError(int socketDescriptor); int sendChannel(int file_des, sls_detector_channel *myChan); int sendChip(int file_des, sls_detector_chip *myChip); diff --git a/slsDetectorSoftware/mythenDetectorServer/svnInfoMythen.h b/slsDetectorSoftware/mythenDetectorServer/svnInfoMythen.h index 4b88df4ae..104d7ab12 100644 --- a/slsDetectorSoftware/mythenDetectorServer/svnInfoMythen.h +++ b/slsDetectorSoftware/mythenDetectorServer/svnInfoMythen.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/mythenDetectorServer" //#define SVNREPPATH "" #define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3" -//#define SVNREV 0x590 +//#define SVNREV 0x594 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x590 -#define SVNDATE 0x20130603 +#define SVNREV 0x594 +#define SVNDATE 0x20130612 // diff --git a/slsDetectorSoftware/slsDetector/svnInfoLib.h b/slsDetectorSoftware/slsDetector/svnInfoLib.h index 70fc73198..7fe63dab0 100644 --- a/slsDetectorSoftware/slsDetector/svnInfoLib.h +++ b/slsDetectorSoftware/slsDetector/svnInfoLib.h @@ -2,10 +2,10 @@ #define SVNURLLIB "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware" //#define SVNREPPATH "" #define SVNREPUUIDLIB "951219d9-93cf-4727-9268-0efd64621fa3" -//#define SVNREV 0x592 +//#define SVNREV 0x594 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTHLIB "l_maliakal_d" -#define SVNREVLIB 0x592 -#define SVNDATELIB 0x20130611 +#define SVNREVLIB 0x594 +#define SVNDATELIB 0x20130612 // diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h index 98844779d..f8a2bf561 100644 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h @@ -8,6 +8,7 @@ #include + /* #include #include @@ -122,6 +123,9 @@ enum masterFlags setMaster(enum masterFlags arg); enum synchronizationMode setSynchronization(enum synchronizationMode arg); -#endif + +#endif + + #endif diff --git a/slsDetectorSoftware/slsReceiver/svnInfoReceiver.h b/slsDetectorSoftware/slsReceiver/svnInfoReceiver.h index 1fc80bd44..77eac56ab 100644 --- a/slsDetectorSoftware/slsReceiver/svnInfoReceiver.h +++ b/slsDetectorSoftware/slsReceiver/svnInfoReceiver.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/slsReceiver" //#define SVNREPPATH "" #define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3" -//#define SVNREV 0x590 +//#define SVNREV 0x594 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x590 -#define SVNDATE 0x20130603 +#define SVNREV 0x594 +#define SVNDATE 0x20130612 //