Skip to content
Snippets Groups Projects
Commit bbd5451b authored by qzhou's avatar qzhou
Browse files

add protection to PLL access

parent 36ce052c
No related branches found
No related tags found
1 merge request!20add protection to PLL access
......@@ -5,9 +5,10 @@
Qi-Dong Zhou, KEK
2020.04.28 0.01 first version based on staths.c
2020.12.19 0.01 rename statlink to pcie40_statlink
2020.12.23 0.02 add protection for pll status access
\*--------------------------------------------------------------------------------*/
#define VERSION 01
#define VERSION 02
#define MOD_DATE 20200428
#include "pcie40_b2slc.h"
......@@ -20,7 +21,7 @@
#include <iostream>
#include <vector>
#include <bitset>
#include <sys/file.h>
#define MAX_NUM_CH 48
#define MAX_SLOT 3
......@@ -101,6 +102,7 @@ void argument(int argc, char **argv){
int
statpice40(pcie40reg_t pcie40reg)
{
FILE *fp = fopen("/tmp/pcie40_pll_lockfile_statlink.lck","w");
pcie40reg_t *pcie = &pcie40reg;
memset(pcie, 0, sizeof(*pcie));
int pcie40_sta = pcie40_status(dev_slot);
......@@ -112,6 +114,7 @@ statpice40(pcie40reg_t pcie40reg)
pcie40_run_number(dev_slot),
D(pcie40_sta, 28, 17),
pcie40_trg_type(dev_slot));
flock( fileno(fp), LOCK_EX );
printf("PLLs:%s | rxlink: %s | txlink: %s | txlink: %s | rxdisp: %s | rxdata: %s\n",
(pcie40_pllLockStatus(dev_slot, 1)&&pcie40_pllLockStatus(dev_slot, 2)&&pcie40_pllLockStatus(dev_slot, 3))?"LOCKED":"NOT LOCKED",
B(pcie40_sta, 0)?"READY":"NOT READY",
......@@ -146,7 +149,9 @@ statpice40(pcie40reg_t pcie40reg)
pcie40_pllInputCounter(dev_slot, 3)?"OK ":"LOS",
pcie40_pllFrequencyCounter(dev_slot, 3)?"OK ":"OOF");
printf("__________________________________\n");
}
}
flock( fileno(fp), LOCK_UN );
fclose(fp);
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment