Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Extract kernel module source from Teledyne rpm

...

Code Block
languagetext
titleTestPlanNOV29.txt
collapsetrue
    CBXFEL Digitizer Test Plan
    Chris Ford <caf@slac.stanford.edu>
    Nov 29, 2022

------- Phase 1 --(complete)---------------------------------------

Receive Teledyne documentation and software

Receive charge code

Work with Thuy to install digitizer and timing hardware in 2U crate
 - Building 034
 - Remote access
 - root or sudo access

Verify that card is recognized by Linux using lspci
(Note: we did this with 1U cpu and CentOS 7)

------- Phase 2 --(in progresscomplete)------------------------------------

Verify basic compatibility with SLAC's Linux environment
 - obtain GPL'd kernel module  (complete)module
 - build kernel module in SLAC LinuxRT environment (in progress)
 - Teledyne kernel module: insmod
 - Teledyne library: build and run ADQAPI_simple_example.c

Verify reading a DC voltage

------- Phase 3 ---------------------------------------------------

Connect trigger to SLAC EVR (requires 2U cpu)

Verify synchronous operation at 1 Hz

Verify synchronous operation at 120 Hz

------- Open Issues -----------------------------------------------

1. Missing compatible power cable for 2U 8201
2. Teledyne library depends on libusb even though ADQ14 is pci

...

Code Block
languagetext
titleTeledyne kernel module README
collapsetrue
This is the PCIe driver for Signal Processing Devices digitizers.

If your Linux distribution supports DKMS, the easiest way to install
the driver is by using the appropriate .deb or .rpm package.

To install the driver manually, you need to first compile it and then
install it. As a prerequisite, the kernel headers corresponding to
your installed Linux kernel needs to be installed. See your distributions
documentation on how to install the kernel headers, the package is
usually called 'linux-kernel-headers', 'kernel-devel', 'kernel-headers',
'linux-headers' or something similar.

After installing the prerequisites, compile the PCIe driver by running
this command in the same folder as this README:

     make

Then install the driver by running this command as root (using su or sudo):

     make install

After installation, the module will normally be loaded automatically at
boot when a card is attached. A manual module load can be performed by
running the following command as root:

     modprobe spd_adq_pci

By default only root has access to the driver device files.
When installing the ADQAPI software package, udev rules will be
automatically set up so that the device files can be accessed by users.

Note that if you upgrade your kernel, you will need to re-run 'make' and
'make install' in order to compile the driver for your new kernel.
When using DKMS, this is handled automatically.

Software Installation

Note: we choose Ubuntu_18.04 as a reference because it uses kernel version 4.x.

Code Block
languagetext
titleAvailable Teledyne Packages
# ls digitizer/ADQ_SDK_linux_r65383/packages/
CentOS_7/           Fedora_34/          SLE_15/
CentOS_8/           many/               Ubuntu_16.04/
CentOS_8_Stream/    openSUSE_Leap_15.2/ Ubuntu_18.04/
Debian_10/          openSUSE_Leap_42.3/ Ubuntu_19.04/
Debian_11/ e         RHEL_7/             Ubuntu_20.04/
Debian_9.0/         ScientificLinux_7/  Ubuntu_21.04/
Fedora_32/          SLE_12/

CentOS 7 Notes click here

LinuxRT Notes

Server Details

Advantech 8201

Kernel Module

Code Block
languagetext
titleThuy Vu writes:Extract kernel module source from Teledyne rpm
$ rpm2cpio spd-adq-pci-dkms-1.21-1.noarch.rpm | cpio -idmv
./usr/src/spd-adq-pci-1.21/dkms.conf
./usr/src/spd-adq-pci-1.21/src/Makefile
./usr/src/spd-adq-pci-1.21/src/README
./usr/src/spd-adq-pci-1.21/src/README_internal.md
./usr/src/spd-adq-pci-1.21/src/spd_adq_pci.c
./usr/src/spd-adq-pci-1.21/src/spd_adq_pci_ioctl.h
116 blocks

CentOS 7 Notes click here

LinuxRT Notes click here

Server Details

Advantech 8201

Code Block
languagetext
titleThuy Vu writes:
The Digitizer card is the x16 PCIe card, it can’t be used in the 2U 8200 that Shawn have upstairs.
We need to use itThe Digitizer card is the x16 PCIe card, it can’t be used in the 2U 8200 that Shawn have upstairs.
We need to use it in 1U 8101 or 2U 8201.

