fix in ltc, added moench, separated servers, left to do max1932, client side for moench and more detailed in ctb server side

This commit is contained in:
2018-12-19 16:38:18 +01:00
parent 89d9204e1c
commit f161d68efc
12 changed files with 36 additions and 51 deletions

View File

@ -1,11 +1,7 @@
#pragma once
/* Definitions for FPGA */
#ifdef JCTB
#define MEM_MAP_SHIFT 11
#else
#define MEM_MAP_SHIFT 1
#endif
/* FPGA Version RO register */
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
@ -14,7 +10,6 @@
#define FPGA_VERSION_BRD_RVSN_MSK (0x00FFFFFF << FPGA_VERSION_BRD_RVSN_OFST)
#define FPGA_VERSION_DTCTR_TYP_OFST (24)
#define FPGA_VERSION_DTCTR_TYP_MSK (0x000000FF << FPGA_VERSION_DTCTR_TYP_OFST)
#define FPGA_VERSION_DTCTR_TYP_JCTB_VAL ((0x2 << FPGA_VERSION_DTCTR_TYP_OFST) & FPGA_VERSION_DTCTR_TYP_MSK)
#define FPGA_VERSION_DTCTR_TYP_CTB_VAL ((0x3 << FPGA_VERSION_DTCTR_TYP_OFST) & FPGA_VERSION_DTCTR_TYP_MSK)
/* Fix pattern RO register */

View File

