mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
some swapping functions for big and little endian for eiger
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@602 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -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) {
|
int sendDataOnly(int file_des, void* buf,int length) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,18 +14,39 @@
|
|||||||
|
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char lastClientIP[INET_ADDRSTRLEN];
|
char lastClientIP[INET_ADDRSTRLEN];
|
||||||
char thisClientIP[INET_ADDRSTRLEN];
|
char thisClientIP[INET_ADDRSTRLEN];
|
||||||
int lockStatus;
|
int lockStatus;
|
||||||
int differentClients;
|
int differentClients;
|
||||||
|
typedef enum{
|
||||||
|
INT16,
|
||||||
|
INT32,
|
||||||
|
INT64,
|
||||||
|
OTHER
|
||||||
|
}intType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int bindSocket(unsigned short int port_number);
|
int bindSocket(unsigned short int port_number);
|
||||||
int acceptConnection(int socketDescriptor);
|
int acceptConnection(int socketDescriptor);
|
||||||
void closeConnection(int file_Des);
|
void closeConnection(int file_Des);
|
||||||
void exitServer(int socketDescriptor);
|
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 sendDataOnly(int file_des, void* buf,int length);
|
||||||
int receiveDataOnly(int file_des, void* buf,int length);
|
int receiveDataOnly(int file_des, void* buf,int length);
|
||||||
|
|
||||||
|
|
||||||
int getServerError(int socketDescriptor);
|
int getServerError(int socketDescriptor);
|
||||||
int sendChannel(int file_des, sls_detector_channel *myChan);
|
int sendChannel(int file_des, sls_detector_channel *myChan);
|
||||||
int sendChip(int file_des, sls_detector_chip *myChip);
|
int sendChip(int file_des, sls_detector_chip *myChip);
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/mythenDetectorServer"
|
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/mythenDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||||
//#define SVNREV 0x590
|
//#define SVNREV 0x594
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "l_maliakal_d"
|
#define SVNAUTH "l_maliakal_d"
|
||||||
#define SVNREV 0x590
|
#define SVNREV 0x594
|
||||||
#define SVNDATE 0x20130603
|
#define SVNDATE 0x20130612
|
||||||
//
|
//
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define SVNURLLIB "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware"
|
#define SVNURLLIB "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUIDLIB "951219d9-93cf-4727-9268-0efd64621fa3"
|
#define SVNREPUUIDLIB "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||||
//#define SVNREV 0x592
|
//#define SVNREV 0x594
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "l_maliakal_d"
|
#define SVNAUTHLIB "l_maliakal_d"
|
||||||
#define SVNREVLIB 0x592
|
#define SVNREVLIB 0x594
|
||||||
#define SVNDATELIB 0x20130611
|
#define SVNDATELIB 0x20130612
|
||||||
//
|
//
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -122,6 +123,9 @@ enum masterFlags setMaster(enum masterFlags arg);
|
|||||||
enum synchronizationMode setSynchronization(enum synchronizationMode arg);
|
enum synchronizationMode setSynchronization(enum synchronizationMode arg);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/slsReceiver"
|
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/slsReceiver"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||||
//#define SVNREV 0x590
|
//#define SVNREV 0x594
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "l_maliakal_d"
|
#define SVNAUTH "l_maliakal_d"
|
||||||
#define SVNREV 0x590
|
#define SVNREV 0x594
|
||||||
#define SVNDATE 0x20130603
|
#define SVNDATE 0x20130612
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user