formatted changes made by Martin, which inclded resolving fifo full problem, first frame problem; 32 bit mode sub frame and 16 byte ignore

This commit is contained in:
Dhanya Maliakal 2015-06-16 11:59:07 +02:00
parent 8323f81e8a
commit 861753a5d1
15 changed files with 178 additions and 191 deletions

View File

@ -546,22 +546,22 @@ int Beb_SetUpTransferParameters(short the_bit_mode){
int Beb_StopAcquisition() int Beb_StopAcquisition()
{ {
u_int32_t baseaddr; u_int32_t baseaddr;
u_int32_t valuel,valuer; volatile u_int32_t valuel,valuer;
//open file pointer //open file pointer
int fd = Beb_open(XPAR_STOP_ACQUISITION,&baseaddr); int fd = Beb_open(XPAR_CMD_GENERATOR,&baseaddr);
if(fd < 0){ if(fd < 0){
cprintf(RED,"Beb Stop Acquisition FAIL\n"); cprintf(RED,"Beb Stop Acquisition FAIL\n");
return 0; return 0;
}else{ }else{
//find value //find value
valuel = Beb_Read32(baseaddr, STOP_ACQUISITION_LEFT_OFFSET); valuel = Beb_Read32(baseaddr, (LEFT_OFFSET+STOP_ACQ_OFFSET));
valuer = Beb_Read32(baseaddr, STOP_ACQUISITION_RIGHT_OFFSET); valuer = Beb_Read32(baseaddr, (RIGHT_OFFSET+STOP_ACQ_OFFSET));
//high //high
Beb_Write32(baseaddr, STOP_ACQUISITION_LEFT_OFFSET,(valuel|STOP_ACQUISITION_BIT)); Beb_Write32(baseaddr, (LEFT_OFFSET + STOP_ACQ_OFFSET),(valuel|STOP_ACQ_BIT));
Beb_Write32(baseaddr, STOP_ACQUISITION_RIGHT_OFFSET,(valuer|STOP_ACQUISITION_BIT)); Beb_Write32(baseaddr, (RIGHT_OFFSET + STOP_ACQ_OFFSET),(valuer|STOP_ACQ_BIT));
//low //low
Beb_Write32(baseaddr, STOP_ACQUISITION_LEFT_OFFSET,(valuel&(~STOP_ACQUISITION_BIT))); Beb_Write32(baseaddr, (LEFT_OFFSET + STOP_ACQ_OFFSET),(valuel&(~STOP_ACQ_BIT)));
Beb_Write32(baseaddr, STOP_ACQUISITION_RIGHT_OFFSET,(valuer&(~STOP_ACQUISITION_BIT))); Beb_Write32(baseaddr, (RIGHT_OFFSET + STOP_ACQ_OFFSET),(valuer&(~STOP_ACQ_BIT)));
printf("Beb Stop Acquisition OK\n"); printf("Beb Stop Acquisition OK\n");
//close file pointer //close file pointer
@ -578,8 +578,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
unsigned int npackets = ten_gig ? Beb_bit_mode*4 : Beb_bit_mode*16; unsigned int npackets = ten_gig ? Beb_bit_mode*4 : Beb_bit_mode*16;
int in_two_requests = (!ten_gig&&Beb_bit_mode==32); int in_two_requests = (!ten_gig&&Beb_bit_mode==32);
volatile u_int32_t* ptrl; // volatile u_int32_t* ptrl;
volatile u_int32_t* ptrr; // volatile u_int32_t* ptrr;
u_int32_t send_header_command; u_int32_t send_header_command;
u_int32_t send_frame_command; u_int32_t send_frame_command;
@ -605,12 +605,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
// base+10 1st 32bits of 2nd command // base+10 1st 32bits of 2nd command
// base+14 2nd 32bits of 2nd command // base+14 2nd 32bits of 2nd command
// //
// base+1c command counter (sends n commands) // base+18 command counter (sends n commands)
// <32 Bit mode : 2 commands for 1 frame neccessary (header + frame) (10 frames = 20 commands) // <32 Bit mode : 2 commands for 1 frame neccessary (header + frame) (10 frames = 20 commands)
// 32 Bit mode : 3 commands for 1 frame neccessary (header + 1st halfframe + 2nd halfframe) (10 frames = 30 commands) // 32 Bit mode : 3 commands for 1 frame neccessary (header + 1st halfframe + 2nd halfframe) (10 frames = 30 commands)
// if > 0 core starts operation // if > 0 core starts operation
// //
// base+20 command mode (for 32 bit mode) // base+1c command mode (for 32 bit mode)
// 0 for 2 command mode (send 1st command and 2nd command) (header + frame) // 0 for 2 command mode (send 1st command and 2nd command) (header + frame)
// 1 on bit 31 for 3 command mode (send 1st command, 2nd command, and 2nd command) (header + 1st halfframe + 2nd halfframe) // 1 on bit 31 for 3 command mode (send 1st command, 2nd command, and 2nd command) (header + 1st halfframe + 2nd halfframe)
// //
@ -619,74 +619,67 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
// //
// Mapping u_int32_t right_port_value = 0x2000;
int fd; u_int32_t baseaddr;
fd = open("/dev/mem", O_RDWR | O_SYNC, 0); volatile u_int32_t value;
if (fd == -1) //open file pointer
{ int fd = Beb_open(XPAR_CMD_GENERATOR,&baseaddr);
printf("\nCan't find /dev/mem!\n"); if(fd < 0){
cprintf(RED,"Beb Request N Images FAIL\n");
return 0; return 0;
} }else{
u_int32_t CSP0BASE = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, 0xC5000000 );
if (CSP0BASE == (u_int32_t)MAP_FAILED)
{
printf("\nCan't map memmory area!!\n");
return 0;
}
ptrl = (u_int32_t*)(CSP0BASE);
ptrr = (u_int32_t*)(CSP0BASE+0x100);
#ifdef MARTIN #ifdef MARTIN
int i; int i;
for (i=0; i < 10; i++) for (i=0; i < 10; i++)
printf("%X\n",*(ptrl+i)); printf("%X\n",Beb_Read32(baseaddr, (LEFT_OFFSET + i*4)));
#endif #endif
// Generating commands // Generating commands
send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0; send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0;
send_frame_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | packet_size << 14 | (npackets-1); send_frame_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | packet_size << 14 | (npackets-1);
#ifdef MARTIN #ifdef MARTIN
for (i=0; i < 10; i++) for (i=0; i < 10; i++)
printf("%X\n",*(ptrl+i)); printf("%X\n",Beb_Read32(baseaddr, (LEFT_OFFSET + i*4)));
printf("%d\n",in_two_requests); printf("%d\n",in_two_requests);
#endif #endif
// Wait until last command was send successfully
// while (*(ptrl+6) != 0);
// while (*(ptrr+6) != 0);
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right) //"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
//Left //Left
*(ptrl+2) = 0; Beb_Write32(baseaddr, (LEFT_OFFSET + FIRST_CMD_PART1_OFFSET),0);
*(ptrl+3) = send_header_command; Beb_Write32(baseaddr, (LEFT_OFFSET + FIRST_CMD_PART2_OFFSET),send_header_command);
*(ptrl+4) = 0; Beb_Write32(baseaddr, (LEFT_OFFSET + SECOND_CMD_PART1_OFFSET),0);
*(ptrl+5) = send_frame_command; Beb_Write32(baseaddr, (LEFT_OFFSET + SECOND_CMD_PART2_OFFSET),send_frame_command);
*(ptrl+7) = in_two_requests << 31; value = Beb_Read32(baseaddr,(LEFT_OFFSET + TWO_REQUESTS_OFFSET));
if(in_two_requests) Beb_Write32(baseaddr, (LEFT_OFFSET + TWO_REQUESTS_OFFSET),(value | TWO_REQUESTS_BIT));
else Beb_Write32(baseaddr, (LEFT_OFFSET + TWO_REQUESTS_OFFSET),(value &~(TWO_REQUESTS_BIT)));
// Right // Right
*(ptrr+2) = 0; Beb_Write32(baseaddr, (RIGHT_OFFSET + FIRST_CMD_PART1_OFFSET),0);
*(ptrr+3) = send_header_command | 0x2000; Beb_Write32(baseaddr, (RIGHT_OFFSET + FIRST_CMD_PART2_OFFSET),send_header_command | right_port_value);
*(ptrr+4) = 0; Beb_Write32(baseaddr, (RIGHT_OFFSET + SECOND_CMD_PART1_OFFSET),0);
*(ptrr+5) = send_frame_command | 0x2000; Beb_Write32(baseaddr, (RIGHT_OFFSET + SECOND_CMD_PART2_OFFSET),send_frame_command | right_port_value);
*(ptrr+7) = in_two_requests | (in_two_requests << 31); value = Beb_Read32(baseaddr,(RIGHT_OFFSET + TWO_REQUESTS_OFFSET));
if(in_two_requests) Beb_Write32(baseaddr, (RIGHT_OFFSET + TWO_REQUESTS_OFFSET),(value | TWO_REQUESTS_BIT));
else Beb_Write32(baseaddr, (RIGHT_OFFSET + TWO_REQUESTS_OFFSET),(value &~(TWO_REQUESTS_BIT)));
// Set number of frames // Set number of frames
*(ptrl+6) = nimages*(2+in_two_requests); Beb_Write32(baseaddr, (LEFT_OFFSET + COMMAND_COUNTER_OFFSET), nimages*(2+in_two_requests));
*(ptrr+6) = nimages*(2+in_two_requests); Beb_Write32(baseaddr, (RIGHT_OFFSET + COMMAND_COUNTER_OFFSET), nimages*(2+in_two_requests));
#ifdef MARTIN #ifdef MARTIN
for (i=0; i < 10; i++) for (i=0; i < 10; i++)
printf("%X\n",*(ptrl+i)); printf("%X\n",Beb_Read32(baseaddr, (LEFT_OFFSET + i*4))); //*(ptrl+i));
printf("%d\n",in_two_requests); printf("%d\n",in_two_requests);
#endif #endif
close(fd); Beb_close(fd);
#ifdef MARTIN #ifdef MARTIN
cprintf(RED, "----Beb_RequestNImages----\n"); printf("----Beb_RequestNImages----\n");
#endif #endif
}
return 1; return 1;
} }

View File

@ -115,8 +115,19 @@
#define MASTER_BIT_MASK 0x200 #define MASTER_BIT_MASK 0x200
// Master Slave Top Bottom Definition // Master Slave Top Bottom Definition
#define MODULE_CONFIGURATION_MASK 0x84 #define MODULE_CONFIGURATION_MASK 0x84
//stop acquisition offsets
#define STOP_ACQUISITION_LEFT_OFFSET 0x01c //new memory
#define STOP_ACQUISITION_RIGHT_OFFSET 0x11c #define LEFT_OFFSET 0x0
#define STOP_ACQUISITION_BIT 0x40000000 #define RIGHT_OFFSET 0x100
#define FIRST_CMD_PART1_OFFSET 0x8
#define FIRST_CMD_PART2_OFFSET 0xc
#define SECOND_CMD_PART1_OFFSET 0x10
#define SECOND_CMD_PART2_OFFSET 0x14
#define COMMAND_COUNTER_OFFSET 0x18
#define STOP_ACQ_OFFSET 0x1c
#define STOP_ACQ_BIT 0x40000000
#define TWO_REQUESTS_OFFSET 0x1c
#define TWO_REQUESTS_BIT 0x80000000

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3 Repsitory UUID: b3dc8271bc5b101e2a973f5d520934ba67ad47fe
Revision: 107 Revision: 139
Branch: gemma Branch: master
Last Changed Author: Maliakal_Dhanya Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 288 Last Changed Rev: 299
Last Changed Date: 2014-12-08 10:16:31 +0100 Last Changed Date: 2015-06-15 17:41:48 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer" #define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3" #define SVNREPUUID "b3dc8271bc5b101e2a973f5d520934ba67ad47fe"
//#define SVNREV 0x288 //#define SVNREV 0x299
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x288 #define SVNREV 0x299
#define SVNDATE 0x20141208 #define SVNDATE 0x20150615
// //

View File

@ -233,23 +233,6 @@ int getDetectorNumber(){
perror("gethostname"); perror("gethostname");
sscanf(hostname,"%x",&res); sscanf(hostname,"%x",&res);
return res; return res;
/*
char output[255]="";
int res=0;
FILE* sysFile = popen("hostname", "r");
fgets(output, sizeof(output), sysFile);
pclose(sysFile);
sscanf(output,"%x",&res);
return res;
*/
/*
int res=0;
char hostname[100] = "beb000";
sscanf(hostname,"%x",&res);
return res;
*/
} }