EVR and ADQ14 Recognized by CentOS 7

...

Code Block
languagetext
titleKernel Module on LinuxRT
collapsetrue
root@cpu-b34-sp02]$ ls
adq.ko
[ root@cpu-b34-sp02]$ ls /dev > dev_before_insmod.txt
[ root@cpu-b34-sp02]$ dmesg   > dmesg_before_insmod.txt
[ root@cpu-b34-sp02]$ insmod adq.ko 
[102834.973910] adq: loading out-of-tree module taints kernel.
[102834.979952] adq: SPD ADQ PCI Device driver v1.21 loaded.
[102834.985819] spd_adq_pci 0000:da:00.0: Found Signal Processing Devices ADQ14, device PCIe/PXIe/uTCA bus 218 slot 0 function 0
[ root@cpu-b34-sp02]$ ls /dev > dev_after_insmod.txt
[ root@cpu-b34-sp02]$ dmesg   > dmesg_after_insmod.txt
[ root@cpu-b34-sp02]$ 
[ root@cpu-b34-sp02]$ ls -l
total 229
-rw-------    1 laci     lcls         32048 Nov 30 16:42 adq.ko
-rw-r--r--    1 root     root          3857 Nov 30 16:45 dev_after_insmod.txt
-rw-r--r--    1 root     root          3840 Nov 30 16:44 dev_before_insmod.txt
-rw-r--r--    1 root     root         95069 Nov 30 16:46 dmesg_after_insmod.txt
-rw-r--r--    1 root     root         94816 Nov 30 16:45 dmesg_before_insmod.txt
[ root@cpu-b34-sp02]$ diff dev_before_insmod.txt dev_after_insmod.txt 
--- dev_before_insmod.txt
+++ dev_after_insmod.txt
@@ -1,3 +1,4 @@
+adq_pcie_218_0_0
 bus
 console
 cpu
[ root@cpu-b34-sp02]$ diff dmesg_before_insmod.txt dmesg_after_insmod.txt 
--- dmesg_before_insmod.txt
+++ dmesg_after_insmod.txt
@@ -1347,3 +1347,6 @@
 [   23.257900] random: dropbear: uninitialized urandom read (32 bytes read)
 [   24.553478] ipmi device interface
 [   24.768942] IPv6: ADDRCONF(NETDEV_UP): eth5: link is not ready
+[102834.973910] adq: loading out-of-tree module taints kernel.
+[102834.979952] adq: SPD ADQ PCI Device driver v1.21 loaded.
+[102834.985819] spd_adq_pci 0000:da:00.0: Found Signal Processing Devices ADQ14, device PCIe/PXIe/uTCA bus 218 slot 0 function 0
[ root@cpu-b34-sp02]$ 

Demo: build Teledyne kernel module in LinuxRT sandbox directory

 loading out-of-tree module taints kernel.
+[102834.979952] adq: SPD ADQ PCI Device driver v1.21 loaded.
+[102834.985819] spd_adq_pci 0000:da:00.0: Found Signal Processing Devices ADQ14, device PCIe/PXIe/uTCA bus 218 slot 0 function 0
[ root@cpu-b34-sp02]$ 

Teledyne Library depends on libusb

See line 20 of libadq.la (below).

Code Block
languagetext
titlelibadq.la
linenumberstrue
collapsetrue
# libadq.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-2
#
# Please DO NOT delete this file!
# It is necessary for linking the library.

# The name that we can dlopen(3).
dlname='libadq.so.0'

# Names of this library.
library_names='libadq.so.0.0.65383 libadq.so.0 libadq.so'

# The name of the static archive.
old_library='libadq.a'

# Linker flags that cannot go in dependency_libs.
inherited_linker_flags=''

# Libraries that this one depends upon.
dependency_libs=' -lusb-1.0 -ludev -lrt -lpthread'

# Names of additional weak libraries provided by this library
weak_library_names=''

# Version information for libadq.
current=0
age=0
revision=65383

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/lib'

Installed Teledyne library

