mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
Anna's modifications
This commit is contained in:
parent
0b6aeac364
commit
52e1bd32b9
1
slsDetectorSoftware/jctbDetectorServer/Makefile
Symbolic link
1
slsDetectorSoftware/jctbDetectorServer/Makefile
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
Makefile.ctb
|
1
slsDetectorSoftware/jctbDetectorServer/bf_init.sh
Normal file
1
slsDetectorSoftware/jctbDetectorServer/bf_init.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
export PATH=/afs/psi.ch/project/sls_det_firmware/jungfrau_software/uClinux-2010_64bit/bfin-uclinux/bin:$PATH
|
150
slsDetectorSoftware/jctbDetectorServer/blackfin.c
Normal file
150
slsDetectorSoftware/jctbDetectorServer/blackfin.c
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
#include "blackfin.h"
|
||||||
|
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
#include <sys/shm.h>
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "server_defs.h"
|
||||||
|
#include "registers_m.h"
|
||||||
|
|
||||||
|
//for memory mapping
|
||||||
|
u_int32_t CSP0BASE;
|
||||||
|
|
||||||
|
u_int16_t volatile *values;
|
||||||
|
|
||||||
|
int mapCSP0(void) {
|
||||||
|
printf("Mapping memory\n");
|
||||||
|
#ifndef VIRTUAL
|
||||||
|
int fd;
|
||||||
|
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
||||||
|
if (fd == -1) {
|
||||||
|
printf("\nCan't find /dev/mem!\n");
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
printf("/dev/mem opened\n");
|
||||||
|
|
||||||
|
CSP0BASE = (u_int32_t)mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
|
||||||
|
if (CSP0BASE == (u_int32_t)MAP_FAILED) {
|
||||||
|
printf("\nCan't map memmory area!!\n");
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
printf("CSP0 mapped\n");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
CSP0BASE = malloc(MEM_SIZE);
|
||||||
|
printf("memory allocated\n");
|
||||||
|
#endif
|
||||||
|
#ifdef SHAREDMEMORY
|
||||||
|
if ( (res=inism(SMSV))<0) {
|
||||||
|
printf("error attaching shared memory! %i",res);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
printf("CSPObase is 0x%08x \n",CSP0BASE);
|
||||||
|
printf("CSPOBASE=from %08x to %08x\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||||
|
|
||||||
|
u_int32_t address;
|
||||||
|
address = FIFO_DATA_REG;//_OFF;
|
||||||
|
//values=(u_int32_t*)(CSP0BASE+address*2);
|
||||||
|
values=(u_int16_t*)(CSP0BASE+address*2);
|
||||||
|
printf("statusreg=%08x\n",bus_r(STATUS_REG));
|
||||||
|
printf("\n\n");
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
u_int16_t bus_r16(u_int32_t offset){
|
||||||
|
volatile u_int16_t *ptr1;
|
||||||
|
ptr1=(u_int16_t*)(CSP0BASE+offset*2);
|
||||||
|
return *ptr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
u_int16_t bus_w16(u_int32_t offset, u_int16_t data) {
|
||||||
|
volatile u_int16_t *ptr1;
|
||||||
|
ptr1=(u_int16_t*)(CSP0BASE+offset*2);
|
||||||
|
*ptr1=data;
|
||||||
|
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*2);
|
||||||
|
*ptr1=data;
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
u_int32_t bus_r(u_int32_t offset) {
|
||||||
|
volatile u_int32_t *ptr1;
|
||||||
|
ptr1=(u_int32_t*)(CSP0BASE+offset*2);
|
||||||
|
return *ptr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// program dacq settings
|
||||||
|
|
||||||
|
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);
|
||||||
|
// printf("Wreg64(%x,%x) %08x %08x %016llx\n", aLSB>>11, aMSB>>11, vLSB, vMSB, value);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
|
||||||
|
// printf("reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, v64);
|
||||||
|
|
||||||
|
return v64;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* /\** */
|
||||||
|
/* /\** ramType is DARK_IMAGE_REG or GAIN_IMAGE_REG *\/ */
|
||||||
|
/* u_int16_t ram_w16(u_int32_t ramType, int adc, int adcCh, int Ch, u_int16_t data) { */
|
||||||
|
/* unsigned int adr = (ramType | adc << 8 | adcCh << 5 | Ch ); */
|
||||||
|
/* // printf("Writing to addr:%x\n",adr); */
|
||||||
|
/* return bus_w16(adr,data); */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* /\** ramType is DARK_IMAGE_REG or GAIN_IMAGE_REG *\/ */
|
||||||
|
/* u_int16_t ram_r16(u_int32_t ramType, int adc, int adcCh, int Ch){ */
|
||||||
|
/* unsigned int adr = (ramType | adc << 8 | adcCh << 5 | Ch ); */
|
||||||
|
/* // printf("Reading from addr:%x\n",adr); */
|
||||||
|
/* return bus_r16(adr); */
|
||||||
|
/* } */
|
||||||
|
/* **\/ */
|
19
slsDetectorSoftware/jctbDetectorServer/blackfin.h
Normal file
19
slsDetectorSoftware/jctbDetectorServer/blackfin.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef BLACKFIN_H
|
||||||
|
#define BLACKFIN_H
|
||||||
|
|
||||||
|
#define CSP0 0x20200000
|
||||||
|
#define MEM_SIZE 0x100000
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
int mapCSP0(void);
|
||||||
|
|
||||||
|
u_int16_t bus_r16(u_int32_t offset);
|
||||||
|
u_int16_t bus_w16(u_int32_t offset, u_int16_t data);//aldos function
|
||||||
|
u_int32_t bus_w(u_int32_t offset, u_int32_t data);
|
||||||
|
u_int32_t bus_r(u_int32_t offset);
|
||||||
|
|
||||||
|
int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
||||||
|
int64_t get64BitReg(int aLSB, int aMSB);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
58
slsDetectorSoftware/jctbDetectorServer/convert_pof_to_raw.c
Normal file
58
slsDetectorSoftware/jctbDetectorServer/convert_pof_to_raw.c
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// Converts POF files into RAW files for flashing
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
// Warning: This program is for testing only.
|
||||||
|
// It makes some assumptions regarding the pof file and the flash size that might be wrong.
|
||||||
|
// It also overwrites the destination file without any hesitation.
|
||||||
|
// Handle with care.
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
FILE* src;
|
||||||
|
FILE* dst;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int i;
|
||||||
|
int filepos;
|
||||||
|
|
||||||
|
if (argc < 3)
|
||||||
|
{
|
||||||
|
printf("%s Sourcefile Destinationfile\n",argv[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
src = fopen(argv[1],"rb");
|
||||||
|
dst = fopen(argv[2],"wb");
|
||||||
|
|
||||||
|
// Remove header (0...11C)
|
||||||
|
for (filepos=0; filepos < 0x11C; filepos++)
|
||||||
|
fgetc(src);
|
||||||
|
|
||||||
|
// Write 0x80 times 0xFF (0...7F)
|
||||||
|
for (filepos=0; filepos < 0x80; filepos++)
|
||||||
|
fputc(0xFF,dst);
|
||||||
|
|
||||||
|
// Swap bits and write to file
|
||||||
|
for (filepos=0x80; filepos < 0x1000000; filepos++)
|
||||||
|
{
|
||||||
|
x = fgetc(src);
|
||||||
|
if (x < 0) break;
|
||||||
|
|
||||||
|
y=0;
|
||||||
|
for (i=0; i < 8; i++)
|
||||||
|
y=y| ( (( x & (1<<i) ) >> i) << (7-i) ); // This swaps the bits
|
||||||
|
|
||||||
|
fputc(y,dst);
|
||||||
|
}
|
||||||
|
if (filepos < 0x1000000)
|
||||||
|
printf("ERROR: EOF before end of flash\n");
|
||||||
|
|
||||||
|
printf("To flash the file in Linux do:\n");
|
||||||
|
printf(" cat /proc/mtd (to findout the right mtd)\n");
|
||||||
|
printf(" flash_eraseall /dev/mtdX\n");
|
||||||
|
printf(" cat file > /dev/mtdX\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
12
slsDetectorSoftware/jctbDetectorServer/get_server.sh
Executable file
12
slsDetectorSoftware/jctbDetectorServer/get_server.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
serv="pc8498"
|
||||||
|
f="jungfrauDetectorServerTest"
|
||||||
|
if [ "$#" -gt 0 ]; then
|
||||||
|
f=$1
|
||||||
|
fi
|
||||||
|
if [ "$#" -gt 1 ]; then
|
||||||
|
serv=$2
|
||||||
|
fi
|
||||||
|
tftp $serv -r $f -g
|
||||||
|
chmod a+xrw $f
|
||||||
|
|
30
slsDetectorSoftware/jctbDetectorServer/program_fpga.sh
Executable file
30
slsDetectorSoftware/jctbDetectorServer/program_fpga.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
serv="pc8498"
|
||||||
|
f="Jungfrau_CTB.rawbin"
|
||||||
|
if [ "$#" -gt 0 ]; then
|
||||||
|
f=$1
|
||||||
|
fi
|
||||||
|
if [ "$#" -gt 1 ]; then
|
||||||
|
serv=$2
|
||||||
|
fi
|
||||||
|
echo "File is $f server is $serv"
|
||||||
|
mount -t tmpfs none /mnt/
|
||||||
|
|
||||||
|
cd /mnt/
|
||||||
|
tftp -r $f -g $serv
|
||||||
|
|
||||||
|
echo 7 > /sys/class/gpio/export
|
||||||
|
echo 9 > /sys/class/gpio/export
|
||||||
|
echo in > /sys/class/gpio/gpio7/direction
|
||||||
|
echo out > /sys/class/gpio/gpio9/direction
|
||||||
|
|
||||||
|
|
||||||
|
echo 0 > /sys/class/gpio/gpio9/value
|
||||||
|
|
||||||
|
|
||||||
|
flash_eraseall /dev/mtd3
|
||||||
|
cat /mnt/$f > /dev/mtd3
|
||||||
|
|
||||||
|
echo 1 > /sys/class/gpio/gpio9/value
|
||||||
|
cat /sys/class/gpio/gpio7/value
|
||||||
|
|
244
slsDetectorSoftware/jctbDetectorServer/slow_adc.c
Normal file
244
slsDetectorSoftware/jctbDetectorServer/slow_adc.c
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
#include "firmware_funcs.h"
|
||||||
|
#include "registers_m.h"
|
||||||
|
#include "server_defs.h"
|
||||||
|
|
||||||
|
int prepareSlowADCSeq() {
|
||||||
|
|
||||||
|
// u_int16_t vv=0x3c40;
|
||||||
|
u_int16_t codata=( 1<<13) | (7<<10) | (7<<7) | (1<<6) | (0<<3) | (2<<1) | 1;
|
||||||
|
|
||||||
|
u_int32_t valw;
|
||||||
|
int obit, ibit;
|
||||||
|
|
||||||
|
// int cnv_bit=16, sdi_bit=17, sck_bit=18;
|
||||||
|
int cnv_bit=10, sdi_bit=8, sck_bit=9;
|
||||||
|
|
||||||
|
// int oval=0;
|
||||||
|
|
||||||
|
|
||||||
|
printf("Codata is %04x\n",codata);
|
||||||
|
|
||||||
|
/* //convert */
|
||||||
|
valw=(1<<cnv_bit);
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
valw=0;
|
||||||
|
bus_w(ADC_WRITE_REG,(valw));
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
for (ibit=0; ibit<14; ibit++) {
|
||||||
|
obit=((codata >> (13-ibit)) & 1);
|
||||||
|
// printf("%d",obit);
|
||||||
|
valw = obit << sdi_bit;
|
||||||
|
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
bus_w(ADC_WRITE_REG,valw|(1<<sck_bit));
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
}
|
||||||
|
// printf("\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bus_w(ADC_WRITE_REG,0);
|
||||||
|
|
||||||
|
/* //convert */
|
||||||
|
valw=(1<<cnv_bit);
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
valw=0;
|
||||||
|
bus_w(ADC_WRITE_REG,(valw));
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int prepareSlowADC(int ichan) {
|
||||||
|
|
||||||
|
// u_int16_t vv=0x3c40;
|
||||||
|
// u_int16_t codata=( 1<<13) | (7<<10) | (7<<7) | (1<<6) | (0<<3) | (2<<1) | 1;
|
||||||
|
|
||||||
|
u_int16_t codata=(1<<13) | (7<<10) | (ichan<<7) | (1<<6) | (0<<3) | (0<<1) | 1; //read single channel
|
||||||
|
if (ichan<0) codata=( 1<<13) | (3<<10) | (7<7) | (1<<6) | (0<<3) | (0<<1) | 1;
|
||||||
|
|
||||||
|
u_int32_t valw;
|
||||||
|
int obit, ibit;
|
||||||
|
|
||||||
|
// int cnv_bit=16, sdi_bit=17, sck_bit=18;
|
||||||
|
int cnv_bit=10, sdi_bit=8, sck_bit=9;
|
||||||
|
|
||||||
|
|
||||||
|
// int oval=0;
|
||||||
|
|
||||||
|
|
||||||
|
printf("Codata is %04x\n",codata);
|
||||||
|
|
||||||
|
/* //convert */
|
||||||
|
valw=(1<<cnv_bit);
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
valw=0;
|
||||||
|
bus_w(ADC_WRITE_REG,(valw));
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
for (ibit=0; ibit<14; ibit++) {
|
||||||
|
obit=((codata >> (13-ibit)) & 1);
|
||||||
|
// printf("%d",obit);
|
||||||
|
valw = obit << sdi_bit;
|
||||||
|
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
bus_w(ADC_WRITE_REG,valw|(1<<sck_bit));
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
}
|
||||||
|
// printf("\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bus_w(ADC_WRITE_REG,0);
|
||||||
|
|
||||||
|
/* //convert */
|
||||||
|
valw=(1<<cnv_bit);
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
valw=0;
|
||||||
|
bus_w(ADC_WRITE_REG,(valw));
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int readSlowADC(int ichan) {
|
||||||
|
|
||||||
|
|
||||||
|
// u_int16_t vv=0x3c40;
|
||||||
|
// u_int16_t codata=( 1<<13) | (7<<10) | (ichan<<7) | (1<<6) | (0<<3) | (0<<1) | 1; //read single channel
|
||||||
|
|
||||||
|
u_int32_t valw;
|
||||||
|
int i, obit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// int cnv_bit=16, sdi_bit=17, sck_bit=18;
|
||||||
|
int cnv_bit=10, sdi_bit=8, sck_bit=9;
|
||||||
|
|
||||||
|
int oval=0;
|
||||||
|
|
||||||
|
printf("DAC index is %d\n",ichan);
|
||||||
|
|
||||||
|
if (ichan<-1 || ichan>7)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
|
||||||
|
prepareSlowADC(ichan);
|
||||||
|
|
||||||
|
|
||||||
|
/* printf("Codata is %04x\n",codata); */
|
||||||
|
|
||||||
|
/* /\* //convert *\/ */
|
||||||
|
/* valw=(1<<cnv_bit); */
|
||||||
|
/* bus_w(ADC_WRITE_REG,valw); */
|
||||||
|
|
||||||
|
/* usleep(20); */
|
||||||
|
|
||||||
|
/* valw=0; */
|
||||||
|
/* bus_w(ADC_WRITE_REG,(valw)); */
|
||||||
|
|
||||||
|
/* usleep(20); */
|
||||||
|
|
||||||
|
/* for (ibit=0; ibit<14; ibit++) { */
|
||||||
|
/* obit=((codata >> (13-ibit)) & 1); */
|
||||||
|
/* // printf("%d",obit); */
|
||||||
|
/* valw = obit << sdi_bit; */
|
||||||
|
|
||||||
|
/* bus_w(ADC_WRITE_REG,valw); */
|
||||||
|
|
||||||
|
/* usleep(20); */
|
||||||
|
|
||||||
|
/* bus_w(ADC_WRITE_REG,valw|(1<<sck_bit)); */
|
||||||
|
|
||||||
|
/* usleep(20); */
|
||||||
|
|
||||||
|
/* bus_w(ADC_WRITE_REG,valw); */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
/* // printf("\n"); */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* bus_w(ADC_WRITE_REG,0); */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (ichan=0; ichan<9; ichan++) {
|
||||||
|
|
||||||
|
|
||||||
|
/* //convert */
|
||||||
|
valw=(1<<cnv_bit);
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
valw=0;
|
||||||
|
bus_w(ADC_WRITE_REG,(valw));
|
||||||
|
|
||||||
|
|
||||||
|
usleep(20);
|
||||||
|
// printf("Channel %d ",ichan);
|
||||||
|
//read
|
||||||
|
oval=0;
|
||||||
|
for (i=0;i<16;i++) {
|
||||||
|
obit=bus_r16(SLOW_ADC_REG)&0x1;
|
||||||
|
// printf("%d",obit);
|
||||||
|
//write data (i)
|
||||||
|
// usleep(0);
|
||||||
|
oval|=obit<<(15-i);
|
||||||
|
//cldwn
|
||||||
|
valw=0;
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
bus_w(ADC_WRITE_REG,valw|(1<<sck_bit));
|
||||||
|
usleep(20);
|
||||||
|
bus_w(ADC_WRITE_REG,valw);
|
||||||
|
usleep(20);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
printf("\t");
|
||||||
|
printf("Value %d is %d (%d mV)\n",ichan, oval,2500*oval/65535);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Value %d is %d\n",ichan, oval);
|
||||||
|
|
||||||
|
return 2500*oval/65535;
|
||||||
|
}
|
||||||
|
|
10
slsDetectorSoftware/jctbDetectorServer/slow_adc.h
Normal file
10
slsDetectorSoftware/jctbDetectorServer/slow_adc.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef SLOW_ADC_H
|
||||||
|
#define SLOW_ADC_H
|
||||||
|
|
||||||
|
int prepareSlowADCSeq();
|
||||||
|
int prepareSlowADC(int ichan);
|
||||||
|
|
||||||
|
|
||||||
|
int readSlowADC(int ichan);
|
||||||
|
|
||||||
|
#endif
|
@ -2981,17 +2981,19 @@ dacs_t multiSlsDetector::setDAC(dacs_t val, dacIndex idac, int mV, int imod) {
|
|||||||
posmin=id;
|
posmin=id;
|
||||||
posmax=id+1;
|
posmax=id+1;
|
||||||
}
|
}
|
||||||
|
// cout <<posmin << " " << posmax << endl;
|
||||||
//return storage values
|
//return storage values
|
||||||
dacs_t* iret[posmax-posmin];
|
dacs_t* iret[posmax-posmin];
|
||||||
for(int idet=posmin; idet<posmax; ++idet){
|
for(int idet=posmin; idet<posmax; ++idet){
|
||||||
|
//cout << idet << endl;
|
||||||
if(detectors[idet]){
|
if(detectors[idet]){
|
||||||
|
// cout << "*" << endl;
|
||||||
iret[idet]= new dacs_t(-1);
|
iret[idet]= new dacs_t(-1);
|
||||||
Task* task = new Task(new func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>(&slsDetector::setDAC,
|
Task* task = new Task(new func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>(&slsDetector::setDAC,detectors[idet],val, idac, mV, im, iret[idet]));
|
||||||
detectors[idet],val, idac, mV, im, iret[idet]));
|
|
||||||
threadpool->add_task(task);
|
threadpool->add_task(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// cout << "Start" << endl;
|
||||||
threadpool->startExecuting();
|
threadpool->startExecuting();
|
||||||
threadpool->wait_for_tasks_to_complete();
|
threadpool->wait_for_tasks_to_complete();
|
||||||
for(int idet=posmin; idet<posmax; idet++){
|
for(int idet=posmin; idet<posmax; idet++){
|
||||||
|
Binary file not shown.
86
slsDetectorSoftware/slsDetectorClient.doxy
Normal file
86
slsDetectorSoftware/slsDetectorClient.doxy
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
|
||||||
|
# documentation are documented, even if no documentation was available.
|
||||||
|
# Private class members and static file members will be hidden unless
|
||||||
|
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
|
||||||
|
|
||||||
|
EXTRACT_ALL = YES
|
||||||
|
|
||||||
|
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
|
||||||
|
# will be included in the documentation.
|
||||||
|
|
||||||
|
EXTRACT_PRIVATE = NO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
||||||
|
# will be included in the documentation.
|
||||||
|
|
||||||
|
EXTRACT_STATIC = YES
|
||||||
|
|
||||||
|
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
|
||||||
|
# defined locally in source files will be included in the documentation.
|
||||||
|
# If set to NO only classes defined in header files are included.
|
||||||
|
|
||||||
|
EXTRACT_LOCAL_CLASSES = YES
|
||||||
|
|
||||||
|
# This flag is only useful for Objective-C code. When set to YES local
|
||||||
|
# methods, which are defined in the implementation section but not in
|
||||||
|
# the interface are included in the documentation.
|
||||||
|
# If set to NO (the default) only methods in the interface are included.
|
||||||
|
|
||||||
|
EXTRACT_LOCAL_METHODS = YES
|
||||||
|
|
||||||
|
# If this flag is set to YES, the members of anonymous namespaces will be
|
||||||
|
# extracted and appear in the documentation as a namespace called
|
||||||
|
# 'anonymous_namespace{file}', where file will be replaced with the base
|
||||||
|
# name of the file that contains the anonymous namespace. By default
|
||||||
|
# anonymous namespace are hidden.
|
||||||
|
|
||||||
|
EXTRACT_ANON_NSPACES = NO
|
||||||
|
|
||||||
|
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
|
||||||
|
# undocumented members of documented classes, files or namespaces.
|
||||||
|
# If set to NO (the default) these members will be included in the
|
||||||
|
# various overviews, but no documentation section is generated.
|
||||||
|
# This option has no effect if EXTRACT_ALL is enabled.
|
||||||
|
|
||||||
|
HIDE_UNDOC_MEMBERS = NO
|
||||||
|
|
||||||
|
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
|
||||||
|
# undocumented classes that are normally visible in the class hierarchy.
|
||||||
|
# If set to NO (the default) these classes will be included in the various
|
||||||
|
# overviews. This option has no effect if EXTRACT_ALL is enabled.
|
||||||
|
|
||||||
|
HIDE_UNDOC_CLASSES = NO
|
||||||
|
|
||||||
|
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
|
||||||
|
# friend (class|struct|union) declarations.
|
||||||
|
# If set to NO (the default) these declarations will be included in the
|
||||||
|
# documentation.
|
||||||
|
|
||||||
|
HIDE_FRIEND_COMPOUNDS = NO
|
||||||
|
|
||||||
|
INTERNAL_DOCS = NO
|
||||||
|
|
||||||
|
SHOW_INCLUDE_FILES = NO
|
||||||
|
|
||||||
|
SHOW_FILES = NO
|
||||||
|
|
||||||
|
SHOW_NAMESPACES = NO
|
||||||
|
|
||||||
|
COMPACT_LATEX = YES
|
||||||
|
|
||||||
|
PAPER_TYPE = a4
|
||||||
|
|
||||||
|
PDF_HYPERLINKS = YES
|
||||||
|
|
||||||
|
USE_PDFLATEX = YES
|
||||||
|
|
||||||
|
LATEX_HIDE_INDICES = YES
|
||||||
|
|
||||||
|
|
||||||
|
PREDEFINED = __cplusplus
|
||||||
|
|
||||||
|
INPUT = slsDetector/slsDetectorCommand.cpp
|
||||||
|
|
||||||
|
OUTPUT_DIRECTORY = slsDetectorClientDocs
|
@ -49,9 +49,9 @@ int ThreadPool::initialize_threadpool(){
|
|||||||
m_threads.push_back(tid);
|
m_threads.push_back(tid);
|
||||||
while(!thread_started);
|
while(!thread_started);
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << m_pool_size << " threads created by the thread pool" << endl;
|
cout << m_pool_size << " threads created by the thread pool" << endl;
|
||||||
#endif
|
#endif
|
||||||
return m_pool_size;
|
return m_pool_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,11 +87,11 @@ int ThreadPool::destroy_threadpool(){
|
|||||||
|
|
||||||
void* ThreadPool::execute_thread(){
|
void* ThreadPool::execute_thread(){
|
||||||
//for debugging seting ithread value
|
//for debugging seting ithread value
|
||||||
// int ithread = current_thread_number;
|
//int ithread = current_thread_number;
|
||||||
thread_started = true;
|
thread_started = true;
|
||||||
Task* task = NULL;
|
Task* task = NULL;
|
||||||
m_tasks_loaded = false;
|
m_tasks_loaded = false;
|
||||||
/*cout << "Starting thread " << pthread_self() << endl;*/
|
//cout << "Starting thread " << pthread_self() << endl;
|
||||||
while(true) {
|
while(true) {
|
||||||
// Try to pick a task
|
// Try to pick a task
|
||||||
/*cout << "Locking: " << pthread_self() << endl;*/
|
/*cout << "Locking: " << pthread_self() << endl;*/
|
||||||
@ -122,7 +122,7 @@ void* ThreadPool::execute_thread(){
|
|||||||
|
|
||||||
//cout<<"***"<<ithread<<" checking out semaphore done address:"<<&semDone<<endl;
|
//cout<<"***"<<ithread<<" checking out semaphore done address:"<<&semDone<<endl;
|
||||||
|
|
||||||
/*cout << ithread <<" Executing thread " << pthread_self() << endl;*/
|
// cout << ithread <<" Executing thread " << pthread_self() << endl;
|
||||||
// execute the task
|
// execute the task
|
||||||
(*task)(); // could also do task->run(arg);
|
(*task)(); // could also do task->run(arg);
|
||||||
/*cout << ithread <<" Done executing thread " << pthread_self() << endl;*/
|
/*cout << ithread <<" Done executing thread " << pthread_self() << endl;*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user