View File

@ -50,7 +50,7 @@ XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR
#define XPAR_PLB_GPIO_SYS_HIGHADDR 0xD100FFFF #define XPAR_PLB_GPIO_SYS_HIGHADDR 0xD100FFFF
/** Stop Acquisition */ /** Stop Acquisition */
#define XPAR_STOP_ACQUISITION 0xC5000000 #define XPAR_CMD_GENERATOR 0xC5000000
/* Definitions for peripheral PLB_GPIO_TEST */ /* Definitions for peripheral PLB_GPIO_TEST */
#define XPAR_PLB_GPIO_TEST_BASEADDR 0xD1010000 #define XPAR_PLB_GPIO_TEST_BASEADDR 0xD1010000

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3 Repsitory UUID: b3dc8271bc5b101e2a973f5d520934ba67ad47fe
Revision: 882 Revision: 943
Branch: gemma Branch: master
Last Changed Author: Maliakal_Dhanya Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 882 Last Changed Rev: 943
Last Changed Date: 2014-12-08 10:16:31 +0100 Last Changed Date: 2015-06-15 17:41:48 +0200

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3 Repsitory UUID: b3dc8271bc5b101e2a973f5d520934ba67ad47fe
Revision: 177 Revision: 178
Branch: gemma Branch: master
Last Changed Author: Maliakal_Dhanya Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 288 Last Changed Rev: 299
Last Changed Date: 2014-12-08 10:16:31 +0100 Last Changed Date: 2015-06-15 17:41:48 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer" #define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3" #define SVNREPUUID "b3dc8271bc5b101e2a973f5d520934ba67ad47fe"
//#define SVNREV 0x288 //#define SVNREV 0x299
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x288 #define SVNREV 0x299
#define SVNDATE 0x20141208 #define SVNDATE 0x20150615
// //

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3 Repsitory UUID: b3dc8271bc5b101e2a973f5d520934ba67ad47fe
Revision: 64 Revision: 65
Branch: gemma Branch: master
Last Changed Author: Maliakal_Dhanya Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 288 Last Changed Rev: 299
Last Changed Date: 2014-12-08 10:16:31 +0100 Last Changed Date: 2015-06-15 17:41:48 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer" #define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3" #define SVNREPUUID "b3dc8271bc5b101e2a973f5d520934ba67ad47fe"
//#define SVNREV 0x288 //#define SVNREV 0x299
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x288 #define SVNREV 0x299
#define SVNDATE 0x20141208 #define SVNDATE 0x20150615
// //

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/mythenDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/mythenDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3 Repsitory UUID: b3dc8271bc5b101e2a973f5d520934ba67ad47fe
Revision: 93 Revision: 94
Branch: gemma Branch: master
Last Changed Author: Maliakal_Dhanya Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 288 Last Changed Rev: 299
Last Changed Date: 2014-12-08 10:16:31 +0100 Last Changed Date: 2015-06-15 17:41:48 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer" #define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3" #define SVNREPUUID "b3dc8271bc5b101e2a973f5d520934ba67ad47fe"
//#define SVNREV 0x288 //#define SVNREV 0x299
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x288 #define SVNREV 0x299
#define SVNDATE 0x20141208 #define SVNDATE 0x20150615
// //

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURLLIB "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git" #define SVNURLLIB "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUIDLIB "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3" #define SVNREPUUIDLIB "b3dc8271bc5b101e2a973f5d520934ba67ad47fe"
//#define SVNREV 0x882 //#define SVNREV 0x943
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTHLIB "Maliakal_Dhanya" #define SVNAUTHLIB "Dhanya_Maliakal"
#define SVNREVLIB 0x882 #define SVNREVLIB 0x943
#define SVNDATELIB 0x20141208 #define SVNDATELIB 0x20150615
// //