Code Block
languagetext
title/afs/slac/g/lcls/package/teledyne
collapsetrue
/afs/slac/g/lcls/package/teledyne/libadq0-0.65383/:
Code Block
languagetext
titlelcls-dev3 demo
collapsetrue
lcls-dev3$ pwd
/u/ey/caf/digitizer/sandbox2/linuxKernel_Modules/adqDriver/R1.29.0/build/buildroot-2019.08-x86_6
lcls-dev3$ make clean
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.symvers  *.order *.c *.h module_* original.*
lcls-dev3$ ls
Makefile
lcls-dev3$ make
### copy the sources to make a directory for building
cp -r ../../src/* .
make compile
make[1]: Entering directory `/afs/slac.stanford.edu/g/controls/development/users/caf/digitizer/sandbox2/linuxKernel_Modules/adqDriver/R1.29.0/build/buildroot-2019.08-x86_64'
make ARCH=x86_64 CROSS_COMPILE=/afs/slac/package/linuxRT/buildroot-2019.08/host/linux-x86_64/x86_64/usr/bin/x86_64-buildroot-linux-gnu- -C /afs/slac/package/linuxRT/buildroot-2019.08/buildroot-2019.08-x86_64/output/build/linux-4.14.139 M=/u/ey/caf/digitizer/sandbox2/linuxKernel_Modules/adqDriver/R1.29.0/build/buildroot-2019.08-x86_64 modules
make[2]: Entering directory `/afs/slac.stanford.edu/package/linuxRT/vol7/buildroot-2019.08/buildroot-2019.08-x86_64/output/build/linux-4.14.139'
  CC [M]  /u/ey/caf/digitizer/sandbox2/linuxKernel_Modules/adqDriver/R1.29.0/build/buildroot-2019.08-x86_64/spd_adq_pci.o
  LD [M]  /u/ey/caf/digitizer/sandbox2/linuxKernel_Modules/adqDriver/R1.29.0/build/buildroot-2019.08-x86_64/adq.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /u/ey/caf/digitizer/sandbox2/linuxKernel_Modules/adqDriver/R1.29.0/build/buildroot-2019.08-x86_64/adq.mod.o
  LD [M]  /u/ey/caf/digitizer/sandbox2/linuxKernel_Modules/adqDriver/R1.29.0/build/buildroot-2019.08-x86_64/adq.ko
make[2]: Leaving directory `

/afs/slac.stanford.edu/g/lcls/package/linuxRTteledyne/vol7/buildrootlibadq0-20190.0865383/buildroot-2019.08-x86_64/output/build/linux-4.14.139'
make[1]: Leaving directory `:
bin  include  lib

/afs/slac.stanford.edu/g/controlslcls/developmentpackage/users/caf/digitizer/sandbox2/linuxKernel_Modules/adqDriver/R1.29.0/build/teledyne/libadq0-0.65383/buildroot-2019.08-x86_64'
lcls-dev3$ make install
mkdir -p ../../bin:

/afs/slac/g/lcls/package/teledyne/libadq0-0.65383/buildroot-2019.08-x86_64/include/
cp  spd_adq_pci_ioctl.h ../..:
ADQAPI.h

/afs/slac/g/lcls/package/teledyne/libadq0-0.65383/buildroot-2019.08-x86_64/include/.
cp  *.ko ../../buildroot-2019.08-x86_64/.
lcls-dev3$
lcls-dev3$ ls -l ../../buildroot-2019.08-x86_64/
total 34
-rw-rw-r-- 1 caf ey 32048 Dec  2 13:26 adq.ko
drwxrwxr-x 2 caf ey  2048 Dec  2 13:26 include lcls-dev3$  lcls-dev3$ ls -l ../../buildroot-2019.08-x86_64/include 
total 5
-rw-rw-r-- 1 caf ey 4466 Dec  2 13:26 spd_adq_pci_ioctl.h lcls-dev3$ lib:
libadq.a  libadq.la  libadq.so  libadq.so.0  libadq.so.0.0.65383

libusb Package

Code Block
languagetext
titleFile list of package libusb-1.0-0 in bionic of architecture amd64
/lib/x86_64-linux-gnu/libusb-1.0.so.0
/lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
/usr/share/doc/libusb-1.0-0/README
/usr/share/doc/libusb-1.0-0/changelog.Debian.gz
/usr/share/doc/libusb-1.0-0/copyright