@ -64,7 +64,7 @@ void basictests() {
firmware_check_done = 0;
memset(firmware_message, 0, MAX_STR_LENGTH);
#ifdef VIRTUAL
FILE_LOG(logINFOBLUE, ("******** %s Virtual Server *****************\n", DETNAME));
FILE_LOG(logINFOBLUE, ("******** Chip Test Board Virtual Server *****************\n"));
if (mapCSP0() == FAIL) {
strcpy(firmware_message,
"Could not map to memory. Dangerous to continue.\n");
@ -110,7 +110,7 @@ void basictests() {
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
sw_fw_apiversion = getDetectorId(SOFTWARE_FIRMWARE_API_VERSION);
FILE_LOG(logINFOBLUE, ("************ %s Server *********************\n"
FILE_LOG(logINFOBLUE, ("************ Chip Test Board Server *********************\n"
"Hardware Version:\t\t 0x%x\n"
"Hardware Serial Nr:\t\t 0x%x\n"
@ -123,7 +123,6 @@ void basictests() {
"Required Firmware Version:\t 0x%x\n"
"Client-Software API Version:\t 0x%llx\n"
"********************************************************\n",
DETNAME,
hversion, hsnumber,
ipadd,
(long long unsigned int)macadd,
@ -189,13 +188,10 @@ int checkType() {
uint32_t type = ((bus_r(FPGA_VERSION_REG) & FPGA_VERSION_DTCTR_TYP_MSK) >> FPGA_VERSION_DTCTR_TYP_OFST);
uint32_t expectedType = FPGA_VERSION_DTCTR_TYP_CTB_VAL;
#ifdef JCTB
expectedType = FPGA_VERSION_DTCTR_TYP_JCTB_VAL;
#endif
if (type != expectedType) {
FILE_LOG(logERROR, ("This is not a %s Server (read %d, expected %d)\n",
DETNAME, type, expectedType));
FILE_LOG(logERROR, ("This is not a Chip Test Board Server (read %d, expected %d)\n",
type, expectedType));
return FAIL;
}
return OK;
@ -529,7 +525,7 @@ void setupDetector() {
resetCore();
//Initialization of acquistion parameters
setTimer(SAMPLES_JCTB, DEFAULT_NUM_SAMPLES); // update databytes and allocate ram
setTimer(SAMPLES, DEFAULT_NUM_SAMPLES); // update databytes and allocate ram
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
@ -937,7 +933,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
FILE_LOG(logDEBUG1, ("Getting #cycles: %lld\n", (long long int)retval));
break;
case SAMPLES_JCTB:
case SAMPLES:
if(val >= 0) {
FILE_LOG(logINFO, ("Setting #samples: %lld\n", (long long int)val));
nSamples = val;

View File

@ -10,12 +10,6 @@
#define PROGRAMMING_MODE (0x2)
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
#ifdef JCTB
#define DETNAME = "Jungfrau Chip Test Board";
#else
#define DETNAME = "Chip Test Board";
#endif
/* Struct Definitions */
typedef struct ip_header_struct {
uint16_t ip_len;
@ -86,11 +80,7 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
#define VCHIP_POWER_INCRMNT (200)
#define IP_PACKETSIZE (0x2032)
#ifndef JCTB
#define ADC_PORT_INVERT_VAL (0x453b2593)
#else
#define ADC_PORT_INVERT_VAL (0x453b2593)
#endif
#define MAXIMUM_ADC_CLK (40)
#define PLL_VCO_FREQ_MHZ (400)

View File

@ -123,7 +123,7 @@ int LTC2620_VoltageToDac(int voltage, int* dacval) {
* @returns FAIL when voltage outside limits, OK if conversion successful
*/
int LTC2620_DacToVoltage(int dacval, int* voltage) {
return Common_VoltageToDac(dacval, voltage, LTC2620_MIN_MV, LTC2620_MaxMV, LTC2620_MAX_STEPS);
return Common_DacToVoltage(dacval, voltage, LTC2620_MIN_MV, LTC2620_MaxMV, LTC2620_MAX_STEPS);
}
/**
@ -147,11 +147,11 @@ void LTC2620_Configure(){
/**
* Set Dac value (obtains dacaddr, command and ichip and calls LTC2620_Set)
* Set Dac (obtains dacaddr, command and ichip and calls LTC2620_Set)
* @param dacnum dac number
* @param data dac value to set
*/
void LTC2620_SetDACValue (int dacnum, int data) {
void LTC2620_SetDAC (int dacnum, int data) {
FILE_LOG(logDEBUG1, ("\tSetting dac %d to %d\n", dacnum, data));
// LTC2620 index
int ichip = dacnum / LTC2620_NUMCHANNELS;

View File

@ -16,6 +16,8 @@ const enum detectorType myDetectorType = EIGER;
const enum detectorType myDetectorType = JUNGFRAU;
#elif CHIPTESTBOARDD
const enum detectorType myDetectorType = CHIPTESTBOARD;
#elif MOENCHD
const enum detectorType myDetectorType = MOENCH;
#else
const enum detectorType myDetectorType = GENERIC;
#endif
@ -33,7 +35,7 @@ extern char mess[MAX_STR_LENGTH];
// Variables that will be exported
int sockfd = 0;
int debugflag = 0;
#ifdef CHIPTESTBOARDD
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
int dataBytes = 0;
uint16_t *ramValues = 0;
int nframes = 0;
@ -131,7 +133,7 @@ const char* getTimerName(enum timerIndex ind) {
case MEASUREMENTS_NUMBER: return "measurements_number";
case FRAMES_FROM_START: return "frames_from_start";
case FRAMES_FROM_START_PG: return "frames_from_start_pg";
case SAMPLES_JCTB: return "samples_jctb";
case SAMPLES: return "samples";
case SUBFRAME_ACQUISITION_TIME: return "subframe_acquisition_time";
case SUBFRAME_DEADTIME: return "subframe_deadtime";
case STORAGE_CELL_NUMBER: return "storage_cell_number";
@ -1509,7 +1511,7 @@ int set_timer(int file_des) {
#endif
case FRAME_PERIOD:
case CYCLES_NUMBER:
case SAMPLES_JCTB:
case SAMPLES:
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD)
case DELAY_AFTER_TRIGGER:
#endif
@ -1568,7 +1570,7 @@ int set_timer(int file_des) {
case STORAGE_CELL_NUMBER:
validate64(tns, retval, vtimerName, DEC); // no conversion, so all good
break;
case SAMPLES_JCTB:
case SAMPLES:
if (retval == -1) {
ret = FAIL;
retval = setTimer(ind, -1);