mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
progress uncommented
This commit is contained in:
@ -65,7 +65,7 @@ typedef struct ip_header_struct {
|
||||
|
||||
|
||||
struct timeval tss,tse,tsss; //for timing
|
||||
int gpiopinsdefined = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -162,6 +162,32 @@ void defineGPIOpins(){
|
||||
system("echo out > /sys/class/gpio/gpio9/direction");
|
||||
}
|
||||
|
||||
void resetFPGA(){
|
||||
FPGAdontTouchFlash();
|
||||
FPGATouchFlash();
|
||||
}
|
||||
|
||||
void FPGAdontTouchFlash(){
|
||||
//tell FPGA to not touch flash
|
||||
system("echo 0 > /sys/class/gpio/gpio9/value");
|
||||
}
|
||||
|
||||
void FPGATouchFlash(){
|
||||
//tell FPGA to touch flash to program itself
|
||||
system("echo 1 > /sys/class/gpio/gpio9/value");
|
||||
}
|
||||
|
||||
void powerChip (int on){
|
||||
if(on){
|
||||
printf("\nPowering on the chip\n");
|
||||
bus_w(POWER_ON_REG,0x1);
|
||||
}
|
||||
else{
|
||||
printf("\nPowering off the chip\n");
|
||||
bus_w(POWER_ON_REG,0x0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
u_int16_t bus_r16(u_int32_t offset){
|
||||
@ -1436,17 +1462,6 @@ int writeGbeReg(int ivar, uint32_t val, int addr, int interface) {
|
||||
int configureInterface(uint32_t destip,uint64_t destmac,uint64_t sourcemac,int sourceip,int ival,uint32_t destport, uint32_t sourceport, int interface) {
|
||||
//int configureMAC(int ipad,long long int macad,long long int detectormacad, int detipad, int ival, int udpport){
|
||||
|
||||
/*
|
||||
if(!gpiopinsdefined){
|
||||
defineGPIOpins();
|
||||
gpiopinsdefined = 1;
|
||||
}
|
||||
//tell FPGA to not touch flash
|
||||
system("echo 0 > /sys/class/gpio/gpio9/value");
|
||||
//tell FPGA to touch flash to program itself
|
||||
system("echo 1 > /sys/class/gpio/gpio9/value");
|
||||
*/
|
||||
|
||||
|
||||
volatile u_int32_t conf= bus_r(CONFIG_REG);
|
||||
long int checksum=calcChecksum(sourceip, destip);
|
||||
@ -2722,14 +2737,7 @@ int startWritingFPGAprogram(FILE** filefp){
|
||||
printf ("\nFlash drive found: %s\n",mtdvalue);
|
||||
|
||||
|
||||
//define the gpio pins
|
||||
system("echo 7 > /sys/class/gpio/export");
|
||||
system("echo 9 > /sys/class/gpio/export");
|
||||
//define their direction
|
||||
system("echo in > /sys/class/gpio/gpio7/direction");
|
||||
system("echo out > /sys/class/gpio/gpio9/direction");
|
||||
//tell FPGA to not touch flash
|
||||
system("echo 0 > /sys/class/gpio/gpio9/value");
|
||||
FPGAdontTouchFlash();
|
||||
|
||||
//writing the program to flash
|
||||
*filefp = fopen(mtdvalue, "w");
|
||||
@ -2753,9 +2761,8 @@ int stopWritingFPGAprogram(FILE* filefp){
|
||||
wait = 1;
|
||||
}
|
||||
|
||||
|
||||
//tell FPGA to touch flash to program itself
|
||||
system("echo 1 > /sys/class/gpio/gpio9/value");
|
||||
//touch and program
|
||||
FPGATouchFlash();
|
||||
|
||||
if(wait){
|
||||
#ifdef VERY_VERBOSE
|
||||
@ -2776,10 +2783,6 @@ int stopWritingFPGAprogram(FILE* filefp){
|
||||
}
|
||||
printf("FPGA has picked up the program from flash\n\n");
|
||||
|
||||
//undefine the pins
|
||||
system("echo 7 > /sys/class/gpio/unexport");
|
||||
system("echo 9 > /sys/class/gpio/unexport");
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
int mapCSP0(void);
|
||||
void defineGPIOpins();
|
||||
void resetFPGA();
|
||||
void powerChip (int on);
|
||||
|
||||
u_int16_t bus_r16(u_int32_t offset);
|
||||
u_int16_t bus_w16(u_int32_t offset, u_int16_t data);//aldos function
|
||||
|
Binary file not shown.
@ -56,6 +56,12 @@ int adcvpp=0x4;
|
||||
|
||||
int init_detector(int b) {
|
||||
|
||||
if(b){
|
||||
defineGPIOpins();
|
||||
resetFPGA();
|
||||
usleep(250*1000);
|
||||
}
|
||||
|
||||
int i;
|
||||
if (mapCSP0()==FAIL) {
|
||||
printf("Could not map memory\n");
|
||||
@ -134,8 +140,10 @@ int init_detector(int b) {
|
||||
printf("Error: Setting dac %d failed, wrote %d, read %d\n",dacvalues[i][0],dacvalues[i][1],retval);
|
||||
}
|
||||
|
||||
|
||||
printf("\nPowering on the chip\n");
|
||||
bus_w(POWER_ON_REG,0x1);
|
||||
|
||||
printf("Resetting ADC\n");
|
||||
writeADC(ADCREG1,0x3); writeADC(ADCREG1,0x0);
|
||||
writeADC(ADCREG2,0x40);
|
||||
|
@ -505,7 +505,7 @@ void* postProcessing::processData(int delflag) {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
//get progress
|
||||
pthread_mutex_lock(&mg);
|
||||
if(setReceiverOnline() == ONLINE_FLAG){
|
||||
@ -524,7 +524,7 @@ void* postProcessing::processData(int delflag) {
|
||||
if (checkJoinThread()){
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user