mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
forgot to add some server files
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@437 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
55bfeb6044
commit
2b31e23f75
26
slsDetectorSoftware/slsDetectorServer/Makefile
Normal file
26
slsDetectorSoftware/slsDetectorServer/Makefile
Normal file
@ -0,0 +1,26 @@
|
||||
CC =gcc
|
||||
CLAGS += -Wall -DVIRTUAL -DDACS_INT -DSLS_DETECTOR_FUNCTION_LIST -DEIGERD
|
||||
LDLIBS += -lm
|
||||
|
||||
PROGS = slsDetectorServer
|
||||
DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
SRC_CLNT = slsDetectorServer.c slsDetectorServer_funcs.c communication_funcs.c slsDetector_firmware.c slsDetectorFunctionList.c
|
||||
OBJS = $(SRC_CLNT:.cpp=.o)
|
||||
|
||||
|
||||
|
||||
all: clean $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
$(PROGS):
|
||||
echo $(OBJS)
|
||||
mkdir -p $(DESTDIR)
|
||||
$(CC) $(SRC_CLNT) $(CLAGS) $(LDLIBS) -o $@
|
||||
mv $(PROGS) $(DESTDIR)
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf $(DESTDIR)/$(PROGS) *.o
|
53
slsDetectorSoftware/slsDetectorServer/registers.h
Normal file
53
slsDetectorSoftware/slsDetectorServer/registers.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* registers.h
|
||||
*
|
||||
* Created on: Jan 24, 2013
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef REGISTERS_H_
|
||||
#define REGISTERS_H_
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define CSP0 0x90000000
|
||||
#define MEM_SIZE 0xFFFFFFF
|
||||
|
||||
|
||||
#define STATUS_REG 0x0a000
|
||||
|
||||
#define SET_FRAMES_LSB_REG 0x10000
|
||||
#define SET_FRAMES_MSB_REG 0x11000
|
||||
#define GET_FRAMES_LSB_REG 0x12000
|
||||
#define GET_FRAMES_MSB_REG 0x13000
|
||||
|
||||
#define SET_EXPTIME_LSB_REG 0x14000
|
||||
#define SET_EXPTIME_MSB_REG 0x15000
|
||||
#define GET_EXPTIME_LSB_REG 0x16000
|
||||
#define GET_EXPTIME_MSB_REG 0x17000
|
||||
|
||||
#define SET_GATES_LSB_REG 0x18000
|
||||
#define SET_GATES_MSB_REG 0x19000
|
||||
#define GET_GATES_LSB_REG 0x1a000
|
||||
#define GET_GATES_MSB_REG 0x1b000
|
||||
|
||||
#define SET_PERIOD_LSB_REG 0x1c000
|
||||
#define SET_PERIOD_MSB_REG 0x1d000
|
||||
#define GET_PERIOD_LSB_REG 0x1e000
|
||||
#define GET_PERIOD_MSB_REG 0x1f000
|
||||
|
||||
#define SET_DELAY_LSB_REG 0x20000
|
||||
#define SET_DELAY_MSB_REG 0x21000
|
||||
#define GET_DELAY_LSB_REG 0x22000
|
||||
#define GET_DELAY_MSB_REG 0x23000
|
||||
|
||||
#define SET_TRAINS_LSB_REG 0x24000
|
||||
#define SET_TRAINS_MSB_REG 0x25000
|
||||
#define GET_TRAINS_LSB_REG 0x26000
|
||||
#define GET_TRAINS_MSB_REG 0x27000
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* REGISTERS_H_ */
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* slsDetectorServer_defs.h
|
||||
*
|
||||
* Created on: Jan 24, 2013
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef SLSDETECTORSERVER_DEFS_H_
|
||||
#define SLSDETECTORSERVER_DEFS_H_
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define GOODBYE -200
|
||||
|
||||
|
||||
#define NCHAN 1
|
||||
#define NCHIP 1
|
||||
#define NDAC 1
|
||||
#define NADC 1
|
||||
#define NMAXMODX 1
|
||||
#define NMAXMODY 1
|
||||
#define NMAXMOD NMAXMODX*NMAXMODY
|
||||
#define NCHANS NCHAN*NCHIP*NMAXMOD
|
||||
#define NDACS NDAC*NMAXMOD
|
||||
|
||||
#define DYNAMIC_RANGE 16
|
||||
|
||||
#define CLK_FREQ 100E+6
|
||||
|
||||
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
170
slsDetectorSoftware/slsDetectorServer/slsDetector_firmware.c
Normal file
170
slsDetectorSoftware/slsDetectorServer/slsDetector_firmware.c
Normal file
@ -0,0 +1,170 @@
|
||||
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include "slsDetector_firmware.h"
|
||||
#include "slsDetectorServer_defs.h"
|
||||
#include "registers.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
u_int32_t CSP0BASE;
|
||||
|
||||
|
||||
int nModBoard;
|
||||
int nModY = NMAXMOD;
|
||||
int nModX = NMAXMOD;
|
||||
int dynamicRange= DYNAMIC_RANGE;
|
||||
int dataBytes = NMAXMOD*NCHIP*NCHAN*2;
|
||||
int masterMode = NO_MASTER;
|
||||
int syncMode = NO_SYNCHRONIZATION;
|
||||
int timingMode = AUTO_TIMING;
|
||||
|
||||
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
extern const int nChans;
|
||||
extern const int nChips;
|
||||
extern const int nDacs;
|
||||
extern const int nAdcs;
|
||||
#endif
|
||||
#ifndef SLS_DETECTOR_FUNCTION_LIST
|
||||
const int nChans = NCHAN;
|
||||
const int nChips = NCHIP;
|
||||
const int nDacs = NDAC;
|
||||
const int nAdcs = NADC;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
int mapCSP0(void) {
|
||||
printf("Mapping memory\n");
|
||||
#ifdef VIRTUAL
|
||||
CSP0BASE = (u_int32_t)malloc(MEM_SIZE);
|
||||
printf("memory allocated\n");
|
||||
#endif
|
||||
printf("CSPOBASE=from %08x to %x\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
u_int32_t bus_w(u_int32_t offset, u_int32_t data) {
|
||||
volatile u_int32_t *ptr1;
|
||||
ptr1=(u_int32_t*)(CSP0BASE+offset);
|
||||
*ptr1=data;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
u_int32_t bus_r(u_int32_t offset) {
|
||||
volatile u_int32_t *ptr1;
|
||||
ptr1=(u_int32_t*)(CSP0BASE+offset);
|
||||
return *ptr1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t set64BitReg(int64_t value, int aLSB, int aMSB){
|
||||
int64_t v64;
|
||||
u_int32_t vLSB,vMSB;
|
||||
if (value!=-1) {
|
||||
vLSB=value&(0xffffffff);
|
||||
bus_w(aLSB,vLSB);
|
||||
v64=value>> 32;
|
||||
vMSB=v64&(0xffffffff);
|
||||
bus_w(aMSB,vMSB);
|
||||
}
|
||||
return get64BitReg(aLSB, aMSB);
|
||||
|
||||
}
|
||||
|
||||
int64_t get64BitReg(int aLSB, int aMSB){
|
||||
int64_t v64;
|
||||
u_int32_t vLSB,vMSB;
|
||||
vLSB=bus_r(aLSB);
|
||||
vMSB=bus_r(aMSB);
|
||||
v64=vMSB;
|
||||
v64=(v64<<32) | vLSB;
|
||||
return v64;
|
||||
}
|
||||
|
||||
|
||||
int64_t setFrames(int64_t value){
|
||||
return set64BitReg(value, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
int64_t getFrames(){
|
||||
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
|
||||
int64_t setExposureTime(int64_t value){
|
||||
/* time is in ns */
|
||||
if (value!=-1)
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
return set64BitReg(value,SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
}
|
||||
int64_t getExposureTime(){
|
||||
return get64BitReg(GET_EXPTIME_LSB_REG, GET_EXPTIME_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
}
|
||||
|
||||
|
||||
int64_t setGates(int64_t value){
|
||||
return set64BitReg(value, SET_GATES_LSB_REG, SET_GATES_MSB_REG);
|
||||
}
|
||||
int64_t getGates(){
|
||||
return get64BitReg(GET_GATES_LSB_REG, GET_GATES_MSB_REG);
|
||||
}
|
||||
|
||||
|
||||
int64_t setPeriod(int64_t value){
|
||||
/* time is in ns */
|
||||
if (value!=-1)
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
return set64BitReg(value,SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
}
|
||||
int64_t getPeriod(){
|
||||
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
}
|
||||
|
||||
|
||||
int64_t setDelay(int64_t value){
|
||||
/* time is in ns */
|
||||
if (value!=-1) {
|
||||
value*=(1E-9*CLK_FREQ);
|
||||
}
|
||||
return set64BitReg(value,SET_DELAY_LSB_REG, SET_DELAY_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
}
|
||||
int64_t getDelay(){
|
||||
return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG)/(1E-9*CLK_FREQ);
|
||||
}
|
||||
|
||||
|
||||
int64_t setTrains(int64_t value){
|
||||
return set64BitReg(value, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
|
||||
}
|
||||
int64_t getTrains(){
|
||||
return get64BitReg(GET_TRAINS_LSB_REG, GET_TRAINS_MSB_REG);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int64_t setProbes(int64_t value){
|
||||
return 0;
|
||||
}
|
||||
int64_t getProbes(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
171
slsDetectorSoftware/slsDetectorServer/slsDetector_firmware.h
Normal file
171
slsDetectorSoftware/slsDetectorServer/slsDetector_firmware.h
Normal file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
* slsDetector_firmware.h
|
||||
*
|
||||
* Created on: Jan 24, 2013
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef SLSDETECTOR_FIRMWARE_H_
|
||||
#define SLSDETECTOR_FIRMWARE_H_
|
||||
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
//memory
|
||||
int mapCSP0(void);
|
||||
u_int32_t bus_w(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t bus_r(u_int32_t offset);
|
||||
|
||||
|
||||
//Acquisition Parameters
|
||||
int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
||||
int64_t get64BitReg(int aLSB, int aMSB);
|
||||
|
||||
int64_t setFrames(int64_t value);
|
||||
int64_t getFrames();
|
||||
|
||||
int64_t setExposureTime(int64_t value);
|
||||
int64_t getExposureTime();
|
||||
|
||||
int64_t setGates(int64_t value);
|
||||
int64_t getGates();
|
||||
|
||||
int64_t setDelay(int64_t value);
|
||||
int64_t getDelay();
|
||||
|
||||
int64_t setPeriod(int64_t value);
|
||||
int64_t getPeriod();
|
||||
|
||||
int64_t setTrains(int64_t value);
|
||||
int64_t getTrains();
|
||||
|
||||
int64_t setProbes(int64_t value);
|
||||
int64_t getProbes();
|
||||
|
||||
|
||||
/*
|
||||
u_int16_t bus_w16(u_int32_t offset, u_int16_t data);//aldos function
|
||||
u_int32_t bus_r(u_int32_t offset);
|
||||
|
||||
int setPhaseShiftOnce();
|
||||
int cleanFifo();
|
||||
int setDAQRegister(int adcval);
|
||||
|
||||
u_int32_t putout(char *s, int modnum);
|
||||
u_int32_t readin(int modnum);
|
||||
u_int32_t setClockDivider(int d);
|
||||
u_int32_t getClockDivider();
|
||||
u_int32_t setSetLength(int d);
|
||||
u_int32_t getSetLength();
|
||||
u_int32_t setWaitStates(int d);
|
||||
u_int32_t getWaitStates();
|
||||
u_int32_t setTotClockDivider(int d);
|
||||
u_int32_t getTotClockDivider();
|
||||
u_int32_t setTotDutyCycle(int d);
|
||||
u_int32_t getTotDutyCycle();
|
||||
|
||||
u_int32_t setExtSignal(int d, enum externalSignalFlag mode);
|
||||
int getExtSignal(int d);
|
||||
u_int32_t setFPGASignal(int d, enum externalSignalFlag mode);
|
||||
int getFPGASignal(int d);
|
||||
int setTiming(int t);
|
||||
|
||||
|
||||
int setConfigurationRegister(int d);
|
||||
int setToT(int d);
|
||||
int setContinousReadOut(int d);
|
||||
int startReceiver(int d);
|
||||
|
||||
int setDACRegister(int idac, int val, int imod);
|
||||
|
||||
int getTemperature(int tempSensor,int imod);
|
||||
int initHighVoltage(int val,int imod);
|
||||
int initConfGain(int isettings,int val,int imod);
|
||||
|
||||
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int ival, int adc,int udpport);
|
||||
int getAdcConfigured();
|
||||
|
||||
u_int64_t getDetectorNumber();
|
||||
u_int32_t getFirmwareVersion();
|
||||
int testFifos(void);
|
||||
u_int32_t testFpga(void);
|
||||
u_int32_t testRAM(void);
|
||||
int testBus(void);
|
||||
int setDigitalTestBit(int ival);
|
||||
|
||||
|
||||
int64_t getProgress();
|
||||
int64_t setProgress();
|
||||
|
||||
int64_t getActualTime();
|
||||
int64_t getMeasurementTime();
|
||||
|
||||
|
||||
u_int32_t runBusy(void);
|
||||
u_int32_t runState(void);
|
||||
u_int32_t dataPresent(void);
|
||||
|
||||
|
||||
int startStateMachine();
|
||||
int stopStateMachine();
|
||||
int startReadOut();
|
||||
u_int32_t fifoReset(void);
|
||||
u_int32_t fifoReadCounter(int fifonum);
|
||||
u_int32_t fifoReadStatus();
|
||||
|
||||
|
||||
u_int32_t fifo_full(void);
|
||||
|
||||
|
||||
|
||||
u_int32_t* fifo_read_event();
|
||||
u_int32_t* decode_data(int* datain);
|
||||
//u_int32_t move_data(u_int64_t* datain, u_int64_t* dataout);
|
||||
int setDynamicRange(int dr);
|
||||
int getDynamicRange();
|
||||
int getNModBoard();
|
||||
int setNMod(int n);
|
||||
int setStoreInRAM(int b);
|
||||
int allocateRAM();
|
||||
int clearRAM();
|
||||
|
||||
|
||||
int setMaster(int f);
|
||||
int setSynchronization(int s);
|
||||
|
||||
int loadImage(int index, short int ImageVals[]);
|
||||
int readCounterBlock(int startACQ, short int CounterVals[]);
|
||||
int resetCounterBlock(int startACQ);
|
||||
|
||||
|
||||
u_int32_t setNBits(u_int32_t);
|
||||
u_int32_t getNBits();
|
||||
*/
|
||||
|
||||
/*
|
||||
//move to mcb_funcs?
|
||||
|
||||
int readOutChan(int *val);
|
||||
u_int32_t getModuleNumber(int modnum);
|
||||
int testShiftIn(int imod);
|
||||
int testShiftOut(int imod);
|
||||
int testShiftStSel(int imod);
|
||||
int testDataInOut(int num, int imod);
|
||||
int testExtPulse(int imod);
|
||||
int testExtPulseMux(int imod, int ow);
|
||||
int testDataInOutMux(int imod, int ow, int num);
|
||||
int testOutMux(int imod);
|
||||
int testFpgaMux(int imod);
|
||||
int calibration_sensor(int num, int *values, int *dacs) ;
|
||||
int calibration_chip(int num, int *values, int *dacs);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* SLSDETECTOR_FIRMWARE_H_ */
|
Loading…
x
Reference in New Issue
Block a user