Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phtif dietrich 2024 apr 29 #359

Merged
merged 6 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ jobs:

- name: Install saftlib
run: sudo make saftlib-install

- name: Build phtif
run: make phtif
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ ifeq ($(UNAME), x86_64)
$(MAKE) -C ip_cores/wrpc-sw SDBFS=$(PWD)/ip_cores/fpga-config-space/sdbfs/userspace clean
endif

phtif:
$(MAKE) -C tools/phtif

phtif-clean:
$(MAKE) -C tools/phtif clean

# #################################################################################################
# Arria 2 devices
# #################################################################################################
Expand Down
5 changes: 3 additions & 2 deletions tools/phtif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# Note: during compile (all), PREFIX must be set to the final installation path
# Example usage:
# 'make clean'
# 'make PREFIX= all' (hack: leave PREFIX empty for SCU path)
# 'make PREFIX= all' (hack: leave PREFIX empty for SCU path)
# Example deploy:
# 'make PREFIX= STAGING=/common/export/timing-rte/phtif deploy' (hack: leave PREFIX empty for SCU path)
# 'make PREFIX= STAGING=/common/export/timing-rte/phtif-dev deploy' (hack: leave PREFIX empty for SCU path)
# 'make PREFIX= STAGING=/common/export/timing-rte/phtif deploy' (hack: leave PREFIX empty for SCU path)
PREFIX ?= /usr/local
STAGING ?=
ARCH ?= /x86_64
Expand Down
12 changes: 8 additions & 4 deletions tools/phtif/asl/phtif.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ mkdir /tmp/phtifivt
cp -a /opt/$NAME/$ARCH/tmp/phtifivt/* /tmp/phtifivt
chmod a+w -R /tmp/phtifivt/

log 'creating phtif user'
touch /etc/phtif
#log 'creating phtif user'
#touch /etc/phtif

adduser --disabled-password --shell /bin/sh --home / phtif
echo "phtif:phtif" | chpasswd
#adduser --disabled-password --shell /bin/sh --home / phtif
#echo "phtif:phtif" | chpasswd

# there is an issue with user phtif we can't fix; lets be nasty
log 'change pw to phtif'
echo "root:phtif" | chpasswd
1 change: 1 addition & 0 deletions tools/phtif/x86/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
phtif
4 changes: 2 additions & 2 deletions tools/phtif/x86/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# PREFIX controls where programs and libraries get installed
# Note: during compile (all), PREFIX must be set to the final installation path
# Example usage:
# 'make MASP=YES PRO=NO PREFIX= all' (hack: leave PREFIX empty for SCU path)
# 'make PREFIX= all' (hack: leave PREFIX empty for SCU path)
# Example deploy:
# 'make MASP=YES PRO=NO PREFIX= STAGING=/common/export/timing-rte/XYZ deploy' (hack: leave PREFIX empty for SCU path)
# 'make PREFIX= STAGING=/whateverPath deploy' (hack: leave PREFIX empty for SCU path)
PREFIX ?= /usr/local
STAGING ?=
ARCH ?= x86_64
Expand Down
25 changes: 17 additions & 8 deletions tools/phtif/x86/phtif.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* created : 2021
* author : Dietrich Beck, GSI-Darmstadt
* version : 19-Apr-2021
* version : 29-Apr-2024
*
* Poor Humans TIF; this is a quick and dirty hack for the 2021 beam time; configure pulses
* for certain Event IDs.
Expand Down Expand Up @@ -35,7 +35,7 @@
* For all questions and ideas contact: d.beck@gsi.de
* Last update: 15-April-2021
*********************************************************************************************/
#define PHTIF_X86_VERSION 0x000002
#define PHTIF_X86_VERSION 0x000003

// standard includes
#include <unistd.h> // getopt
Expand All @@ -59,6 +59,7 @@

const char* program;
char path[MAXLEN];
int flagScu;


static void die(const char* where, uint32_t status) {
Expand All @@ -73,7 +74,8 @@ static void help(void)
fprintf(stderr, "Usage: %s [OPTION]\n", program);
fprintf(stderr, "\n");
fprintf(stderr, " -h display this help and exit\n");
fprintf(stderr, " -p <path> specify alternative location for menu settings\n");
fprintf(stderr, " -p <path> specify alternative location for menu settings\n");
fprintf(stderr, " -s target is an SCU; default is non-SCU\n");
fprintf(stderr, "\n");
fprintf(stderr, "Use this tool as quick and dirty hack to configure IOs \n");
fprintf(stderr, "\n");
Expand Down Expand Up @@ -209,7 +211,8 @@ void cmdCreateCondition(char *parname)

// configure output
// build and execute command
sprintf(cmd, "saft-io-ctl %s -n IO%d -o1 -t0 -a1", device, io);
if (flagScu) sprintf(cmd, "saft-io-ctl %s -n B%d -o1 -a1" , device, io);
else sprintf(cmd, "saft-io-ctl %s -n IO%d -o1 -t0 -a1", device, io);
executeCommand(cmd, out);
if (strlen(out) > 1) {
printf("result:\n%s\npress RETURN to continue\n", out);
Expand Down Expand Up @@ -279,7 +282,8 @@ void cmdCreateCondition(char *parname)
if (offset < 0) sprintf(negFlag, "-g");
else sprintf(negFlag, " ");

sprintf(cmd, "saft-io-ctl %s -n IO%d -c 0x%lx 0x%lx %d 0x0 1 -u %s", device, io, evtId, mask, abs(offset), negFlag);
if (flagScu) sprintf(cmd, "saft-io-ctl %s -n B%d -c 0x%lx 0x%lx %d 0x0 1 -u %s" , device, io, evtId, mask, abs(offset), negFlag);
else sprintf(cmd, "saft-io-ctl %s -n IO%d -c 0x%lx 0x%lx %d 0x0 1 -u %s", device, io, evtId, mask, abs(offset), negFlag);
executeCommand(cmd, out);
if (strlen(out) > 1) {
printf("result:\n%s\npress RETURN to continue\n", out);
Expand All @@ -291,7 +295,8 @@ void cmdCreateCondition(char *parname)
if ((offset + length) < 0) sprintf(negFlag, "-g");
else sprintf(negFlag, " ");

sprintf(cmd, "saft-io-ctl %s -n IO%d -c 0x%lx 0x%lx %d 0x0 0 -u %s", device, io, evtId, mask, abs(offset+length), negFlag);
if (flagScu) sprintf(cmd, "saft-io-ctl %s -n B%d -c 0x%lx 0x%lx %d 0x0 0 -u %s" , device, io, evtId, mask, abs(offset+length), negFlag);
else sprintf(cmd, "saft-io-ctl %s -n IO%d -c 0x%lx 0x%lx %d 0x0 0 -u %s", device, io, evtId, mask, abs(offset+length), negFlag);
executeCommand(cmd, out);
if (strlen(out) > 1) {
printf("result:\n%s\npress RETURN to continue\n", out);
Expand Down Expand Up @@ -405,17 +410,21 @@ int main(int argc, char** argv)
char txtname[MAXLEN];

// local variables
program = argv[0];
program = argv[0];
sprintf(path, "/tmp/phtifivt");
flagScu = 0;

while ((opt = getopt(argc, argv, "p:h")) != -1) {
while ((opt = getopt(argc, argv, "p:hs")) != -1) {
switch (opt) {
case 'h':
help();
return 0;
case 'p':
sprintf(path, "%s", optarg);
break;
case 's':
flagScu = 1;
break;
case ':':
case '?':
error = 1;
Expand Down
Loading