mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
works but usleep required
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@115 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -96,7 +96,6 @@ int acceptConnection(int socketDescriptor) {
|
||||
|
||||
// if(file_des>0) return file_des;
|
||||
|
||||
//next 3 lines commented out by dhanya
|
||||
//#ifndef C_ONLY
|
||||
// if(is_a_server){ //server; the server will wait for the clients connection
|
||||
//#endif
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include </opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime/usr/include/bfin_sram.h>
|
||||
|
||||
|
||||
|
||||
|
||||
//for memory mapping
|
||||
@ -171,8 +174,8 @@ int mapCSP0(void) {
|
||||
|
||||
u_int32_t address;
|
||||
address = FIFO_DATA_REG_OFF;
|
||||
values=(u_int16_t*)(CSP0BASE+address*2);
|
||||
printf("values=%04x\n",values);
|
||||
values=(u_int32_t*)(CSP0BASE+address*2);
|
||||
printf("values=%08x\n",values);
|
||||
//printf("values=%08x\n",((u_int32_t*)(CSP0BASE+FIFO_DATA_REG_OFF*2)));
|
||||
|
||||
/* must b uncommentedlater////////////////////////////////////////////////////////
|
||||
@ -1263,7 +1266,7 @@ u_int32_t runState(void) {
|
||||
write_status_sm("Stopped");
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
printf("status %08x\n",s);
|
||||
printf("status %04x\n",s);
|
||||
#endif
|
||||
return s;
|
||||
}
|
||||
@ -1272,9 +1275,9 @@ u_int32_t runState(void) {
|
||||
// State Machine
|
||||
|
||||
u_int32_t startStateMachine(){
|
||||
#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
printf("Starting State Machine\n");
|
||||
#endif
|
||||
//#endif
|
||||
// fifoReset(); printf("Starting State Machine\n");
|
||||
now_ptr=(char*)ram_values;
|
||||
#ifdef SHAREDMEMORY
|
||||
@ -1442,7 +1445,35 @@ u_int32_t* fifo_read_event()
|
||||
printf("FIFO %d contains %d words\n",ichip,(fifoReadCounter(ichip)&FIFO_COUNTER_MASK));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//unsigned long flags;
|
||||
|
||||
// register int ihalf;
|
||||
|
||||
// save_flags(flags);
|
||||
// cli(); /* This code runs with interrupts disabled */
|
||||
|
||||
|
||||
/* for (ihalf=0;ihalf<dataBytes/sizeof(int); ihalf++){
|
||||
ram_values[ihalf]=*values;
|
||||
}*/
|
||||
|
||||
|
||||
// restore_flags(flags);
|
||||
|
||||
/*
|
||||
for (ihalf=0;ihalf<dataBytes/sizeof(int); ihalf++)
|
||||
printf("\n%d: 0x%0x 0x%0x",ihalf,ram_values[ihalf]&0xffff,(ram_values[ihalf]>>16)&0xffff);
|
||||
*/
|
||||
|
||||
/* for (ichip=0;ichip<dataBytes/2; ichip++)
|
||||
printf("\n%d: %08x",ichip,*values);*/
|
||||
|
||||
|
||||
//sram_free(now_ptr);
|
||||
memcpy(now_ptr, values, dataBytes);
|
||||
|
||||
/*
|
||||
#ifdef VERBOSE
|
||||
for (ichip=0;ichip<dataBytes/4; ichip++) {
|
||||
|
@ -52,45 +52,45 @@
|
||||
|
||||
//FIFO
|
||||
#define LOOK_AT_ME_REG 0x28<<11
|
||||
#define COUNTER_REG_OFF 0x29<<11
|
||||
|
||||
#define FIFO_DATA_REG_OFF 0x80<<11 ///////
|
||||
|
||||
|
||||
//to read back dac registers
|
||||
#define MOD_DACS1_REG 0x2a<<11
|
||||
#define MOD_DACS2_REG 0x2b<<11
|
||||
#define MOD_DACS3_REG 0x2c<<11
|
||||
#define MOD_DACS1_REG 0x65<<11
|
||||
#define MOD_DACS2_REG 0x66<<11
|
||||
#define MOD_DACS3_REG 0x67<<11
|
||||
|
||||
//user entered
|
||||
#define SET_DELAY_LSB_REG 0x2d<<11
|
||||
#define SET_DELAY_MSB_REG 0x2e<<11
|
||||
#define GET_DELAY_LSB_REG 0x2f<<11
|
||||
#define GET_DELAY_MSB_REG 0x30<<11
|
||||
#define SET_DELAY_LSB_REG 0x68<<11
|
||||
#define SET_DELAY_MSB_REG 0x69<<11
|
||||
#define GET_DELAY_LSB_REG 0x6a<<11
|
||||
#define GET_DELAY_MSB_REG 0x6b<<11
|
||||
|
||||
#define SET_TRAINS_LSB_REG 0x31<<11
|
||||
#define SET_TRAINS_MSB_REG 0x32<<11
|
||||
#define GET_TRAINS_LSB_REG 0x33<<11
|
||||
#define GET_TRAINS_MSB_REG 0x34<<11
|
||||
#define SET_TRAINS_LSB_REG 0x6c<<11
|
||||
#define SET_TRAINS_MSB_REG 0x6d<<11
|
||||
#define GET_TRAINS_LSB_REG 0x6e<<11
|
||||
#define GET_TRAINS_MSB_REG 0x6f<<11
|
||||
|
||||
#define SET_FRAMES_LSB_REG 0x35<<11
|
||||
#define SET_FRAMES_MSB_REG 0x36<<11
|
||||
#define GET_FRAMES_LSB_REG 0x37<<11
|
||||
#define GET_FRAMES_MSB_REG 0x38<<11
|
||||
#define SET_FRAMES_LSB_REG 0x70<<11
|
||||
#define SET_FRAMES_MSB_REG 0x71<<11
|
||||
#define GET_FRAMES_LSB_REG 0x72<<11
|
||||
#define GET_FRAMES_MSB_REG 0x73<<11
|
||||
|
||||
#define SET_PERIOD_LSB_REG 0x39<<11
|
||||
#define SET_PERIOD_MSB_REG 0x3a<<11
|
||||
#define GET_PERIOD_LSB_REG 0x3b<<11
|
||||
#define GET_PERIOD_MSB_REG 0x3c<<11
|
||||
#define SET_PERIOD_LSB_REG 0x74<<11
|
||||
#define SET_PERIOD_MSB_REG 0x75<<11
|
||||
#define GET_PERIOD_LSB_REG 0x76<<11
|
||||
#define GET_PERIOD_MSB_REG 0x77<<11
|
||||
|
||||
#define SET_EXPTIME_LSB_REG 0x3d<<11
|
||||
#define SET_EXPTIME_MSB_REG 0x3e<<11
|
||||
#define GET_EXPTIME_LSB_REG 0x3f<<11
|
||||
#define GET_EXPTIME_MSB_REG 0x40<<11
|
||||
#define SET_EXPTIME_LSB_REG 0x78<<11
|
||||
#define SET_EXPTIME_MSB_REG 0x79<<11
|
||||
#define GET_EXPTIME_LSB_REG 0x7a<<11
|
||||
#define GET_EXPTIME_MSB_REG 0x7b<<11
|
||||
|
||||
#define SET_GATES_LSB_REG 0x41<<11
|
||||
#define SET_GATES_MSB_REG 0x42<<11
|
||||
#define GET_GATES_LSB_REG 0x43<<11
|
||||
#define GET_GATES_MSB_REG 0x44<<11
|
||||
#define SET_GATES_LSB_REG 0x7c<<11
|
||||
#define SET_GATES_MSB_REG 0x7d<<11
|
||||
#define GET_GATES_LSB_REG 0x7e<<11
|
||||
#define GET_GATES_MSB_REG 0x7f<<11
|
||||
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@ int decode_function(int file_des) {
|
||||
#endif
|
||||
n = receiveDataOnly(file_des,&fnum,sizeof(fnum));
|
||||
if (n <= 0) {
|
||||
printf("ERROR reading from socket %d, %d %d\n", n, fnum, file_des);
|
||||
//printf("ERROR reading from socket %d, %d %d\n", n, fnum, file_des);
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
@ -1853,6 +1853,16 @@ int get_run_status(int file_des) {
|
||||
|
||||
retval= runState();
|
||||
printf("\n\nSTATUS=%x\n",retval);
|
||||
|
||||
if (retval&0x00000001){
|
||||
printf("-----------------------------------RUNNING-----------------------------------\n");
|
||||
s=RUNNING;
|
||||
}
|
||||
else{
|
||||
printf("-----------------------------------IDLE----------------------------------\n");
|
||||
s=IDLE;
|
||||
}
|
||||
/*
|
||||
if (retval&0x8000)
|
||||
s=ERROR;
|
||||
else if (retval&0x00000001)
|
||||
@ -1867,7 +1877,7 @@ int get_run_status(int file_des) {
|
||||
s=WAITING;
|
||||
else
|
||||
s=IDLE;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
if (ret!=OK) {
|
||||
@ -1995,6 +2005,7 @@ int read_all(int file_des) {
|
||||
|
||||
|
||||
while(read_frame(file_des)==OK) {
|
||||
//usleep(0);
|
||||
#ifdef VERBOSE
|
||||
printf("frame read\n");
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user