- Refactored histogram memory code a little
- motor driver for ECB now fully working - Fixed an anticollider bug - Untested version of a driver for the Risoe TDC histogram memory
This commit is contained in:
36
ecb.c
36
ecb.c
@@ -20,8 +20,9 @@
|
||||
#include "ecb.i"
|
||||
/*------------- private defines and error codes ------------------------*/
|
||||
#define ACKN ('\6') /* Acknowledge character */
|
||||
#define READ_BYTES 3
|
||||
#define READ_BYTES 3
|
||||
#define WRITE_BYTES 4
|
||||
#define DMAREAD 5
|
||||
#define ECB_BYTES 65536L
|
||||
|
||||
typedef union /* Used to swap bytes in 'address' and 'byte_count' */
|
||||
@@ -179,6 +180,33 @@ int ecbRead(pECB self, unsigned short address,
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
int ecbDMARead(pECB self, unsigned short address, void *buffer,
|
||||
unsigned short byteCount){
|
||||
int status, count;
|
||||
|
||||
assert(self != NULL);
|
||||
assert(self->gpib != NULL);
|
||||
self->lastError = 0;
|
||||
|
||||
status = ecbPrepareIO(self,DMAREAD,address,(unsigned short)byteCount);
|
||||
if(status <= 0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
usleep(20*1000);
|
||||
|
||||
/*
|
||||
actual read
|
||||
*/
|
||||
status = GPIBread(self->gpib,self->ecbDeviceID, buffer, byteCount);
|
||||
if(status < 0){
|
||||
self->lastError = status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
int ecbWrite(pECB self, unsigned short address,
|
||||
void *buffer, int byteCount){
|
||||
|
||||
@@ -317,9 +345,13 @@ int ECBAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
return 0;
|
||||
}
|
||||
sprintf(pBuffer,"%x %x %x %x",
|
||||
out.d, out.e, out.c, out.c);
|
||||
out.d, out.e, out.b, out.c);
|
||||
SCWrite(pCon,pBuffer,eValue);
|
||||
return 1;
|
||||
} else if(strcmp(argv[1],"clear") == 0){
|
||||
ecbClear(self);
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
} else {
|
||||
SCWrite(pCon,"ERROR: ECB does not understand keyword", eError);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user