mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 04:47:14 +02:00
switching the gpio definitions into function implementation
This commit is contained in:
@ -3408,25 +3408,17 @@ int startWritingFPGAprogram(FILE** filefp){
|
||||
return FAIL;
|
||||
}
|
||||
strcat(mtdvalue,pch);
|
||||
printf ("\nWriting FPGA program to flash.\nThe drive is %s\n",mtdvalue);
|
||||
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");
|
||||
/*
|
||||
char output2[255];
|
||||
fp = popen("echo 0 > /sys/class/gpio/gpio9/value","r");
|
||||
fgets(output2, sizeof(output2), fp);
|
||||
pclose(fp);
|
||||
printf("strlen output %d\n", strlen(output2)); //always 1
|
||||
printf("output got:%s\n",output2);
|
||||
if(strstr (output2,"No such file or directory")!= NULL){ //doesnt notice
|
||||
printf("matched!\n");
|
||||
return -1;
|
||||
}
|
||||
printf("not matched\n");
|
||||
*/
|
||||
|
||||
|
||||
//writing the program to flash
|
||||
*filefp = fopen(mtdvalue, "w");
|
||||
@ -3473,6 +3465,11 @@ 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;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.1
Executable file
BIN
slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.1
Executable file
Binary file not shown.
@ -3534,16 +3534,9 @@ int program_fpga(int file_des) {
|
||||
#endif
|
||||
|
||||
//opening file pointer to flash and telling FPGA to not touch flash
|
||||
int startret = startWritingFPGAprogram(&fp);
|
||||
/*printf("startret:%d\n",startret);*/
|
||||
if(startret != OK){
|
||||
if(startret == FAIL){
|
||||
if(startWritingFPGAprogram(&fp) != OK){
|
||||
sprintf(mess,"Could not write to flash. Error at startup.\n");
|
||||
cprintf(RED,"%s",mess);
|
||||
}/*else if (startret == -1){
|
||||
cprintf(RED,"Error: Please define the gpio pins and their direction in /etc/rc before rebooting\n");
|
||||
cprintf(RED,"%s",mess);
|
||||
}*/
|
||||
ret=FAIL;
|
||||
filesize = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user